Forum Discussion
Altera_Forum
Honored Contributor
16 years agoProblem with a simple bi-direcional counter simulation
Hello this is my code module count_moda
# (parameter modulus = 100)
(
input clk, aclr_n, updown,
output reg q
);
initial q = 0;
always @(posedge clk, negedge aclr_n)
begin
...
Altera_Forum
Honored Contributor
16 years ago> if (q == modulus-1) > q <= 8'd0;
this script should be if( updoun ) begin if( q == (modulus-1) ) q <= 8'h0; end else begin if( q == 8'h0 ) q <= (modulus-1) ; end I think this is obvious too. you haven't written reset logic for negative direction.