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_i | in | 1 bit | Clock |
rst_i | in | 1 bit | Synchronous reset (active high) |
start_i | in | 1 bit | Begin a burst |
payload_i | in | 24-bit vector | Three command bytes |
tx_o | out | 1 bit | UART line to the transceiver, idle high |
de_o | out | 1 bit | Transceiver driver enable |
busy_o | out | 1 bit | High while a burst runs |
done_o | out | 1 bit | One-clock pulse on the burst's final tail clock |
Behavior
- The unit listens for
start_ionly between bursts; an accepted request opens its burst on the next clock - Acceptance latches
payload_ion the spot - A burst in flight keeps that latched copy, whatever
payload_idoes afterwards - While
busy_ois high, every furtherstart_ipulse is ignored busy_ogoes 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_i[7:0]is sent first, followed bypayload_i[15:8], thenpayload_i[23:16]- Each burst starts with exactly four lead clocks
- During all four lead clocks,
de_ois high andtx_oremains 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,
de_oremains high andtx_oremains high de_ois high for every burst clock, including the whole final stop bit and the whole taildone_opulses exactly once, on the final tail clockbusy_ois still high during thedone_opulse- After the final tail clock,
de_oandbusy_ofall together, and the unit becomes idle - While idle,
tx_ois high,de_ois low, and both status outputs are low rst_ihigh at any rising edge releases the line, clears both status outputs, and aborts all burst progress- After reset,
tx_ois high,de_ois 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
payload_iduring a burst and checks that the captured payload remains in use - A bench-side decoder rebuilds all three bytes from
tx_oalone, checking framing, bit width, byte order, and gapless frames - It checks exactly four lead clocks and exactly four tail clocks, with
de_oandtx_ohigh through both - Releasing
de_oduring the final stop bit or anywhere in the tail fails - It asserts reset during lead, data, stop, and tail clocks
Constraints
TIMING: everything is synchronous to
clk_i; inputs are sampled on rising edges, and all outputs are registered.
SCOPE: this models the transceiver's
tx_oand 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.