- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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! :)Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page