summaryrefslogtreecommitdiffhomepage
path: root/digital/asserv/src/hdlcounter/counter_top.v
diff options
context:
space:
mode:
authorNicolas Schodet2007-08-01 09:55:47 +0200
committerNicolas Schodet2007-08-01 09:55:47 +0200
commita17dafb4961bc8b849a09c69d1129f75cf1e267e (patch)
tree933797b20a5bf2ebd7dda2145f079171aad00225 /digital/asserv/src/hdlcounter/counter_top.v
parentd9dbca3c5bbbecbbc12b99c9e330ec1119e281ae (diff)
Fixed switch operand sizes in quad_decoder_div4.
Added an output latch, now output will not change when oe is one.
Diffstat (limited to 'digital/asserv/src/hdlcounter/counter_top.v')
-rw-r--r--digital/asserv/src/hdlcounter/counter_top.v22
1 files changed, 16 insertions, 6 deletions
diff --git a/digital/asserv/src/hdlcounter/counter_top.v b/digital/asserv/src/hdlcounter/counter_top.v
index fa1b737c..0c313704 100644
--- a/digital/asserv/src/hdlcounter/counter_top.v
+++ b/digital/asserv/src/hdlcounter/counter_top.v
@@ -48,11 +48,21 @@ module counter_top(clk, rst, q0, q1, q2, q3, oe, sel, count);
input_latch f3[1:0] (clk, rst, q3, qf3);
quad_decoder_full qd3 (clk, rst, qf3, count3);
- assign count =
- !oe ? 8'bz :
- sel == 0 ? count0 :
- sel == 1 ? count1 :
- sel == 2 ? count2 :
- count3;
+ reg [size-1:0] lcount;
+
+ always @(posedge clk or negedge rst) begin
+ if (!rst)
+ lcount <= 0;
+ else begin
+ if (!oe) begin
+ lcount <= sel == 0 ? count0 :
+ sel == 1 ? count1 :
+ sel == 2 ? count2 :
+ count3;
+ end
+ end
+ end
+
+ assign count = !oe ? 8'bz : lcount;
endmodule