Mihai Patrascioiu
Newbie level 1
- Joined
- May 13, 2014
- Messages
- 1
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1
- Activity points
- 11
Hello i've got a mini project to make and i don't have a lot of knowledge in Verilog programming. I want some help, please!
The task is : Describe in Verilog a RALU circuit that has 8 functions for operands on 4 bits.
Here is some of what i've found but it's not operational
The task is : Describe in Verilog a RALU circuit that has 8 functions for operands on 4 bits.
Here is some of what i've found but it's not operational
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 module ralu( input [3:0] in, input [3:0] func, input clock, input load, output [3:0] out ); reg [3:0] op1; reg[3:0] op2; always@(posedge clock) if(load) op2<=in; else op1<=in; endmodule module alu( input [3:0] op1, input [3:0] op2, input [3:0] func, output reg [3:0] out ); always@(*) case(func) 3'b000: out=op1|op2; 3'b001: out=op1&op2; 3'b010: out=!op1&!op2; 3'b011: out=!op1|!op2; 3'b100: out=op1^op2; 3'b101: out=!op1^!op2; 3'b110: out=op1+op2; 3'b111: out=op1-op2; endcase endmodule
Last edited by a moderator: