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

Subversion Repositories raptor64

[/] [raptor64/] [trunk/] [rtl/] [verilog/] [Raptor64_addsub.v] - Diff between revs 41 and 48

Only display areas with differences | Details | Blame | View Log

Rev 41 Rev 48
`include "Raptor64_opcodes.v"
`include "Raptor64_opcodes.v"
`timescale 1ns / 1ps
`timescale 1ns / 1ps
//=============================================================================
//=============================================================================
//        __
//        __
//   \\__/ o\    (C) 2011,2012  Robert Finch
//   \\__/ o\    (C) 2011,2012  Robert Finch
//    \  __ /    All rights reserved.
//    \  __ /    All rights reserved.
//     \/_//     robfinch<remove>@opencores.org
//     \/_//     robfinch<remove>@opencores.org
//       ||
//       ||
//  
//  
//      Raptor64_addsub.v
//      Raptor64_addsub.v
//  - addsub datapath operations
//  - addsub datapath operations
//
//
//  
//  
// This source file is free software: you can redistribute it and/or modify 
// This source file is free software: you can redistribute it and/or modify 
// it under the terms of the GNU Lesser General Public License as published 
// it under the terms of the GNU Lesser General Public License as published 
// by the Free Software Foundation, either version 3 of the License, or     
// by the Free Software Foundation, either version 3 of the License, or     
// (at your option) any later version.                                      
// (at your option) any later version.                                      
//                                                                          
//                                                                          
// This source file is distributed in the hope that it will be useful,      
// This source file is distributed in the hope that it will be useful,      
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
// GNU General Public License for more details.                             
// GNU General Public License for more details.                             
//                                                                          
//                                                                          
// You should have received a copy of the GNU General Public License        
// You should have received a copy of the GNU General Public License        
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
//                                                                          
//                                                                          
//
//
//=============================================================================
//=============================================================================
//
//
module Raptor64_addsub(xIR, a, b, imm, o);
module Raptor64_addsub(xIR, a, b, imm, o);
input [31:0] xIR;
input [31:0] xIR;
input [63:0] a;
input [63:0] a;
input [63:0] b;
input [63:0] b;
input [63:0] imm;
input [63:0] imm;
output [63:0] o;
output [63:0] o;
reg [63:0] o;
reg [63:0] o;
 
 
wire [6:0] xOpcode = xIR[31:25];
wire [6:0] xOpcode = xIR[31:25];
wire [5:0] xFunc = xIR[5:0];
wire [5:0] xFunc = xIR[5:0];
wire [7:0] bcdaddo,bcdsubo;
wire [7:0] bcdaddo,bcdsubo;
 
 
BCDAdd u1(.ci(1'b0),.a(a[7:0]),.b(b[7:0]),.o(bcdaddo),.c());
BCDAdd u1(.ci(1'b0),.a(a[7:0]),.b(b[7:0]),.o(bcdaddo),.c());
BCDSub u2(.ci(1'b0),.a(a[7:0]),.b(b[7:0]),.o(bcdsubo),.c());
BCDSub u2(.ci(1'b0),.a(a[7:0]),.b(b[7:0]),.o(bcdsubo),.c());
 
 
always @(xOpcode,xFunc,a,b,imm,bcdaddo,bcdsubo)
always @(xOpcode,xFunc,a,b,imm,bcdaddo,bcdsubo)
case (xOpcode)
case (xOpcode)
`RR:
`RR:
        case(xFunc)
        case(xFunc)
        `ADD:   o = a + b;
        `ADD:   o = a + b;
        `ADDU:  o = a + b;
        `ADDU:  o = a + b;
        `SUB:   o = a - b;
        `SUB:   o = a - b;
        `SUBU:  o = a - b;
        `SUBU:  o = a - b;
        `BCD_ADD:       o = bcdaddo;
        `BCD_ADD:       o = bcdaddo;
        `BCD_SUB:       o = bcdsubo;
        `BCD_SUB:       o = bcdsubo;
        default:        o = 64'd0;
        default:        o = 64'd0;
        endcase
        endcase
`ADDI:  o = a + imm;
`INB,`INCH,`INH,`INW,`INCU,`INHU,`INBU,
`ADDUI: o = a + imm;
`OUTB,`OUTC,`OUTH,`OUTW,`OUTBC,
 
`LW,`LH,`LC,`LB,`LHU,`LCU,`LBU,`LEA,`LF,`LFD,`LWR,
 
`SW,`SH,`SC,`SB,`SF,`SFD,`SWC,
 
`ADDI,`ADDUI:
 
                o = a + imm;
`SUBI:  o = a - imm;
`SUBI:  o = a - imm;
`SUBUI: o = a - imm;
`SUBUI: o = a - imm;
default:        o = 64'd0;
default:        o = 64'd0;
endcase
endcase
 
 
endmodule
endmodule
 
 

powered by: WebSVN 2.1.0

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