From 92f059ab54c46153be4fb1a18cab00871fc30559 Mon Sep 17 00:00:00 2001 From: Nam Tran Date: Mon, 26 Oct 2020 22:45:17 -0500 Subject: [PATCH] use only top bits of the data to display --- tdc/rtl/top.v | 9 ++++++--- tdc/sim/top.cc | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tdc/rtl/top.v b/tdc/rtl/top.v index cdf1a36..17aedb3 100644 --- a/tdc/rtl/top.v +++ b/tdc/rtl/top.v @@ -14,9 +14,12 @@ module top #(parameter WIDTH=24)( wire clk_100MHz; reg buf_led = 0; wire buf_ready; - wire [5:0] buf_data; + /* verilator lint_off UNUSED */ + parameter TDC_COUNTER_WIDTH = 28; + wire [TDC_COUNTER_WIDTH-1:0] buf_data; assign o_readyN = ~buf_ready; - assign o_dataN = ~buf_data; + assign o_dataN = ~buf_data[TDC_COUNTER_WIDTH-1:TDC_COUNTER_WIDTH-6]; + /* verilator lint_on UNUSED */ /* verilator lint_off PINMISSING */ clk_gen #(.DIVISION(26)) clk_gen0 ( @@ -25,7 +28,7 @@ module top #(parameter WIDTH=24)( .i_clk (i_clk)); /* verilator lint_on PINMISSING */ - tdc #(.COUNTER_WIDTH(6)) tdc0 ( + tdc #(.COUNTER_WIDTH(TDC_COUNTER_WIDTH)) tdc0 ( // Outputs .o_ready (buf_ready), .o_data (buf_data), diff --git a/tdc/sim/top.cc b/tdc/sim/top.cc index 3f87e3a..fca78c0 100644 --- a/tdc/sim/top.cc +++ b/tdc/sim/top.cc @@ -46,9 +46,12 @@ int main(int argc, char **argv) { for (int k = 0; k < 3; k++) tick(++tickcount, tb, tfp); - tb->i_startN = 0; - tick(++tickcount, tb, tfp); - tb->i_startN = 1; + for (int i = 0; i < 1000; i++) { + tb->i_startN = 0; + tick(++tickcount, tb, tfp); + tb->i_startN = 1; + tick(++tickcount, tb, tfp); + } for (int k = 0; k < 15; k++) tick(++tickcount, tb, tfp);