Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

ALU design in VERILOG

Status
Not open for further replies.
You don't instantiate the modules in the case statement, can't be done the language doesn't allow this. So get that out of your head. You're obviously thinking like a software programmer, where you can call some function in a case statement.


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
// instantiated add module
ADD ADD_inst (
  .A         (a_data),
  .B         (b_data),
  .A_PLUS_B  (output_bus_of_your_add_module)
);
 
// case statement is wrapped in some always block, (not shown)
case (alu_sel)
  `ALU_ADD : alu_result <= output_bus_of_your_add_module;
  `ALU_SUB : alu_result <= output_bus_of_your_sub_module;
  `ALU_SHL : alu_result <= output_bus_of_your_shift_left_module;
  //etc....
endcase

 

My previous post HAS an example of using a multiplexer to select the ALU fucntion. If you want to learn something it requires effort on your part.

I give up.

okay one last try...

Read a Verilog tutorial...
https://www.asic-world.com/verilog/veritut.html

and learn something...wasn't that your plan for going to school in the first place?
 
Last edited:

Hi salil

There are three types of modelling in verilog- gate level, dataflow and behavioral.
I think you should use dataflow modelling, if you want to use module instantiation and then connect all instance acc to ur diagram.
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top