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

Subversion Repositories m32632

[/] [m32632/] [trunk/] [rtl/] [DATENPFAD.v] - Blame information for rev 11

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

Line No. Rev Author Line
1 9 ns32kum
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2
//
3
// This file is part of the M32632 project
4
// http://opencores.org/project,m32632
5
//
6
// Filename: DATENPFAD.v
7
// Version:  1.0
8
// Date:     30 May 2015
9
//
10
// Copyright (C) 2015 Udo Moeller
11
// 
12
// This source file may be used and distributed without 
13
// restriction provided that this copyright statement is not 
14
// removed from the file and that any derivative work contains 
15
// the original copyright notice and the associated disclaimer.
16
// 
17
// This source file is free software; you can redistribute it 
18
// and/or modify it under the terms of the GNU Lesser General 
19
// Public License as published by the Free Software Foundation;
20
// either version 2.1 of the License, or (at your option) any 
21
// later version. 
22
// 
23
// This source is distributed in the hope that it will be 
24
// useful, but WITHOUT ANY WARRANTY; without even the implied 
25
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
26
// PURPOSE. See the GNU Lesser General Public License for more 
27
// details. 
28
// 
29
// You should have received a copy of the GNU Lesser General 
30
// Public License along with this source; if not, download it 
31
// from http://www.opencores.org/lgpl.shtml 
32
// 
33
// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
34
//
35
//      Modules contained in this file:
36
//      DATENPFAD       the data path of M32632
37
//
38 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
39 9 ns32kum
 
40 11 ns32kum
module DATENPFAD( BCLK, BRESET, WREN, IO_READY, LD_DIN, LD_IMME, WR_REG, IC_USER, ACC_FELD, ACC_STAT, DIN, DISP, IC_TEX,
41
                                  IMME_Q, INFO_AU, LD_OUT, DETOIP, MMU_UPDATE, OPER, PC_ARCHI, PC_ICACHE, RDAA, RDAB, START, WMASKE,
42
                                  WRADR, DONE, Y_INIT, WRITE_OUT, READ_OUT, ZTEST, RMW, ACC_DONE, REG_OUT, PTB_SEL, PTB_WR, ACB_ZERO,
43
                                  ABORT, SAVE_PC, CFG, CINV, DP_Q, IVAR, MCR, PACKET, PC_NEW, PSR, SIZE, STRING, TRAPS, VADR, RWVFLAG,
44 9 ns32kum
                                  DBG_HIT, DBG_IN, COP_GO, COP_OP, COP_IN, COP_DONE, COP_OUT);
45
 
46
input                   BCLK;
47
input                   BRESET;
48
input                   WREN;           // write enable of the register file
49
input                   IO_READY;
50
input                   LD_DIN;
51
input                   LD_IMME;
52
input                   WR_REG;         // write signal for the DP_FPU
53
input                   IC_USER;
54
input                   RWVFLAG;
55
input   [14:0]   ACC_FELD;
56
input    [5:0]   ACC_STAT;
57
input   [31:0]   DIN;
58
input   [31:0]   DISP;
59
input    [2:0]   IC_TEX;
60
input   [31:0]   IMME_Q;
61
input    [6:0]   INFO_AU;
62
input    [1:0]   LD_OUT;
63
input   [12:0]   DETOIP;
64
input    [1:0]   MMU_UPDATE;
65
input   [10:0]   OPER;
66
input   [31:0]   PC_ARCHI;
67
input   [31:0]   PC_ICACHE;
68
input    [7:0]   RDAA;
69
input    [7:0]   RDAB;
70
input    [1:0]   START;
71
input    [1:0]   WMASKE;
72
input    [5:0]   WRADR;
73
input                   DBG_HIT;
74
input                   COP_DONE;
75
input   [23:0]   COP_OP;
76
input   [63:0]   COP_IN;
77
 
78
output                  DONE;
79
output                  Y_INIT;
80
output                  WRITE_OUT;
81
output                  READ_OUT;
82
output                  ZTEST;
83
output                  RMW;
84
output                  ACC_DONE;
85
output                  REG_OUT;
86
output                  PTB_SEL;
87
output                  PTB_WR;
88
output reg              ACB_ZERO;
89
output                  ABORT;
90
output                  SAVE_PC;
91
output  [12:0]   CFG;
92
output   [3:0]   CINV;
93
output  [63:0]   DP_Q;
94
output   [1:0]   IVAR;
95
output   [3:0]   MCR;
96
output   [3:0]   PACKET;
97
output  [31:0]   PC_NEW;
98
output  [11:0]   PSR;
99
output   [1:0]   SIZE;
100
output   [4:0]   STRING;
101
output   [5:0]   TRAPS;
102
output  [31:0]   VADR;
103
output  [40:2]  DBG_IN;
104
output                  COP_GO;
105
output [127:0]   COP_OUT;
106
 
107
reg     [31:0]   high_dq;
108
reg             [31:0]   OUT_I;
109
reg             [31:0]   BYDIN;          // the bypass register
110
 
111
wire     [2:0]   BITSEL;
112
wire     [1:0]   BWD;
113
wire                    CLR_LSB;
114
wire    [31:0]   ERGEBNIS;       // the result bus
115
wire                    FL;
116
wire    [31:0]   FSR;
117
wire    [63:0]   MRESULT;
118
wire     [7:0]   OPCODE;
119
wire                    SELI_A;
120
wire                    SELI_B;
121
wire     [2:0]   SP_CMP;
122
wire    [31:0]   SRC1;           // the bus for the Source 1 operand
123
wire    [31:0]   SRC2;           // the bus for the Source 2 operand
124
wire     [4:0]   TT_DP;
125
wire                    TWREN;          // active if FPU Trap occurs
126
wire                    UP_DP;
127
wire                    WRADR_0;
128
wire                    WREN_L,WREN_LX;
129
wire                    LD_FSR;
130
wire                    UP_SP;
131
wire     [4:0]   TT_SP;
132
wire    [31:0]   addr_i;
133
wire     [2:0]   DP_CMP;
134
wire    [31:0]   DP_OUT;
135
wire    [31:0]   SFP_DAT;
136
wire                    ld_out_l;
137
wire     [6:0]   BMCODE;
138
wire    [31:0]   OUT_A,OUT_B;
139
wire                    SP_MUX;
140
wire    [31:0]   I_OUT;
141
wire    [31:0]   FP_OUT;
142
wire                    DOWR;
143
wire    [31:0]   DEST1,DEST2;
144
wire                    ENWR;
145
wire     [3:0]   OVF_BCD;
146
wire     [3:0]   DSR;
147
wire                    acb_zero_i;
148
wire    [31:0]   BMASKE;
149
 
150
assign  FL         = OPER[10];
151
assign  BWD        = OPER[9:8];
152
assign  OPCODE = OPER[7:0];
153
 
154
assign  ERGEBNIS = SP_MUX ? FP_OUT : I_OUT;
155
 
156
assign  WRADR_0 = WRADR[0] & ~CLR_LSB;
157
assign  ENWR = WREN_L | WREN;
158
assign  DOWR = ENWR & TWREN;
159
 
160
assign  WREN_L = WREN_LX & ~TRAPS[0];
161
 
162
assign  DP_Q[63:32] = high_dq;
163
 
164
assign  PC_NEW = SRC1;
165
 
166
always @(posedge BCLK) if (LD_OUT[1] || WREN)    ACB_ZERO <= acb_zero_i;
167
 
168
always @(posedge BCLK) if (LD_OUT[1] || ld_out_l) high_dq <= ERGEBNIS;
169
 
170
always @(posedge BCLK) if (LD_DIN) OUT_I <= LD_IMME ? IMME_Q : DIN;
171
 
172
always @(posedge BCLK) if (RDAA[7]) BYDIN <= ERGEBNIS;
173
 
174 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
175 9 ns32kum
// Register Set 1 => SRC1
176 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
177 9 ns32kum
REGISTER        REG_SET_A(
178
        .BCLK(BCLK),
179
        .ENWR(ENWR),
180
        .DOWR(DOWR),
181
        .DIN(ERGEBNIS),
182
        .BYDIN(BYDIN),
183
        .RADR(RDAA),
184
        .WADR({WRADR[5:1],WRADR_0}),
185
        .WMASKE(WMASKE),
186
        .SELI(SELI_A),
187
        .DOUT(OUT_A));
188
 
189
assign SRC1 = SELI_A ? OUT_I : OUT_A;
190
 
191 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
192 9 ns32kum
// Register Set 2 => SRC2
193 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
194 9 ns32kum
REGISTER        REG_SET_B(
195
        .BCLK(BCLK),
196
        .ENWR(ENWR),
197
        .DOWR(DOWR),
198
        .DIN(ERGEBNIS),
199
        .BYDIN(BYDIN),
200
        .RADR(RDAB),
201
        .WADR({WRADR[5:1],WRADR_0}),
202
        .WMASKE(WMASKE),
203
        .SELI(SELI_B),
204
        .DOUT(OUT_B));
205
 
206
assign SRC2 = SELI_B ? OUT_I : OUT_B;
207
 
208
MULFILTER       M_FILTER(
209
        .FLOAT(OPCODE[2]),
210
        .BWD(BWD),
211
        .SRC1(SRC1),
212
        .SRC2(SRC2),
213
        .DEST1(DEST1),
214
        .DEST2(DEST2));
215
 
216
SIGNMUL         S_MULTI(                // signed multiplier 32 * 32 bits = 64 bits
217
        .dataa(DEST1),
218
        .datab(DEST2),
219
        .result(MRESULT));
220
 
221
BITMASK  BITM_U(
222
        .AA(BMCODE),
223
        .DOUT(BMASKE));
224
 
225 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
226 9 ns32kum
// The integer data path
227 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
228 9 ns32kum
I_PFAD  GANZ_U(
229
        .FL(FL),
230
        .BRESET(BRESET),
231
        .BCLK(BCLK),
232
        .WREN(WREN),
233
        .LD_OUT(LD_OUT[1]),
234
        .ADDR(addr_i),
235
        .BITSEL(BITSEL),
236
        .BMASKE(BMASKE),
237
        .BWD(BWD),
238
        .DP_CMP(DP_CMP),
239
        .DP_OUT(DP_OUT),
240
        .FSR(FSR),
241
        .DETOIP(DETOIP[11:0]),
242
        .MRESULT(MRESULT),
243
        .OPCODE(OPCODE),
244
        .RDAA(RDAA),
245
        .SFP_DAT(SFP_DAT),
246
        .SP_CMP(SP_CMP),
247
        .SRC1(SRC1),
248
        .SRC2(SRC2),
249
        .WRADR(WRADR),
250
        .DSR(DSR),
251
        .OV_FLAG(TRAPS[2]),
252
        .ACB_ZERO(acb_zero_i),
253
        .BMCODE(BMCODE),
254
        .I_OUT(I_OUT),
255
        .PSR(PSR),
256
        .STRING(STRING),
257
        .OVF_BCD(OVF_BCD),
258
        .DISP(DISP[4:0]),
259
        .RWVFLAG(RWVFLAG));
260
 
261 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
262 9 ns32kum
// The address unit
263 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
264 9 ns32kum
ADDR_UNIT       ADDR_U(
265
        .BCLK(BCLK),
266
        .BRESET(BRESET),
267
        .IO_READY(IO_READY),
268
        .READ(ACC_FELD[11]),
269
        .WRITE(ACC_FELD[10]),
270
        .CLRMSW(ACC_FELD[2]),
271
        .FULLACC(ACC_FELD[8]),
272
        .POST(ACC_FELD[3]),
273
        .DISP_OK(INFO_AU[0]),
274
        .LDEA(ACC_FELD[9]),
275
        .NEWACC(ACC_FELD[14]),
276
        .FPU_TRAP(TRAPS[0]),
277
        .ADIVAR(INFO_AU[2]),
278
        .RWVAL_1(INFO_AU[3]),
279
        .ABO_STAT({INFO_AU[1],IC_USER}),
280
        .ACC_STAT(ACC_STAT),
281
        .ASIZE(ACC_FELD[13:12]),
282
        .BWD(BWD),
283
        .DISP(DISP),
284
        .IC_TEX(IC_TEX),
285
        .INDEX(ACC_FELD[7:4]),
286
        .MMU_UPDATE(MMU_UPDATE),
287
        .PC_ARCHI(PC_ARCHI),
288
        .PC_ICACHE(PC_ICACHE),
289
        .SRC1(SRC1),
290
        .SRC2(SRC2),
291
        .SRC2SEL(ACC_FELD[1:0]),
292
        .REG_OUT(REG_OUT),
293
        .ACC_DONE(ACC_DONE),
294
        .READ_OUT(READ_OUT),
295
        .WRITE_OUT(WRITE_OUT),
296
        .ABORT(ABORT),
297
        .ADDR(addr_i),
298
        .BITSEL(BITSEL),
299
        .PACKET(PACKET),
300
        .SIZE(SIZE),
301
        .VADR(VADR),
302
        .ZTEST(ZTEST),
303
        .RMW(RMW),
304
        .OP_RMW(INFO_AU[4]),
305
        .PHASE_17(INFO_AU[5]),
306
        .NO_TRAP(INFO_AU[6]) );
307
 
308
CONFIG_REGS     CFG_DBG(
309
        .BCLK(BCLK),
310
        .BRESET(BRESET),
311
        .WREN(WREN),
312
        .LD_OUT(LD_OUT[1]),
313
        .OPCODE(OPCODE),
314
        .SRC1(SRC1),
315
        .WRADR(WRADR),
316
        .PTB_WR(PTB_WR),
317
        .PTB_SEL(PTB_SEL),
318
        .CFG(CFG),
319
        .CINV(CINV),
320
        .IVAR(IVAR),
321
        .Y_INIT(Y_INIT),
322
        .MCR(MCR),
323
        .DBG_TRAPS(TRAPS[5:3]),
324
        .PC_ARCHI(PC_ARCHI),
325
        .DSR(DSR),
326
        .USER(PSR[8]),
327
        .PCMATCH(DETOIP[12]),
328
        .DBG_IN(DBG_IN),
329
        .DBG_HIT(DBG_HIT),
330
        .READ(READ_OUT) );
331
 
332 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
333 9 ns32kum
// The long operation unit
334 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
335 9 ns32kum
DP_FPU  DOUBLE_U(
336
        .BCLK(BCLK),
337
        .FL(FL),
338
        .BRESET(BRESET),
339
        .LD_LDQ(LD_OUT[0]),
340
        .WR_REG(WR_REG),
341
        .BWD(BWD),
342
        .FSR(FSR[8:3]),
343
        .OPCODE(OPCODE),
344
        .SRC1(SRC1),
345
        .SRC2(SRC2),
346
        .START(START),
347
        .DONE(DONE),
348
        .UP_DP(UP_DP),
349
        .WREN_L(WREN_LX),
350
        .CLR_LSB(CLR_LSB),
351
        .LD_OUT_L(ld_out_l),
352
        .DVZ_TRAP(TRAPS[1]),
353
        .DP_CMP(DP_CMP),
354
        .DP_OUT(DP_OUT),
355
        .DP_Q(DP_Q[31:0]),
356
        .TT_DP(TT_DP),
357
        .CY_IN(PSR[0]),
358
        .OVF_BCD(OVF_BCD),
359
        .COP_DONE(COP_DONE),
360
        .COP_OP(COP_OP),
361
        .COP_IN(COP_IN),
362
        .COP_GO(COP_GO),
363
        .COP_OUT(COP_OUT));
364
 
365 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
366 9 ns32kum
// The single precision floating point unit
367 11 ns32kum
// ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
368 9 ns32kum
SP_FPU  SINGLE_U(
369
        .FL(FL),
370
        .BCLK(BCLK),
371
        .BWD(BWD),
372
        .FSR(FSR[8:3]),
373
        .MRESULT(MRESULT[47:0]),
374
        .OPCODE(OPCODE),
375
        .SRC1(SRC1),
376
        .SRC2(SRC2),
377
        .LD_FSR(LD_FSR),
378
        .SP_MUX(SP_MUX),
379
        .UP_SP(UP_SP),
380
        .FP_OUT(FP_OUT),
381
        .I_OUT(SFP_DAT),
382
        .SP_CMP(SP_CMP),
383
        .TT_SP(TT_SP));
384
 
385
FP_STAT_REG     FPS_REG(
386
        .BCLK(BCLK),
387
        .BRESET(BRESET),
388
        .LFSR(LD_FSR),
389
        .WREN(ENWR),
390
        .WRADR(WRADR[5:4]),
391
        .UP_DP(UP_DP),
392
        .UP_SP(UP_SP & LD_OUT[1]),
393
        .DIN(SRC1[16:0]),
394
        .TT_DP(TT_DP),
395
        .TT_SP(TT_SP),
396
        .FPU_TRAP(TRAPS[0]),
397
        .TWREN(TWREN),
398
        .SAVE_PC(SAVE_PC),
399
        .FSR(FSR));
400
 
401
endmodule

powered by: WebSVN 2.1.0

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