Line 39... |
Line 39... |
//
|
//
|
//
|
//
|
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
//
|
//
|
//
|
//
|
// Uncomment the next line if you want this program to work as a standalone
|
// One issue with the design is how to set the values of the setup register.
|
// (not verilated) RTL "program" to test your UART. You'll also need to set
|
// (*This is a comment, not a verilator attribute ... ) Verilator needs to
|
// your setup condition properly, though. I recommend setting it to the
|
// know/set those values in order to work. However, this design can also be
|
// ratio of your onboard clock to your desired baud rate. For more information
|
// used as a stand-alone top level configuration file. In this latter case,
|
// about how to set this, please see the specification.
|
// the setup register needs to be set internal to the file. Here, we use
|
|
// OPT_STANDALONE to distinguish between the two. If set, the file runs under
|
|
// (* Another comment still ...) Verilator and we need to get i_setup from the
|
|
// external environment. If not, it must be set internally.
|
//
|
//
|
// `define OPT_STANDALONE
|
`ifndef VERILATOR
|
|
`define OPT_STANDALONE
|
|
`endif
|
//
|
//
|
module linetest(i_clk,
|
module linetest(i_clk,
|
`ifndef OPT_STANDALONE
|
`ifndef OPT_STANDALONE
|
i_setup,
|
i_setup,
|
`endif
|
`endif
|
Line 64... |
Line 69... |
// If i_setup isnt set up as an input parameter, it needs to be set.
|
// If i_setup isnt set up as an input parameter, it needs to be set.
|
// We do so here, to a setting appropriate to create a 115200 Baud
|
// We do so here, to a setting appropriate to create a 115200 Baud
|
// comms system from a 100MHz clock. This also sets us to an 8-bit
|
// comms system from a 100MHz clock. This also sets us to an 8-bit
|
// data word, 1-stop bit, and no parity.
|
// data word, 1-stop bit, and no parity.
|
`ifdef OPT_STANDALONE
|
`ifdef OPT_STANDALONE
|
wire [29:0] i_setup;
|
wire [30:0] i_setup;
|
assign i_setup = 31'd868; // 115200 Baud, if clk @ 100MHz
|
assign i_setup = 31'd868; // 115200 Baud, if clk @ 100MHz
|
`endif
|
`endif
|
|
|
reg [7:0] buffer [0:255];
|
reg [7:0] buffer [0:255];
|
reg [7:0] head, tail;
|
reg [7:0] head, tail;
|