OpenCores
URL https://opencores.org/ocsvn/instruction_list_pipelined_processor_with_peripherals/instruction_list_pipelined_processor_with_peripherals/trunk

Subversion Repositories instruction_list_pipelined_processor_with_peripherals

[/] [instruction_list_pipelined_processor_with_peripherals/] [trunk/] [hdl/] [alu.v] - Diff between revs 8 and 9

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 8 Rev 9
Line 10... Line 10...
                wire [8:0] operand2 = {1'b0, op2};
                wire [8:0] operand2 = {1'b0, op2};
 
 
                wire [8:0] addRes = operand1 + operand2;
                wire [8:0] addRes = operand1 + operand2;
                wire [8:0] subRes = operand1 - operand2;
                wire [8:0] subRes = operand1 - operand2;
 
 
                reg [8:0] aluOutput;
                reg [8:0] aluOut = 0;
                reg carryOutput;
                reg carryOut = 0;
 
 
                always @ (aluEn or addRes or subRes or op1 or op2 or aluOpcode)
                always @ (aluEn or addRes or subRes or op1 or op2 or aluOpcode)
                begin
                begin
 
 
 
 
Line 23... Line 23...
                begin
                begin
 
 
                                case (aluOpcode)
                                case (aluOpcode)
 
 
                                `AND_alu        :       begin
                                `AND_alu        :       begin
                                                                aluOutput = op1 & op2;
                                                                aluOut = op1 & op2;
                                                                end
                                                                end
 
 
                                `OR_alu         :       begin
                                `OR_alu         :       begin
                                                                aluOutput = op1 | op2;
                                                                aluOut = op1 | op2;
                                                                end
                                                                end
 
 
                                `XOR_alu        :       begin
                                `XOR_alu        :       begin
                                                                aluOutput = op1^op2;
                                                                aluOut = op1^op2;
                                                                end
                                                                end
 
 
                                `GT_alu         :       begin
                                `GT_alu         :       begin
                                                                aluOutput = op1>op2 ? 1'b1 : 1'b0;
                                                                aluOut = op1>op2 ? 1'b1 : 1'b0;
                                                                end
                                                                end
 
 
                                `GE_alu         :       begin
                                `GE_alu         :       begin
                                                                aluOutput = op1>=op2 ? 1'b1 : 1'b0;
                                                                aluOut = op1>=op2 ? 1'b1 : 1'b0;
                                                                end
                                                                end
 
 
                                `EQ_alu         :       begin
                                `EQ_alu         :       begin
                                                                aluOutput = op1==op2 ? 1'b1 : 1'b0;
                                                                aluOut = op1==op2 ? 1'b1 : 1'b0;
                                                                end
                                                                end
 
 
                                `LE_alu         :       begin
                                `LE_alu         :       begin
                                                                aluOutput = op1<=op2 ? 1'b1 : 1'b0;
                                                                aluOut = op1<=op2 ? 1'b1 : 1'b0;
                                                                end
                                                                end
 
 
                                `LT_alu         :       begin
                                `LT_alu         :       begin
                                                                aluOutput = op1<op2 ? 1'b1 : 1'b0;
                                                                aluOut = op1<op2 ? 1'b1 : 1'b0;
                                                                end
                                                                end
 
 
                                `ADD_alu        :       begin
                                `ADD_alu        :       begin
                                                                aluOutput = addRes[7:0];
                                                                aluOut = addRes[7:0];
                                                                carryOutput = addRes[8];
                                                                carryOut = addRes[8];
                                                                end
                                                                end
 
 
                                `SUB_alu        :       begin
                                `SUB_alu        :       begin
                                                                aluOutput = subRes[7:0];
                                                                aluOut = subRes[7:0];
                                                                carryOutput = subRes[8];
                                                                carryOut = subRes[8];
                                                                end
                                                                end
 
 
                                `LD_data        :       begin
                                `LD_data        :       begin
                                                                aluOutput = op1;
                                                                aluOut = op2;
                                                                end
                                                                end
 
 
                                default         :       begin
                                default         :       begin
                                                                aluOutput = 16'b0;
                                                                aluOut = 16'b0;
                                                                $write ("\nUnknown operation. \tmodule : ALU");
                                                                $write ("\nUnknown operation. \tmodule : ALU");
                                                                end
                                                                end
                                endcase
                                endcase
 
 
                        end
                        end
                        else
                        else
                        begin
                        begin
 
 
                                aluOutput = aluOutput;
                                aluOut = aluOut;
                        end
                        end
 
 
                end
                end
 
 
                assign aluOut = aluOutput;
 
                assign carryOut = carryOutput;
 
 
 
endmodule
endmodule
 
 
 No newline at end of file
 No newline at end of file

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.