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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [new_alu/] [src/] [Unit_Execution.v] - Blame information for rev 209

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 209 diegovalve
 
2
`include "aDefinitions.v"
3
 
4
/**********************************************************************************
5
Theia, Ray Cast Programable graphic Processing Unit.
6
Copyright (C) 2012  Diego Valverde (diego.valverde.g@gmail.com)
7
 
8
This program is free software; you can redistribute it and/or
9
modify it under the terms of the GNU General Public License
10
as published by the Free Software Foundation; either version 2
11
of the License, or (at your option) any later version.
12
 
13
This program 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, write to the Free Software
20
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21
 
22
***********************************************************************************/
23
 
24
module Unit_Execution
25
(
26
input wire Clock,
27
input wire Reset,
28
input wire iEnable
29
 
30
);
31
 
32
wire [`INSTRUCTION_ADDR_WIDTH -1:0]                  wII_2_IM_IP0;
33
wire [`INSTRUCTION_ADDR_WIDTH -1:0]                  wII_2_IM_IP1;
34
wire [`INSTRUCTION_WIDTH-1:0]                        wIM_2_II_Instruction0;
35
wire [`INSTRUCTION_WIDTH-1:0]                        wIM_2_II_Instruction1;
36
wire [`DATA_ADDRESS_WIDTH-1:0]                       wII_2_RF_Addr0;
37
wire [`DATA_ADDRESS_WIDTH-1:0]                       wII_2_RF_Addr1;
38
wire [`DATA_ROW_WIDTH-1:0]                           wRF_2_II_Data0;
39
wire [`DATA_ROW_WIDTH-1:0]                           wRF_2_II_Data1;
40
wire [`NUMBER_OF_RSVR_STATIONS-1:0]                  wRS_2_II_Busy;
41
wire [`ISSUE_PACKET_SIZE-1:0]                        wIssueBus,wModIssue;
42
wire [`NUMBER_OF_RSVR_STATIONS-1:0]                  wStationCommitRequest;
43
wire [`NUMBER_OF_RSVR_STATIONS-1:0]                  wStationCommitGrant;
44
wire [`COMMIT_PACKET_SIZE-1:0]                       wCommitBus;
45
wire [`MOD_COMMIT_PACKET_SIZE-1:0]                   wModCommitBus;
46
wire [`COMMIT_PACKET_SIZE-1:0]                       wCommitData_Adder0;
47
wire [`COMMIT_PACKET_SIZE-1:0]                       wCommitData_Adder1;
48
wire [`COMMIT_PACKET_SIZE-1:0]                       wCommitData_Div;
49
wire [`COMMIT_PACKET_SIZE-1:0]                       wCommitData_Mul;
50
wire [`COMMIT_PACKET_SIZE-1:0]                       wCommitData_Sqrt;
51
wire                                                 wZeroFlag;
52
wire                                                 wSignFlag;
53
wire [`DATA_ADDRESS_WIDTH-1:0]                       wFrameOffset;
54
 
55
 
56
// The Register File
57
RegisterFile # ( `DATA_ROW_WIDTH,`DATA_ADDRESS_WIDTH ) RF
58
(
59
 .Clock(            Clock                            ),
60
 .Reset(            Reset                            ),
61
 .iWriteEnable(     wCommitBus[`COMMIT_WE_RNG]       ),
62
 .iReadAddress0(    wII_2_RF_Addr0                   ),
63
 .iReadAddress1(    wII_2_RF_Addr1                   ),
64
 .iWriteAddress(    wCommitBus[`COMMIT_DST_RNG]      ),
65
 .oFrameOffset(     wFrameOffset                     ),
66
 .iData(            wCommitBus[`COMMIT_DATA_RNG]     ),
67
 .oData0(           wRF_2_II_Data0                   ),
68
 .oData1(           wRF_2_II_Data1                   )
69
);
70
 
71
 
72
 
73
 
74
//Code bank 0
75
RAM_DUAL_READ_PORT  # (`INSTRUCTION_WIDTH, `INSTRUCTION_ADDR_WIDTH) IM
76
(
77
 .Clock(            Clock                    ),
78
 .iWriteEnable(     0                        ),
79
 .iReadAddress0(    wII_2_IM_IP0             ),
80
 .iReadAddress1(    wII_2_IM_IP1             ),
81
 //.iWriteAddress(                           ),
82
 //.iDataIn(                                 ),
83
 .oDataOut0(        wIM_2_II_Instruction0    ),
84
 .oDataOut1(        wIM_2_II_Instruction1    )
85
);
86
 
87
InstructionIssue II
88
(
89
   .Clock(                Clock                 ),
90
        .Reset(                Reset                 ),
91
        .iEnable(              iEnable               ),
92
        .iFrameOffset(         wFrameOffset          ),
93
        .iInstruction0(        wIM_2_II_Instruction0 ),
94
        .iInstruction1(        wIM_2_II_Instruction1 ),
95
        .iSourceData0(         wRF_2_II_Data0        ),
96
        .iSourceData1(         wRF_2_II_Data1        ),
97
        .iRStationBusy(        wRS_2_II_Busy         ),
98
        .iResultBcast(         wCommitBus            ),
99
        .oSourceAddress0(      wII_2_RF_Addr0        ),
100
        .oSourceAddress1(      wII_2_RF_Addr1        ),
101
        .oIssueBcast(          wIssueBus             ),
102
        .iSignFlag(            wSignFlag             ),
103
        .iZeroFlag(            wZeroFlag             ),
104
        .oIP0(                 wII_2_IM_IP0          ),
105
        .oIP1(                 wII_2_IM_IP1          )
106
 
107
);
108
 
109
 
110
 
111
OperandModifiers SMU
112
(
113
        .Clock(                Clock                 ),
114
        .Reset(                Reset                 ),
115
        .iIssueBus(            wIssueBus             ),
116
        .iCommitBus(           wCommitBus            ),
117
        .oModIssue(            wModIssue             ),
118
        .oCommitBus(           wModCommitBus         )
119
 
120
);
121
 
122
assign wSignFlag = wCommitBus[`COMMIT_SIGN_X] & wCommitBus[`COMMIT_SIGN_Y] & wCommitBus[`COMMIT_SIGN_Z];
123
assign wZeroFlag = (wCommitBus[`COMMIT_DATA_RNG] == `DATA_ROW_WIDTH'b0) ? 1'b1 : 1'b0;
124
 
125
 
126
ADDER_STATION ADD_STA0
127
(
128
   .Clock(               Clock                    ),
129
        .Reset(               Reset                    ),
130
        .iId(                 `RS_ADD0                ),
131
   .iIssueBus(           wModIssue                ),
132
   .iCommitBus(          wModCommitBus               ),
133
        .oCommitData(         wCommitData_Adder0        ),
134
        .oCommitResquest(     wStationCommitRequest[0] ),
135
        .iCommitGranted(      wStationCommitGrant[0]   ),
136
        .oBusy(               wRS_2_II_Busy[ 0 ]          )
137
 
138
);
139
 
140
ADDER_STATION ADD_STA1
141
(
142
   .Clock(               Clock                    ),
143
        .Reset(               Reset                    ),
144
        .iId(                 `RS_ADD1                     ),
145
   .iIssueBus(           wModIssue                ),
146
   .iCommitBus(          wModCommitBus               ),
147
        .oCommitData(         wCommitData_Adder1        ),
148
        .oCommitResquest(     wStationCommitRequest[1] ),
149
        .iCommitGranted(      wStationCommitGrant[1]   ),
150
        .oBusy(               wRS_2_II_Busy[ 1 ]          )
151
 
152
);
153
 
154
 
155
DIVISION_STATION DIV_STA
156
(
157
   .Clock(               Clock                    ),
158
        .Reset(               Reset                    ),
159
        .iId(                 `RS_DIV                     ),
160
   .iIssueBus(           wModIssue                ),
161
   .iCommitBus(          wModCommitBus               ),
162
        .oCommitData(         wCommitData_Div          ),
163
        .oCommitResquest(     wStationCommitRequest[2] ),
164
        .iCommitGranted(      wStationCommitGrant[2]   ),
165
        .oBusy(               wRS_2_II_Busy[2]           )
166
 
167
);
168
 
169
 
170
MUL_STATION MUL_STA
171
(
172
   .Clock(               Clock                    ),
173
        .Reset(               Reset                    ),
174
        .iId(                 `RS_MUL                   ),
175
   .iIssueBus(           wModIssue                ),
176
   .iCommitBus(          wModCommitBus               ),
177
        .oCommitData(         wCommitData_Mul          ),
178
        .oCommitResquest(     wStationCommitRequest[3] ),
179
        .iCommitGranted(      wStationCommitGrant[3]   ),
180
        .oBusy(               wRS_2_II_Busy[3]           )
181
 
182
);
183
 
184
 
185
SQRT_STATION SQRT_STA
186
(
187
   .Clock(               Clock                    ),
188
        .Reset(               Reset                    ),
189
        .iId(                 `RS_SQRT                 ),
190
   .iIssueBus(           wModIssue                ),
191
   .iCommitBus(          wModCommitBus               ),
192
        .oCommitData(         wCommitData_Sqrt         ),
193
        .oCommitResquest(     wStationCommitRequest[4] ),
194
        .iCommitGranted(      wStationCommitGrant[4]   ),
195
        .oBusy(               wRS_2_II_Busy[4]         )
196
 
197
);
198
 
199
 
200
ROUND_ROBIN_5_ENTRIES ARB
201
(
202
.Clock( Clock ),
203
.Reset( Reset ),
204
.iRequest0( wStationCommitRequest[0] ),
205
.iRequest1( wStationCommitRequest[1] ),
206
.iRequest2( wStationCommitRequest[2] ),
207
.iRequest3( wStationCommitRequest[3] ),
208
.iRequest4( wStationCommitRequest[4] ),
209
.oGrant0(    wStationCommitGrant[0]   ),
210
.oGrant1(    wStationCommitGrant[1]   ),
211
.oGrant2(    wStationCommitGrant[2]   ),
212
.oGrant3(    wStationCommitGrant[3]   ),
213
.oGrant4(    wStationCommitGrant[4]   )
214
 
215
 
216
);
217
 
218
wire[3:0] wBusSelector;
219
DECODER_ONEHOT_2_BINARY DECODER
220
(
221
.iIn( wStationCommitGrant ),
222
.oOut( wBusSelector        )
223
);
224
 
225
 
226
MUXFULLPARALELL_3SEL_GENERIC # (`COMMIT_PACKET_SIZE ) MUX
227
 (
228
 .Sel(wBusSelector),
229
 .I1(`COMMIT_PACKET_SIZE'b0),
230
 .I2(wCommitData_Adder0),
231
 .I3(wCommitData_Adder1),
232
 .I4(wCommitData_Div),
233
 .I5(wCommitData_Mul),
234
 .I6(wCommitData_Sqrt),
235
 .O1(wCommitBus)
236
 );
237
 
238
endmodule

powered by: WebSVN 2.1.0

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