BitFlow

Say hello over serial

A serial port sends a byte one bit at a time on tx: a 0 start bit, 8 data bits starting with bit 0, and a 1 stop bit, each lasting CLK_HZ / BAUD cycles. The line rests at 1.

The starter's uart_tx sends one byte when you pulse send and is busy until it's done. Write the part that sends Hello and a new line (\r\n) each time button 0 is pressed. On the virtual board the text appears in the serial terminal; on a real board, open the serial monitor.

lab.v
drag to turn · scroll to zoom

Loading the board…

Press Run on the board: your Verilog is turned into gates in this browser and runs here, cycle by cycle.

Goals

  • ○Pressing button 0 sends Hello
  • ○Each byte is framed right (start bit, 8 data bits, stop bit)
  • ○One message per press, and tx rests at 1
Hints
  1. Keep an index into the message, 0..6, and a flag that says you're sending.
  2. When !busy && !send, pulse send with the next character and move the index on.

Pin log

Run the design to see its outputs change.

Serial terminal (tx)

 

Put it on a real board

  • The clock is set to the board's 27 MHz, and its active-low buttons and LEDs are flipped for you.

Check on my board

Flash this lesson, then connect at 115200 baud. Your browser asks which port: on a Tang Nano, try the higher-numbered one if nothing comes back.

Waveform