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

Subversion Repositories raptor64

[/] [raptor64/] [trunk/] [rtl/] [verilog/] [Raptor64_SetOperandRegs.v] - Blame information for rev 33

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 33 robfinch
`include "Raptor64_opcodes.v"
2
`timescale 1ns / 1ps
3
//=============================================================================
4
//        __
5
//   \\__/ o\    (C) 2011,2012  Robert Finch
6
//    \  __ /    All rights reserved.
7
//     \/_//     robfinch<remove>@opencores.org
8
//       ||
9
//  
10
//      Raptor64_SetOperandRegs.v
11
//  
12
// This source file is free software: you can redistribute it and/or modify 
13
// it under the terms of the GNU Lesser General Public License as published 
14
// by the Free Software Foundation, either version 3 of the License, or     
15
// (at your option) any later version.                                      
16
//                                                                          
17
// This source file is distributed in the hope that it will be useful,      
18
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
19
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
20
// GNU General Public License for more details.                             
21
//                                                                          
22
// You should have received a copy of the GNU General Public License        
23
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
24
//                                                                          
25
//
26
//=============================================================================
27
 
28
module Raptor64_SetOperandRegs(rst, clk, advanceI, advanceR, advanceX, b, AXC, insn, xIR, dRa, dRb, dRc);
29
input rst;
30
input clk;
31
input advanceI;
32
input advanceR;
33
input advanceX;
34
input [63:0] b;
35
input [3:0] AXC;
36
input [41:0] insn;
37
input [41:0] xIR;
38
output [8:0] dRa;
39
reg [8:0] dRa;
40
output [8:0] dRb;
41
reg [8:0] dRb;
42
output [8:0] dRc;
43
reg [8:0] dRc;
44
 
45
wire [6:0] iOpcode = insn[41:35];
46
wire [6:0] xOpcode = xIR[41:35];
47
wire [6:0] xFunc = xIR[6:0];
48
 
49
always @(posedge clk)
50
if (rst) begin
51
        dRa <= 9'd0;
52
        dRb <= 9'd0;
53
        dRc <= 9'd0;
54
end
55
else begin
56
        if (advanceI) begin
57
                // Default settings, to be overridden
58
                dRa <= {AXC,insn[34:30]};
59
                dRb <= {AXC,insn[29:25]};
60
                dRc <= {AXC,insn[24:20]};
61
                casex(iOpcode)
62
                `RET:           begin
63
                                        dRa <= {AXC,5'd30};
64
                                        dRb <= {AXC,5'd31};
65
                                        end
66
                `SETLO:         dRa <= {AXC,insn[36:32]};
67
                `SETHI:         dRa <= {AXC,insn[36:32]};
68
                `SM,`LM:
69
                        begin
70
                        dRa <= {AXC,1'b1,insn[34:31]};
71
                        casex(insn[30:0])
72
                        31'bxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1:    dRb <= {AXC,5'd1};
73
                        31'bxxxxxxxxxxxxxxxxxxxxxxxxxxxxx10:    dRb <= {AXC,5'd2};
74
                        31'bxxxxxxxxxxxxxxxxxxxxxxxxxxxx100:    dRb <= {AXC,5'd3};
75
                        31'bxxxxxxxxxxxxxxxxxxxxxxxxxxx1000:    dRb <= {AXC,5'd4};
76
                        31'bxxxxxxxxxxxxxxxxxxxxxxxxxx10000:    dRb <= {AXC,5'd5};
77
                        31'bxxxxxxxxxxxxxxxxxxxxxxxxx100000:    dRb <= {AXC,5'd6};
78
                        31'bxxxxxxxxxxxxxxxxxxxxxxxx1000000:    dRb <= {AXC,5'd7};
79
                        31'bxxxxxxxxxxxxxxxxxxxxxxx10000000:    dRb <= {AXC,5'd8};
80
                        31'bxxxxxxxxxxxxxxxxxxxxxx100000000:    dRb <= {AXC,5'd9};
81
                        31'bxxxxxxxxxxxxxxxxxxxxx1000000000:    dRb <= {AXC,5'd10};
82
                        31'bxxxxxxxxxxxxxxxxxxxx10000000000:    dRb <= {AXC,5'd11};
83
                        31'bxxxxxxxxxxxxxxxxxxx100000000000:    dRb <= {AXC,5'd12};
84
                        31'bxxxxxxxxxxxxxxxxxx1000000000000:    dRb <= {AXC,5'd13};
85
                        31'bxxxxxxxxxxxxxxxxx10000000000000:    dRb <= {AXC,5'd14};
86
                        31'bxxxxxxxxxxxxxxxx100000000000000:    dRb <= {AXC,5'd15};
87
                        31'bxxxxxxxxxxxxxxx1000000000000000:    dRb <= {AXC,5'd16};
88
                        31'bxxxxxxxxxxxxxx10000000000000000:    dRb <= {AXC,5'd17};
89
                        31'bxxxxxxxxxxxxx100000000000000000:    dRb <= {AXC,5'd18};
90
                        31'bxxxxxxxxxxxx1000000000000000000:    dRb <= {AXC,5'd19};
91
                        31'bxxxxxxxxxxx10000000000000000000:    dRb <= {AXC,5'd20};
92
                        31'bxxxxxxxxxx100000000000000000000:    dRb <= {AXC,5'd21};
93
                        31'bxxxxxxxxx1000000000000000000000:    dRb <= {AXC,5'd22};
94
                        31'bxxxxxxxx10000000000000000000000:    dRb <= {AXC,5'd23};
95
                        31'bxxxxxxx100000000000000000000000:    dRb <= {AXC,5'd24};
96
                        31'bxxxxxx1000000000000000000000000:    dRb <= {AXC,5'd25};
97
                        31'bxxxxx10000000000000000000000000:    dRb <= {AXC,5'd26};
98
                        31'bxxxx100000000000000000000000000:    dRb <= {AXC,5'd27};
99
                        31'bxxx1000000000000000000000000000:    dRb <= {AXC,5'd28};
100
                        31'bxx10000000000000000000000000000:    dRb <= {AXC,5'd29};
101
                        31'bx100000000000000000000000000000:    dRb <= {AXC,5'd30};
102
                        31'b1000000000000000000000000000000:    dRb <= {AXC,5'd31};
103
                        default:        dRb <= {AXC,5'd0};
104
                        endcase
105
                        end
106
                default:        dRa <= {AXC,insn[34:30]};
107
                endcase
108
        end
109
        else if (advanceR) begin
110
                dRa <= 9'd0;
111
                dRb <= 9'd0;
112
                dRc <= 9'd0;
113
        end
114
        // no else here
115
        if (advanceX) begin
116
                if (xOpcode==`R) begin
117
                        if (xFunc==`EXEC) begin
118
                                dRa <= b[34:30];
119
                                dRb <= b[29:25];
120
                                dRc <= b[24:20];
121
                        end
122
                end
123
        end
124
end
125
 
126
endmodule

powered by: WebSVN 2.1.0

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