Forum Discussion
Altera_Forum
Honored Contributor
17 years ago --- Quote Start --- Hello, I am trying to put together a simple one shot counter that gets trigered once every time an input signal (Gate) the counter just counts to some preloaded value and then just stops counting till the next time Because I am a Verilog neophite I seem to struggle with the following error: Error (10028): Can't resolve multiple constant drivers for net "temp" at PulseWidthCounter.v(25) Any help or sugestions will greatly appreciated!!! The code is as follows: ****************************************************************** module PulseWidthCounter(clk,CountVal,counterenable,Gate,PulseOut); parameter SIZE = 20; input clk; input Gate; input counterenable; input CountVal; output PulseOut = 0; reg CounterVal; reg clk1; reg PulseOut; reg temp = 0; always @ (posedge counterenable)begin CounterVal <= CountVal; end always @ (posedge Gate)begin temp <= 1'b1; end always @ (posedge clk) begin if(temp == 1'b1)begin clk1 <= clk1 +1; if (clk1 < CounterVal) PulseOut <= 1'b1; else PulseOut <= 1'b0; clk1 <=0; temp <= 0; end end endmodule --- Quote End --- Hi, you got this error, because you are driving "temp" in two processes. Would you like to achieve a counter, which starts counting at a rising of the signal "gate", then counts up to a certain value and then stops ( setting the counter to "0")?