Click here to Skip to main content
15,885,914 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
module up_counter    (
output reg [7:0] out     ,  // Output of the counter
input  wire      enable  ,  // enable for counter
input  wire      clk     ,  // clock Input
input  wire      reset      // reset Input
);
//-------------Code Starts Here-------
always_ff @(posedge clk)
if (reset) begin
  out <= 8'b0 ;
end else if (enable) begin
  out ++;
end

endmodule

thats the code.

What I have tried:

the first time i ran it in modelsim it worked fine. being new to this software,i am unable to figure out whats the problem.to implement,i first, clocked the clk signal and then forced the enable to 1 and reset to zero.moreover, i also set the output at zero.but after running the code,it remains at zero only.
please help.
Posted
Updated 24-Sep-17 22:04pm
v2
Comments
Richard MacCutchan 25-Sep-17 4:06am    
I have no idea what that is supposed to do, but there would appear to be some logic missing. Where do the values of reset and enable get set or cleared?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900