Forum Discussion
Altera_Forum
Honored Contributor
15 years agoThe problem is exactly what have been told you by previous poster.
You're saying in code 2 different thing in different "process". You're saying 2 different thing and compiler of course do not know what you want: 1) when reset then out speed = fixed value, else set it at initial speed. always @(reset or initial_speed) begin if (reset == 1'b0) out_speed = 16'b0000000000000000; else sig_speed = initial_speed; <- THAT'S FIRST ASSIGNMENT end 2) In the following code you're saying a different thing always @ (clk or reset) begin if (reset == 1'b0) begin out_speed = 16'b0000000000000000; end else begin if (sig_speed == ref_speed) begin out_speed <= sig_speed; //out_speed <= initial_speed end else if (sig_speed < ref_speed) begin out_speed <= sig_speed; //sig_speed = 16'b0000000000000000; end else sig_speed <= sig_speed - 1; <- THAT'S THE SECOND ASSIGNMENT end end ---- If you think of what you're implement, code in part 1 is a ASYNCRONOUS MULTIPLEXER in which the reset signal is the selector. THe 2 input of this mux are : 1- Fixed value = 16'b0000000000000000; 2- the signal initial_speed There is no space for the counter you're instanciating in the second part of your code. I suppose that what you want to write is different and maybe is only the second part of your code or maybe it's initial_speed that you want to be decremented..