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

Subversion Repositories raptor64

[/] [raptor64/] [trunk/] [rtl/] [verilog/] [Raptor64_SetTargetRegister.v] - Blame information for rev 44

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_SetTargetRegister.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 41 robfinch
`define EX_IRQ                  9'd449  // interrupt
29
`define EX_NMI                  9'd510  // non-maskable interrupt
30
 
31 33 robfinch
module Raptor64_SetTargetRegister(rst,clk,advanceR,advanceX,dIR,dAXC,xRt);
32
input rst;
33
input clk;
34
input advanceR;
35
input advanceX;
36 41 robfinch
input [31:0] dIR;
37 33 robfinch
input [3:0] dAXC;
38
output [8:0] xRt;
39
reg [8:0] xRt;
40
 
41 41 robfinch
wire [6:0] dOpcode = dIR[31:25];
42 33 robfinch
wire [6:0] dFunc = dIR[6:0];
43
 
44
always @(posedge clk)
45
if (rst) begin
46
        xRt <= 9'd0;
47
end
48
else begin
49
if (advanceR) begin
50
        casex(dOpcode)
51 41 robfinch
        `MISC:
52
                case(dFunc)
53 44 robfinch
                `SYSCALL:       xRt <= 9'd0;
54 41 robfinch
                default:        xRt <= 9'd0;
55
                endcase
56 33 robfinch
        `R:
57
                case(dFunc)
58
                `MTSPR,`CMG,`CMGI,`EXEC:
59
                                        xRt <= 9'd0;
60 41 robfinch
                default:        xRt <= {dAXC,dIR[19:15]};
61 33 robfinch
                endcase
62 41 robfinch
        `MYST,`MUX:     xRt <= {dAXC,dIR[ 9: 5]};
63
        `SETLO:         xRt <= {dAXC,dIR[26:22]};
64
        `SETMID:        xRt <= {dAXC,dIR[26:22]};
65
        `SETHI:         xRt <= {dAXC,dIR[26:22]};
66
        `RR,`FP:        xRt <= {dAXC,dIR[14:10]};
67 33 robfinch
        `BTRI:          xRt <= 9'd0;
68
        `BTRR:
69
                case(dIR[4:0])
70 41 robfinch
                `LOOP:  xRt <= {dAXC,dIR[19:15]};
71 33 robfinch
                default: xRt <= 9'd0;
72
                endcase
73
        `TRAPcc:        xRt <= 9'd0;
74
        `TRAPcci:       xRt <= 9'd0;
75
        `JMP:           xRt <= 9'd00;
76
        `CALL:          xRt <= {dAXC,5'd31};
77
        `RET:           xRt <= {dAXC,5'd30};
78
        `MEMNDX:
79
                case(dFunc[5:0])
80
                `SWX,`SHX,`SCX,`SBX,`SFX,`SFDX,`SPX,`SFPX,`SFDPX,`SSHX,`SSWX,
81
                `OUTWX,`OUTHX,`OUTCX,`OUTBX:
82
                                xRt <= 9'd0;
83 41 robfinch
                default:        xRt <= {dAXC,dIR[14:10]};
84 33 robfinch
                endcase
85
        `LSH,`LSW,
86
        `SW,`SH,`SC,`SB,`SF,`SFD,`SSH,`SSW,`SP,`SFP,`SFDP,      // but not SWC!
87
        `OUTW,`OUTH,`OUTC,`OUTB:
88
                                xRt <= 9'd0;
89
        `NOPI:          xRt <= 9'd0;
90
        `BEQI,`BNEI,`BLTI,`BLEI,`BGTI,`BGEI,`BLTUI,`BLEUI,`BGTUI,`BGEUI:
91
                                xRt <= 9'd0;
92 41 robfinch
        default:        xRt <= {dAXC,dIR[19:15]};
93 33 robfinch
        endcase
94
end
95
else if (advanceX)
96
        xRt <= 9'd0;
97
end
98
 
99
endmodule

powered by: WebSVN 2.1.0

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