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

Subversion Repositories thor

[/] [thor/] [trunk/] [rtl/] [verilog/] [Thor_icachemem.v] - Blame information for rev 12

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

Line No. Rev Author Line
1 3 robfinch
// ============================================================================
2
//        __
3
//   \\__/ o\    (C) 2013,2015  Robert Finch, Stratford
4
//    \  __ /    All rights reserved.
5
//     \/_//     robfinch<remove>@finitron.ca
6
//       ||
7
//
8
// This source file is free software: you can redistribute it and/or modify 
9
// it under the terms of the GNU Lesser General Public License as published 
10
// by the Free Software Foundation, either version 3 of the License, or     
11
// (at your option) any later version.                                      
12
//                                                                          
13
// This source file is distributed in the hope that it will be useful,      
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
16
// GNU General Public License for more details.                             
17
//                                                                          
18
// You should have received a copy of the GNU General Public License        
19
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
20
//
21
//
22
// Thor SuperScalar
23
//
24
// ============================================================================
25
//
26
module Thor_icachemem(wclk, wce, wr, wa, wd, rclk, pc, insn);
27
parameter DBW=64;
28
input wclk;
29
input wce;
30
input wr;
31
input [DBW-1:0] wa;
32
input [DBW-1:0] wd;
33
input rclk;
34
input [DBW-1:0] pc;
35
output reg [127:0] insn;
36
 
37
wire [127:0] mem0a;
38
wire [127:0] mem1a;
39
reg [14:0] pcp16;
40
 
41
generate
42
begin : gen1
43
        if (DBW==32) begin
44
        syncRam2kx32_1w1r uicm0a0 (
45
            .wclk(wclk),
46
            .wce(wce && wa[3:2]==2'b00),
47
            .wr({4{wr}}),
48
            .wa(wa[14:4]),
49
            .wd(wd),
50
            .rclk(rclk),
51
            .rce(1'b1),
52
            .ra(pc[14:4]),
53
            .o(mem0a[31:0])
54
        );
55
        syncRam2kx32_1w1r uicm0a1 (
56
            .wclk(wclk),
57
            .wce(wce && wa[3:2]==2'b01),
58
            .wr({4{wr}}),
59
            .wa(wa[14:4]),
60
            .wd(wd),
61
            .rclk(rclk),
62
            .rce(1'b1),
63
            .ra(pc[14:4]),
64
            .o(mem0a[63:32])
65
        );
66
        syncRam2kx32_1w1r uicm0a2 (
67
            .wclk(wclk),
68
            .wce(wce && wa[3:2]==2'b10),
69
            .wr({4{wr}}),
70
            .wa(wa[14:4]),
71
            .wd(wd),
72
            .rclk(rclk),
73
            .rce(1'b1),
74
            .ra(pc[14:4]),
75
            .o(mem0a[95:64])
76
        );
77
        syncRam2kx32_1w1r uicm0a3 (
78
            .wclk(wclk),
79
            .wce(wce && wa[3:2]==2'b11),
80
            .wr({4{wr}}),
81
            .wa(wa[14:4]),
82
            .wd(wd),
83
            .rclk(rclk),
84
            .rce(1'b1),
85
            .ra(pc[14:4]),
86
            .o(mem0a[127:96])
87
        );
88
 
89
        syncRam2kx32_1w1r uicm1a0 (
90
            .wclk(wclk),
91
            .wce(wce && wa[3:2]==2'b00),
92
            .wr({4{wr}}),
93
            .wa(wa[14:4]),
94
            .wd(wd),
95
            .rclk(rclk),
96
            .rce(1'b1),
97
            .ra(pcp16[14:4]),
98
            .o(mem1a[31:0])
99
        );
100
        syncRam2kx32_1w1r uicm1a1 (
101
            .wclk(wclk),
102
            .wce(wce && wa[3:2]==2'b01),
103
            .wr({4{wr}}),
104
            .wa(wa[14:4]),
105
            .wd(wd),
106
            .rclk(rclk),
107
            .rce(1'b1),
108
            .ra(pcp16[14:4]),
109
            .o(mem1a[63:32])
110
        );
111
        syncRam2kx32_1w1r uicm1a2 (
112
            .wclk(wclk),
113
            .wce(wce && wa[3:2]==2'b10),
114
            .wr({4{wr}}),
115
            .wa(wa[14:4]),
116
            .wd(wd),
117
            .rclk(rclk),
118
            .rce(1'b1),
119
            .ra(pcp16[14:4]),
120
            .o(mem1a[95:64])
121
        );
122
        syncRam2kx32_1w1r uicm1a3 (
123
            .wclk(wclk),
124
            .wce(wce && wa[3:2]==2'b11),
125
            .wr({4{wr}}),
126
            .wa(wa[14:4]),
127
            .wd(wd),
128
            .rclk(rclk),
129
            .rce(1'b1),
130
            .ra(pcp16[14:4]),
131
            .o(mem1a[127:96])
132
        );
133
    end
134
end
135
endgenerate
136
 
137
always @(pc)
138
        pcp16 <= pc[14:0] + 15'd16;
139
wire [127:0] insn0 = mem0a;
140
wire [127:0] insn1 = mem1a;
141
always @(pc or insn0 or insn1)
142
case(pc[3:0])
143
4'd0:   insn <= insn0;
144
4'd1:   insn <= {insn1[7:0],insn0[127:8]};
145
4'd2:   insn <= {insn1[15:0],insn0[127:16]};
146
4'd3:   insn <= {insn1[23:0],insn0[127:24]};
147
4'd4:   insn <= {insn1[31:0],insn0[127:32]};
148
4'd5:   insn <= {insn1[39:0],insn0[127:40]};
149
4'd6:   insn <= {insn1[47:0],insn0[127:48]};
150
4'd7:   insn <= {insn1[55:0],insn0[127:56]};
151
4'd8:   insn <= {insn1[63:0],insn0[127:64]};
152
4'd9:   insn <= {insn1[71:0],insn0[127:72]};
153
4'd10:  insn <= {insn1[79:0],insn0[127:80]};
154
4'd11:  insn <= {insn1[87:0],insn0[127:88]};
155
4'd12:  insn <= {insn1[95:0],insn0[127:96]};
156
4'd13:  insn <= {insn1[103:0],insn0[127:104]};
157
4'd14:  insn <= {insn1[111:0],insn0[127:112]};
158
4'd15:  insn <= {insn1[119:0],insn0[127:120]};
159
endcase
160
 
161
endmodule

powered by: WebSVN 2.1.0

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