W
weizbox
Guest
I am moving onto Verilog now from VHDL due to it being too complicated
for me to start off with and not having any calsses available to go to
in order to teach me it. So far Ive been just trying to make a simple
counter that would pulse an led every second, and so far no luck. Im
getting errors left and right, when I change one thing, I get another
error, and when I fix that I seem to get others. I have no idea what
Im doing wrong, everyhting looks like it would run fine from what Ive
read. So if you can let me know what my errors are. Thank you!
CODE:
module pulse(led_o, clk50);
input clk50;
output led_o;
reg [31:0] c;
always @(posedge clk50) //Trigger on 50MHz clock
begin
if (c == 50000000) //Convert 50MHz Clock to 1Hz
<= 0;
led_o <= 1; //Turn led on
wait (50ms) //wait 50ms
led_o <= 0; //turn led off
else
c <= c + 1; //Step up c +1
end
endmodule
ERRORS:
ERROR:HDLCompilers:26 - clock.v line 12 unexpected token: '50'
ERROR:HDLCompilers:26 - clock.v line 15 expecting 'end', found 'else'
ERROR:HDLCompilers:26 - clock.v line 16 unexpected token: '<='
ERROR:HDLCompilers:26 - clock.v line 16 unexpected token: '+'
ERROR:HDLCompilers:26 - clock.v line 16 expecting 'endmodule', found
'1'
ERROR: XST failed
Ive been useing this as a reference:
http://www.sutherland-hdl.com/on-line_ref_guide/vlog_ref_top.html
I suppose it isnt very good considering how far it has gotten me. If
anyone else knows of a good online resource just to look up little
things like wait, if, begin type stuff with proper sytax let me know!
All I really want to make is a simple counter to pulse an led every
second for the time being, thats it. So if thats easy enough to post,
please go for it!
Thanks!
-Weizbox
for me to start off with and not having any calsses available to go to
in order to teach me it. So far Ive been just trying to make a simple
counter that would pulse an led every second, and so far no luck. Im
getting errors left and right, when I change one thing, I get another
error, and when I fix that I seem to get others. I have no idea what
Im doing wrong, everyhting looks like it would run fine from what Ive
read. So if you can let me know what my errors are. Thank you!
CODE:
module pulse(led_o, clk50);
input clk50;
output led_o;
reg [31:0] c;
always @(posedge clk50) //Trigger on 50MHz clock
begin
if (c == 50000000) //Convert 50MHz Clock to 1Hz
<= 0;
led_o <= 1; //Turn led on
wait (50ms) //wait 50ms
led_o <= 0; //turn led off
else
c <= c + 1; //Step up c +1
end
endmodule
ERRORS:
ERROR:HDLCompilers:26 - clock.v line 12 unexpected token: '50'
ERROR:HDLCompilers:26 - clock.v line 15 expecting 'end', found 'else'
ERROR:HDLCompilers:26 - clock.v line 16 unexpected token: '<='
ERROR:HDLCompilers:26 - clock.v line 16 unexpected token: '+'
ERROR:HDLCompilers:26 - clock.v line 16 expecting 'endmodule', found
'1'
ERROR: XST failed
Ive been useing this as a reference:
http://www.sutherland-hdl.com/on-line_ref_guide/vlog_ref_top.html
I suppose it isnt very good considering how far it has gotten me. If
anyone else knows of a good online resource just to look up little
things like wait, if, begin type stuff with proper sytax let me know!
All I really want to make is a simple counter to pulse an led every
second for the time being, thats it. So if thats easy enough to post,
please go for it!
Thanks!
-Weizbox