data/full_repos/permissive/197224897/Controller/timer.v
[Errno 2] No such file or directory: 'preprocess.output'
data/verilator_xmls/99b9c9d2-c8ea-4b29-b187-d4b23e65715c.xml
module timer(clk, dividerClk, globalReset, beginTimer, timeValue, expiredSig);
    input clk, dividerClk, globalReset, beginTimer;
	 input [3:0]timeValue;
	 output reg expiredSig = 1;
	 
	 reg [3:0] counter = 0;
	 reg dividerClkReg   ;
	 
	 always @ (posedge clk )
		begin
			dividerClkReg <= dividerClk;
			if (globalReset == 1)
				begin
					expiredSig <= 1;
					counter 	  <= 0; 
				end
			else if (beginTimer == 1 )begin 

			expiredSig <= 0;
			if (dividerClk ==1 && dividerClk == ~dividerClkReg)

			begin
					if (counter == timeValue-1)
						begin
							counter    <= 0;
							expiredSig <= 1;
						end
					else 
						counter <= counter + 1;
					end
					end
		end
endmodule
module timer(clk, dividerClk, globalReset, beginTimer, timeValue, expiredSig);

    input clk, dividerClk, globalReset, beginTimer;
	 input [3:0]timeValue;
	 output reg expiredSig = 1;
	 
	 reg [3:0] counter = 0;
	 reg dividerClkReg   ;
	 
	 always @ (posedge clk )
		begin
			dividerClkReg <= dividerClk;
			if (globalReset == 1)
				begin
					expiredSig <= 1;
					counter 	  <= 0; 
				end
			else if (beginTimer == 1 )begin 

			expiredSig <= 0;
			if (dividerClk ==1 && dividerClk == ~dividerClkReg)

			begin
					if (counter == timeValue-1)
						begin
							counter    <= 0;
							expiredSig <= 1;
						end
					else 
						counter <= counter + 1;
					end
					end
		end
endmodule