Skip to content

Commit

Permalink
hacking on gate-level tests, trying to find an X
Browse files Browse the repository at this point in the history
  • Loading branch information
stevej committed Oct 31, 2024
1 parent 328ae80 commit 2fd575f
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 16 deletions.
5 changes: 5 additions & 0 deletions gate_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
cd test
pip install -r requirements.txt
TOP_MODULE=$(cd .. && ./tt/tt_tool.py --print-top-module)
cp ../runs/wokwi/final/pnl/$TOP_MODULE.pnl.v gate_level_netlist.v
make -B GATES=yes
4 changes: 3 additions & 1 deletion src/byte_transmitter.v
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,13 @@ module byte_transmitter (
assert (f_total_written == 32); // We've drained the entire buffer.
assert (byte_count == 0);
assert (r_out != 1'bX);
assert (done != 1'bX);
end

if (f_past_valid && enable && byte_count == 0) begin
assert (done);
assert (f_total_written == 32);
assert (done);
assert (r_out != 1'bX);
end
end

Expand Down
15 changes: 8 additions & 7 deletions src/jtag.v
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@
end;

module jtag (
input tck,
input wire tck,
/* verilator lint_off UNUSED */
input wire tdi,
input wire tdi,
output wire tdo,
input wire tms,
input wire trst_n,
input wire reset // comes from main domain clock.
input wire tms,
input wire trst_n
);

wire trst;
Expand Down Expand Up @@ -70,13 +69,14 @@ module jtag (
reg byte_transmitter_enable;
reg reset_byte_transmitter;
wire transmitter_channel; // for byte_transmitter to write to TDO
reg r_transmitter_channel;

byte_transmitter id_byte_transmitter (
.clk(tck),
.reset(trst | reset_byte_transmitter), // TODO: We need to be able to reset the byte_counter?
.enable(byte_transmitter_enable),
.in(IdCodeDrRegister),
.out(transmitter_channel), // make this another wire.
.out(r_transmitter_channel), // make this another wire.
.done(idcode_out_done)
);

Expand Down Expand Up @@ -110,6 +110,7 @@ module jtag (
current_ir_instruction <= 4'b1110; // IDCODE is the default instruction.
r_output_selector_transmitter <= 1; // by default the tap controller writes
tap_channel <= 0; // How can an X sneak in here?
r_transmitter_channel <= 0;
byte_transmitter_enable <= 0;
reset_byte_transmitter <= 0;
end else begin
Expand Down Expand Up @@ -282,7 +283,7 @@ module jtag (

if (f_past_valid && $past(trst_n)) begin
assume (trst);
assert (current_state != 1'bX);
assert (current_state != 5'bX_XXXX);
assert (r_output_selector_transmitter != 1'bX);
assert (tdo != 1'bX);
end
Expand Down
8 changes: 4 additions & 4 deletions src/mux_2_1.v
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
`default_nettype none

module mux_2_1 (
input one,
input two,
input selector,
output out
input wire one,
input wire two,
input wire selector,
output wire out
);

assign out = (selector) ? one : two;
Expand Down
3 changes: 1 addition & 2 deletions src/project.v
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ module tt_um_jtag_example_stevej (
.tdi(ui_in[1]),
.tms(ui_in[2]),
.trst_n(ui_in[3]),
.tdo(tdo),
.reset(reset)
.tdo(tdo)
);

// A hard configured interrupt rising high every 10 cycles for 1 cycle.
Expand Down
4 changes: 2 additions & 2 deletions test/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ async def test_tms_five_high_for_reset(dut):
dut.rst_n.value = 0
await ClockCycles(dut.clk, 1)
dut.rst_n.value = 1
dut.ui_in.value = 0b0000_1000
await ClockCycles(dut.clk, 1)
#dut.ui_in.value = 0b0000_1000
#await ClockCycles(dut.clk, 1)

# Drive TRST low and TCK high then low to reset tap controller
dut._log.info("Reset the jtag tap controller")
Expand Down

0 comments on commit 2fd575f

Please sign in to comment.