Intel® Quartus® Prime Software
Intel® Quartus® Prime Design Software, Design Entry, Synthesis, Simulation, Verification, Timing Analysis, System Design (Platform Designer, formerly Qsys)
17249 Discussions

How to call a module from an always block?

Altera_Forum
Honored Contributor II
1,091 Views

Hey guys!  

I am trying to implement a 32-bit ALU. I have different modules for the adder, subtractor, multiplier and divider. Now the problem is based on a select line input (S) I have to decide which operation must be performed. But if I use the if/case statements I cannot call the modules from inside the always block. So is there any other way in which I can call these modules using the select line input?  

 

Thanks in advance! :)
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
374 Views

Create the operations as tasks. You can put them all in a separate file then `include that file in the file where you want to call them. You can call tasks from inside an always block.

0 Kudos
Altera_Forum
Honored Contributor II
374 Views

Each of your modules can have an enable signal. Each case needs to set one of the enables and clear the others. You can do the same for the data in/out or use mixes.

0 Kudos
Reply