Forum Discussion
Altera_Forum
Honored Contributor
10 years agoHow to call a module from an always block?
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! :)2 Replies
- Altera_Forum
Honored Contributor
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.
- Altera_Forum
Honored Contributor
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.