G6.2.3 Parallel-In Serial-Out Transmitter

EasyImplementIcarus Verilog + Yosys · serverReview the topic

Send a byte LSB first on one wire, one bit per cycle, with a busy flag for exactly eight cycles.

Hardware context: A 6-bit display scroll register with separate controls, and a receiver and transmitter for 8-bit sensor readings sent LSB first. Send LSB-first bytes from a loaded shift register with a busy flag.

The sensor link of the receiver problem needs its transmitter. A start loads a byte; the next eight cycles put bits 0 to 7 on sout, one per cycle. busy tells the rest of the chip not to start another byte yet.

This is an Implement problem. The starter loads the byte but never shifts it or counts. Complete tx8. The check runs twenty-four edges per case.

Signals in the Timeline

SignalWidthRole
script48input of each check
Full specification
The module (keep the name and the ports)
module tx8 (
  input  logic       clk,
  input  logic       rst,     // synchronous reset: idle
  input  logic       start,   // 1 at an edge while idle: load din and start sending
  input  logic [7:0] din,     // the byte to send; may change once it is loaded
  output logic       sout,    // the serial output: bit 0 first; 0 when idle
  output logic       busy     // 1 in the eight cycles that carry the bits
);
  ...
endmodule
At a rising edgeEffect
rst = 1idle: busy = 0, sout = 0
idle and start = 1take din; in the next cycle busy = 1 and sout = bit 0
busythe next bit goes on sout; after the cycle of bit 7, idle again
busy and start = 1start is ignored

busy is 1 in exactly eight cycles per byte, the ones whose sout is a bit. sout is 0 whenever busy is 0. din may change once the byte is taken. The result shows sout and busy after every edge.

Examples

Example 1

One Byte, 0x35
Input
per edge (S = start, R = reset, - = neither): S-----------------------; din = 35
Output
sout_by_edge = 'b000000000000000000110101, busy_by_edge = 'b000000000000000011111111

After the start edge, sout carries 1, 0, 1, 0, 1, 1, 0, 0 (0x35, LSB first) with busy = 1. Both fields list edges from the right: edge 0 is the last digit.

Example 2

Start Held High: A Gap of One Idle Cycle Between Bytes
Input
per edge (S = start, R = reset, - = neither): SSSSSSSSSSSSSSSSSSSSSSSS; din = a1 until edge 10, then 7e
Output
sout_by_edge = 'b111110010100001010100001, busy_by_edge = 'b111111011111111011111111

start is ignored while busy. busy drops after eight bit cycles; the next edge sees start with busy = 0 and loads the next byte.

Example 3

A Start While Busy Is Ignored
Input
per edge (S = start, R = reset, - = neither): S--S--S-----------------; din = c3
Output
sout_by_edge = 'b000000000000000011000011, busy_by_edge = 'b000000000000000011111111

The starts at edges 3 and 6 come while busy is 1. The byte goes out unchanged, and only one byte is sent.

Constraints and Contract

  • All inputs are known 0/1 values and change only between edges.
  • Keep the module name and the ports. The design must synthesize with no latches.

Hints

Hint 1

LSB first: bit 0 goes out first. Which end of a shift register should drive sout, and which way should it shift?

Hint 2

Count the bits already sent. busy must drop on the edge that ends the cycle of bit 7.

Hint 3

Check start only while idle. Copy din into the register at the start edge, so a later change to din does not matter.

What the grader checks: Seven directed and ten seeded scripts of twenty-four edges. They include starts while busy, a start at the edge where busy drops, din changes in mid-byte and resets. sout and busy are compared with a JavaScript model after every edge. Synthesis must report no latches.

The submitted design must synthesize with 0 latches and no combinational loop. Counts come from the pinned open-source synthesis flow. They are proxies for logic size and depth, not physical area or timing.

17 checks on Icarus Verilog + Yosys · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain public samples only. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 3 steps and the final capstone

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

One Byte, 0x35

Input
per edge (S = start, R = reset, - = neither): S-----------------------; din = 35
Expected output
sout_by_edge = 'b000000000000000000110101, busy_by_edge = 'b000000000000000011111111

After the start edge, sout carries 1, 0, 1, 0, 1, 1, 0, 0 (0x35, LSB first) with busy = 1. Both fields list edges from the right: edge 0 is the last digit.

Run samples executes all 3 public checks. Check all tests runs 17 checks on the server.

Icarus Verilog + Yosys · server