[SOLVED] how to halt program in verilog

Status
Not open for further replies.

moonnightingale

Full Member level 6
Joined
Sep 17, 2009
Messages
362
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,298
Activity points
3,832
I have written a code which i have implemented in Spatran 3E kit. The program glows the LEDs of kit in sequenceform when i select the DIP switch. I mean first of all, first LED glows, then first two ,then first three and so on.
What all i want is that when i select second DIP switch, what so ever numbering is going to Diaplay LED, it should Halt and when i select, it continues from there.
Just like concept of stop watch. e.g if at this instance 4 LEDs are glowing and if i selcet switch, the four LEDs keep glowing and sequence is stopped till i deselect it and then it will continue from 5 onwards.any suggestions.

---------- Post added at 20:45 ---------- Previous post was at 18:56 ----------

This is the one portion of my code in which LEDs are glowing after one second and give symbol for binary 1 2 3 .....

Now what i want is that i want to add one more option "STOP" . That whenever Slide Switch STOP is made to high, the LED numbering should stop there till the time i make "STOP" Low again.
Kindly help me

My code is not that good as i am new in this field but i have made clock in FPGA kit and now i am trying to make stop watch for which i am stuck up with STOP portion Thanks

if (select==1'b1 && go==1'b1 && sec==0)
begin
cnt=0;
cnt2=0;
cnt3=cnt3+1;

if (cnt3[40:0]==40'd5)
begin
zero=1'b1;
one=1'b0;
two=1'b0;
three=1'b0;
six=1'b0;
end
if (cnt3[40:0]==40'd50000000)
begin
zero=1'b0;
one=1'b1;
two=1'b0;
three=1'b0;
six=1'b0;
end
if (cnt3[40:0]==40'd100000000)
begin
zero=1'b1;
one=1'b1;
two=1'b0;
three=1'b0;
six=1'b0;
end
if (cnt3[40:0]==40'd150000000)
begin
zero=1'b0;
one=1'b0;
two=1'b1;
three=1'b0;
six=1'b0;
end
if (cnt3[40:0]==40'd200000000)
begin
zero=1'b1;
one=1'b0;
two=1'b1;
three=1'b0;
six=1'b0;
end
if (cnt3[40:0]==40'd250000000)
begin
zero=1'b0;
one=1'b1;
two=1'b1;
three=1'b0;
six=1'b0;
end
if (cnt3[40:0]==40'd300000000)
begin
zero=1'b1;
one=1'b1;
two=1'b1;
three=1'b0;
six=1'b0;
end
if (cnt3[40:0]==40'd350000000)
begin
zero=1'b0;
one=1'b0;
two=1'b0;
three=1'b1;
six=1'b0;
end
if (cnt3[40:0]==40'd400000000)
begin
zero=1'b1;
one=1'b0;
two=1'b0;
three=1'b1;
six=1'b0;

end
 

This code is working Fine on Spatran kit and working as per code. only stop of LEDs i am unable to understand how to implement it.

---------- Post added at 20:49 ---------- Previous post was at 19:58 ----------

ok got the solution
 
Last edited:

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…