sanyi1987
Newbie level 1
Hi, I'd like to create a circuit that can ouput a pulse signal of determined high level period.
I created the following code and synthesized it, but after programming my spartan 3E board with it, I got no sognal at the desired output.
Can anyone tell me what I'm missing?...thanks.
module test_sig_gen(sigout, clk, enable, reset);
input enable, reset, clk;
output sigout;
reg [31:0] out;
parameter n = 500000;
reg cmp;
reg [31:0] y;
initial begin
cmp = 0;
y = 32'b0;
out = 32'b0;
end
always @ (posedge clk)
if (reset) begin
out <= 32'b0;
end
else if (enable) begin
out <= out + 1;
end
always @ (posedge clk)
if (out == n) begin
y <= y+1;
end
else if (out != n) begin
y <= y;
end
always @ (posedge clk)
if (y == 0) begin
cmp <= 1;
end
else if (y != 0) begin
cmp <= 0;
end
assign sigout = cmp;
endmodule
After assigning the "enable" input to a switch, the "reset" input to a pushbutton, the "clk" input to the clk input described in the spartan 3e IO sheet and the "sigout" output to some random ouput port, and programming the FPGA with the code, I checked the output with an oscilloscope for the desired signal...nothing appeared. Please share your thoughts. Thank you.
P.S. Verilog is new teritory for me and I don't have a lot of esperience with it, so please give specific advice
I created the following code and synthesized it, but after programming my spartan 3E board with it, I got no sognal at the desired output.
Can anyone tell me what I'm missing?...thanks.
module test_sig_gen(sigout, clk, enable, reset);
input enable, reset, clk;
output sigout;
reg [31:0] out;
parameter n = 500000;
reg cmp;
reg [31:0] y;
initial begin
cmp = 0;
y = 32'b0;
out = 32'b0;
end
always @ (posedge clk)
if (reset) begin
out <= 32'b0;
end
else if (enable) begin
out <= out + 1;
end
always @ (posedge clk)
if (out == n) begin
y <= y+1;
end
else if (out != n) begin
y <= y;
end
always @ (posedge clk)
if (y == 0) begin
cmp <= 1;
end
else if (y != 0) begin
cmp <= 0;
end
assign sigout = cmp;
endmodule
After assigning the "enable" input to a switch, the "reset" input to a pushbutton, the "clk" input to the clk input described in the spartan 3e IO sheet and the "sigout" output to some random ouput port, and programming the FPGA with the code, I checked the output with an oscilloscope for the desired signal...nothing appeared. Please share your thoughts. Thank you.
P.S. Verilog is new teritory for me and I don't have a lot of esperience with it, so please give specific advice