efevi
Newbie level 5
- Joined
- Jan 10, 2013
- Messages
- 9
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,434
I have a verilog project on command line interface(i.e. we have a xilinx card and with the verilog code we write, we will input function name press enter input parameters press enter and the program will excecute combinational logic and set the output in 7 segments)
There will be error conditions when inputted function name or parameters are not defined or valid. Therefore in each enter the system has to check validity of inputs and send an error message to the 7segments and restart the system(i.e reset all sequential logic components)
I have already created all of combinational logic modules, and registers. In addition to this i wrote a controlling behavioral module for checking validiy of inputs, counting enters, creating a select output to be used in multiplexers to choose the combinational logic block in according with the entered function name, resetting when procedure is finished etc. I wrote all controlling behavioral module in an always block and i use if else statements and wait(enter) statement for executing the remaining code when enter is entered.(Enter will be used when all letters of a function name or parameter is inputted to the temporary register, and enter button will pass serially the information in temporary register to permanent registers)
In addition to the project definition i plan to reserve a "restart" key for resetting all registers and sequential logic, resetting counters(a counter for enter).Therefore when restart key is pressed the counter for enter will be resetted and a reset signal will be send to all sequential blocks. And i wrote another always block in the same module for defining this behaviour.
The problem is that, the always block for controlling behaviour(that i described above), is not restarting its procedure when restart is pressed. actually when restart is pressed it resets the value of enter count to 0 (actually other always block does this) and always block for controlling the general behaviour continous from where it was when restart is depressed and another enter is pressed.
No matter what i did(while statements, disable etc.), it eventually comes to the point that there is no way an always statement is to be restarted, before it finishes the code. Is it so?
And what can be done for this purpose?
Note: The code was too long to be put here, so i tried to explain instead.
If i write like a code
always@(*)//general controlling block
begin
wait(enter==1); // first input is entered
wait(enter==0) entercount=1
<check input>
if(nonvalid)
<finish block and send error message>
if(valid)//continue with next inputs
wait(enter==1)
wait(enter==0) entercount=2
<check input>
if(valid)
// and the code continuous like this
end
always(*)//block for checking restart
begin
wait(restart==1)
begin
reset=0; // reset=0 resets all registers.
entercount=0; // reset the enter count
<other variables to be resetted to initial values>
end
end
There will be error conditions when inputted function name or parameters are not defined or valid. Therefore in each enter the system has to check validity of inputs and send an error message to the 7segments and restart the system(i.e reset all sequential logic components)
I have already created all of combinational logic modules, and registers. In addition to this i wrote a controlling behavioral module for checking validiy of inputs, counting enters, creating a select output to be used in multiplexers to choose the combinational logic block in according with the entered function name, resetting when procedure is finished etc. I wrote all controlling behavioral module in an always block and i use if else statements and wait(enter) statement for executing the remaining code when enter is entered.(Enter will be used when all letters of a function name or parameter is inputted to the temporary register, and enter button will pass serially the information in temporary register to permanent registers)
In addition to the project definition i plan to reserve a "restart" key for resetting all registers and sequential logic, resetting counters(a counter for enter).Therefore when restart key is pressed the counter for enter will be resetted and a reset signal will be send to all sequential blocks. And i wrote another always block in the same module for defining this behaviour.
The problem is that, the always block for controlling behaviour(that i described above), is not restarting its procedure when restart is pressed. actually when restart is pressed it resets the value of enter count to 0 (actually other always block does this) and always block for controlling the general behaviour continous from where it was when restart is depressed and another enter is pressed.
No matter what i did(while statements, disable etc.), it eventually comes to the point that there is no way an always statement is to be restarted, before it finishes the code. Is it so?
And what can be done for this purpose?
Note: The code was too long to be put here, so i tried to explain instead.
If i write like a code
always@(*)//general controlling block
begin
wait(enter==1); // first input is entered
wait(enter==0) entercount=1
<check input>
if(nonvalid)
<finish block and send error message>
if(valid)//continue with next inputs
wait(enter==1)
wait(enter==0) entercount=2
<check input>
if(valid)
// and the code continuous like this
end
always(*)//block for checking restart
begin
wait(restart==1)
begin
reset=0; // reset=0 resets all registers.
entercount=0; // reset the enter count
<other variables to be resetted to initial values>
end
end