80 likes | 181 Views
The DPIM Testbench. Debug and Verification Made Easy!. Features. Instantiates top ( top.v ) and leaves 7-seg signals unconnected Defines a clock signal Initializes input signals and generates a reset Performs register write and read operations using write_reg () and read_reg ()
E N D
The DPIM Testbench Debug and Verification Made Easy!
Features • Instantiates top (top.v) and leaves 7-seg signals unconnected • Defines a clock signal • Initializes input signals and generates a reset • Performs register write and read operations using write_reg() and read_reg() • Requires dpim_pkg.vhd for register operations • Does not support file I/O
Write_reg() write_reg(1, X"0B", clk, astb, dstb, wr, db, pwait); • First argument is a decimal integer identifying which data register • Second argument is the data to be written in hexadecimal format • Other arguments are simply to make the handshake signals available to the write_reg() function
Read_reg() read_reg(1, clk, astb, dstb, wr, db, pwait); • First argument identifies the data register • The retrieved data is driven on to the data bus until dstb goes high
Gotchas! • Clock period is set at 200 ns • Only waits 20 clock cycles before reading. Does not check for “ready” • Response time to pwait is very short. That is, it doesn’t model the USB delay. • The testbench writes the address register on every byte transfer. That might not be true when using Adept for file I/O.
Operations -- Write six bytes write_reg(1, X"0B", clk, astb, dstb, wr, db, pwait); write_reg(1, X"03", clk, astb, dstb, wr, db, pwait); write_reg(1, X"11", clk, astb, dstb, wr, db, pwait); write_reg(1, X"05", clk, astb, dstb, wr, db, pwait); write_reg(1, X"14", clk, astb, dstb, wr, db, pwait); write_reg(1, X"08", clk, astb, dstb, wr, db, pwait); -- Tell FPGA to process write_reg(0, X"01", clk, astb, dstb, wr, db, pwait); -- Should wait for ready light (ld7) wait for 20*cc; -- Read three results read_reg(1, clk, astb, dstb, wr, db, pwait); read_reg(1, clk, astb, dstb, wr, db, pwait); read_reg(1, clk, astb, dstb, wr, db, pwait);
How to use • By default, Isim may run 1 us then stop. (You can change this under “properties”) • Restart the simulation (Blue back arrow) and add internal signals by highlighting “Inst_top” under “Tb” in “Instance and Process Window” • Then type “run all” to run through the entire testbench • Enjoy!
reg [(5*8):1] d_state; // Creates a bus that can hold five ASCII characters if (rst) d_state <= "pIDLE"; else case (d_state) […]