johnnie57
Newbie level 2
Hello,
I'm targetting Cyclone IVE using the Quartus II synthesis tool. I have the following problem:
I have a section of code which is going to be repeated dozens of times in my code. It is effectively a state machine which executes a number of statements sequentially on the posedge of a clock. My first thought was to put the code in a task and instantiate it multiple times in the code. However, my understanding is that this is not possible because the code uses a clock and you can only pas values at one moment in time to a task, not a changing clock signal.
My second thought was to place the code in a seperate module and use a generate conditional statement to instantiate it. The problem with this approach is that the chip selects that determine which values are to be sent to the module are not available at elaboration time: they will be sent by the host processor during run time. My understanding is that the generate statement works at elaboration time only.
My third thought was to use if statements within an "always @ posedge (clock)" construct to monitor the chipselects and then pass the appropriate values to the module in an instantiation call. I've read however that it is not permissable to call a module from within an always statement.
Are my assumptions above correct? Does anyone know any other way of doing this?
best regards,
John
I'm targetting Cyclone IVE using the Quartus II synthesis tool. I have the following problem:
I have a section of code which is going to be repeated dozens of times in my code. It is effectively a state machine which executes a number of statements sequentially on the posedge of a clock. My first thought was to put the code in a task and instantiate it multiple times in the code. However, my understanding is that this is not possible because the code uses a clock and you can only pas values at one moment in time to a task, not a changing clock signal.
My second thought was to place the code in a seperate module and use a generate conditional statement to instantiate it. The problem with this approach is that the chip selects that determine which values are to be sent to the module are not available at elaboration time: they will be sent by the host processor during run time. My understanding is that the generate statement works at elaboration time only.
My third thought was to use if statements within an "always @ posedge (clock)" construct to monitor the chipselects and then pass the appropriate values to the module in an instantiation call. I've read however that it is not permissable to call a module from within an always statement.
Are my assumptions above correct? Does anyone know any other way of doing this?
best regards,
John