Practice
Silo RS485 Burst
Longbarrow Silo's level controller talks to the yard office over a two-wire RS-485 cable beside the weighbridge. The link is half duplex.
Its transceiver drives the line only while its driver-enable pin is high.
The shipped controller dropped driver enable as soon as the last data bit went out. The final stop bit was still crossing the long cable.
The office radio clicked on the chopped last byte, so every third command had to be sent twice.
Your task: build a burst transmitter that owns the line a little early and lets go a little late. Send all three command bytes without gaps. Keep the driver on through the full last stop bit and a short tail.
Interface
| Port | Direction | Type | Description |
|---|---|---|---|
clk | in | 1 bit | Clock |
rst | in | 1 bit | Synchronous reset (active high) |
start | in | 1 bit | Begin a burst |
payload | in | 24-bit vector | Three command bytes |
tx | out | 1 bit | UART line to the transceiver, idle high |
de | out | 1 bit | Transceiver driver enable |
busy | out | 1 bit | High while a burst runs |
done | out | 1 bit | One-clock pulse on the burst's final tail clock |
Behavior
- The unit listens for
startonly between bursts; an accepted request opens its burst on the next clock - Acceptance latches
payloadon the spot - A burst in flight keeps that latched copy, whatever
payloaddoes afterwards - While
busyis high, every furtherstartpulse is ignored busygoes high at acceptance and remains high through the final tail clock- The UART format is 8N1, with four clocks for every bit
- Each byte has one low start bit, eight data bits, and one high stop bit
- Data bits are sent least significant bit first
payload[7:0]is sent first, followed bypayload[15:8], thenpayload[23:16]- Each burst starts with exactly four lead clocks
- During all four lead clocks,
deis high andtxremains high - The three bytes follow the lead period back to back
- There are no extra idle clocks between one byte's stop bit and the next byte's start bit
- After the third byte's full stop bit, the burst has exactly four tail clocks
- During all four tail clocks,
deremains high andtxremains high deis high for every burst clock, including the whole final stop bit and the whole taildonepulses exactly once, on the final tail clockbusyis still high during thedonepulse- After the final tail clock,
deandbusyfall together, and the unit becomes idle - While idle,
txis high,deis low, and both status outputs are low rsthigh at any rising edge releases the line, clears both status outputs, and aborts all burst progress- After reset,
txis high,deis low, and no aborted burst resumes
What the bench checks
- The testbench checks idle acceptance, next-clock burst start, and ignored requests while busy
- It changes
payloadduring a burst and checks that the captured payload remains in use - A bench-side decoder rebuilds all three bytes from
txalone, checking framing, bit width, byte order, and gapless frames - It checks exactly four lead clocks and exactly four tail clocks, with
deandtxhigh through both - Releasing
deduring the final stop bit or anywhere in the tail fails - It asserts reset during lead, data, stop, and tail clocks
Constraints
everything is synchronous to clk; inputs are sampled on rising edges, and all outputs are registered.
this models the transceiver's tx and driver-enable logic pins only. It does not model A/B differential signals, cable reflections, or receive direction.
Do not add ports.
Click Run to execute your code. Output will appear here.