From 1e65032099dea1cec8b24210c75b3f8c687b3bd3 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Wed, 15 Apr 2009 19:51:35 +0200 Subject: * digital/asserv/src/hdlcounter: - changed counter divisions. --- digital/asserv/src/hdlcounter/counter_top.v | 25 ++++++++++++----------- digital/asserv/src/hdlcounter/counter_top.xsvf | Bin 52029 -> 52029 bytes digital/asserv/src/hdlcounter/test_counter_top.v | 2 +- 3 files changed, 14 insertions(+), 13 deletions(-) (limited to 'digital/asserv/src') diff --git a/digital/asserv/src/hdlcounter/counter_top.v b/digital/asserv/src/hdlcounter/counter_top.v index d16800ad..2ab00031 100644 --- a/digital/asserv/src/hdlcounter/counter_top.v +++ b/digital/asserv/src/hdlcounter/counter_top.v @@ -26,7 +26,8 @@ module counter_top(clk, rst, q0, q1, q2, q3, ale, rd, wr, ad, i0, i1, ioa, ioc); - parameter size = 8; + parameter size = 9; + parameter lsize = 8; input clk; input rst; input [1:0] q0, q1, q2, q3; @@ -36,33 +37,33 @@ module counter_top(clk, rst, q0, q1, q2, q3, ale, rd, wr, ad, i0, i1, ioa, input [3:0] ioa, ioc; wire [1:0] qf0, qf1, qf2, qf3; - wire [size:0] count0, count1; - wire [size-1:0] count2, count3; + wire [size-1:0] count0, count1, count2, count3; // Decode encoders outputs. noise_filter f0[1:0] (clk, rst, q0, qf0); - quad_decoder_div4 #(9) qd0 (clk, rst, qf0, count0); + quad_decoder_div4 #(size) qd0 (clk, rst, qf0, count0); noise_filter f1[1:0] (clk, rst, q1, qf1); - quad_decoder_div4 #(9) qd1 (clk, rst, qf1, count1); + quad_decoder_div4 #(size) qd1 (clk, rst, qf1, count1); input_latch f2[1:0] (clk, rst, q2, qf2); - quad_decoder_div4 qd2 (clk, rst, qf2, count2); + quad_decoder_div4 #(size) qd2 (clk, rst, qf2, count2); input_latch f3[1:0] (clk, rst, q3, qf3); - quad_decoder_full qd3 (clk, rst, qf3, count3); + quad_decoder_div4 #(size) qd3 (clk, rst, qf3, count3); - reg [size-1:0] lcount; + reg [lsize-1:0] lcount; // Latch a counter when its address is given. always @(negedge ale or negedge rst) begin if (!rst) lcount <= 0; else begin - lcount <= ad[1:0] == 0 ? count0[8:1] : - ad[1:0] == 1 ? count1[8:1] : - ad[1:0] == 2 ? count2 : - count3; + lcount <= + ad[1:0] == 0 ? count0[lsize:1] : + ad[1:0] == 1 ? count1[lsize:1] : + ad[1:0] == 2 ? count2[lsize:1] : + count3[lsize:1]; end end diff --git a/digital/asserv/src/hdlcounter/counter_top.xsvf b/digital/asserv/src/hdlcounter/counter_top.xsvf index aceff25c..1d0684cf 100644 Binary files a/digital/asserv/src/hdlcounter/counter_top.xsvf and b/digital/asserv/src/hdlcounter/counter_top.xsvf differ diff --git a/digital/asserv/src/hdlcounter/test_counter_top.v b/digital/asserv/src/hdlcounter/test_counter_top.v index bbcc48be..3d9e39a7 100644 --- a/digital/asserv/src/hdlcounter/test_counter_top.v +++ b/digital/asserv/src/hdlcounter/test_counter_top.v @@ -43,7 +43,7 @@ module test_counter_top(); always #5 clk <= !clk; // Counter top setup. - wire [0:nc-1] quad_full = 4'b0001; + wire [0:nc-1] quad_full = 4'b0000; reg [31:0] filter_size[0:nc-1]; parameter max_filter = 7; initial begin -- cgit v1.2.3