oh no !
i try many times and i just waste my time
please barry can you help me?
what you thik about this code
module cnt_bcddir ( dout4, dir, clk, arst, srst, en );
output [3:0] dout4;
input dir;
input clk, arst, srst, en;
// declaration of signals inside this block
reg [3:0] reg_cnt;
reg [3:0] nxt_cnt;
always @ ( posedge arst or posedge clk ) // dff_cnt
begin
if ((arst == 1'b1)) reg_cnt <= 1'h0;
else
if ((srst == 1'b1)) reg_cnt <= 1'h0;
else
if ((en == 1'b1)) reg_cnt <= nxt_cnt;
end
// end dff_cnt
always @ ( reg_cnt or dir ) // cmb_cnt
begin
if ((dir == 1'b0))
if ((reg_cnt == 9)) nxt_cnt <= 1'h0;
else nxt_cnt <= (reg_cnt + 1);
else
if ((reg_cnt == 0)) nxt_cnt <= 4'b1001;
else nxt_cnt <= (reg_cnt - 1);
end
// end cmb_cnt
// outputs --
assign {dout4}=reg_cnt;
//--
endmodule
:-(
- - - Updated - - -
:-(