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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [tags/] [Beta_0.2/] [rtl/] [EXE/] [Unit_EXE.v] - Blame information for rev 72

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

Line No. Rev Author Line
1 22 diegovalve
`timescale 1ns / 1ps
2
`include "aDefinitions.v"
3
/**********************************************************************************
4
Theia, Ray Cast Programable graphic Processing Unit.
5
Copyright (C) 2010  Diego Valverde (diego.valverde.g@gmail.com)
6
 
7
This program is free software; you can redistribute it and/or
8
modify it under the terms of the GNU General Public License
9
as published by the Free Software Foundation; either version 2
10
of the License, or (at your option) any later version.
11
 
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
GNU General Public License for more details.
16
 
17
You should have received a copy of the GNU General Public License
18
along with this program; if not, write to the Free Software
19
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
20
 
21
***********************************************************************************/
22
 
23
//---------------------------------------------------------------------
24
module ExecutionUnit
25
(
26
 
27
input wire                             Clock,
28
input wire                             Reset,
29
input wire [`ROM_ADDRESS_WIDTH-1:0]         iInitialCodeAddress,
30 60 diegovalve
input wire [`INSTRUCTION_WIDTH-1:0]      iInstruction1,
31
input wire [`INSTRUCTION_WIDTH-1:0]      iInstruction2,
32 22 diegovalve
 
33
 
34
input wire [`DATA_ROW_WIDTH-1:0]                 iDataRead0,
35
input wire [`DATA_ROW_WIDTH-1:0]       iDataRead1,
36
input wire                             iTrigger,
37
 
38
 
39 60 diegovalve
output wire [`ROM_ADDRESS_WIDTH-1:0]     oInstructionPointer1,
40
output wire [`ROM_ADDRESS_WIDTH-1:0]     oInstructionPointer2,
41 22 diegovalve
output wire [`DATA_ADDRESS_WIDTH-1:0]    oDataReadAddress0,
42
output wire [`DATA_ADDRESS_WIDTH-1:0]  oDataReadAddress1,
43
output wire                                                                     oDataWriteEnable,
44
output wire [`DATA_ADDRESS_WIDTH-1:0]    oDataWriteAddress,
45
output wire [`DATA_ROW_WIDTH-1:0]                oDataBus,
46
output wire                            oReturnCode,
47
output wire                            oDone
48
 
49
 
50
 
51
 
52
);
53
 
54
 
55
`ifdef DEBUG
56
        wire [`ROM_ADDRESS_WIDTH-1:0] wDEBUG_IDU2_EXE_InstructionPointer;
57
`endif
58
 
59
wire                                                                            wEXE2__uCodeDone;
60
wire                                                                            wEXE2_IFU__EXEBusy;
61
wire [`DATA_ADDRESS_WIDTH-1:0]   wEXE2_IDU_DataFordward_LastDestination;
62
wire                                                                            wALU2_EXE__BranchTaken;
63
wire                                                                            wALU2_IFU_BranchNotTaken;
64
wire [`INSTRUCTION_WIDTH-1:0]    CurrentInstruction;
65 60 diegovalve
//wire                                                                          wIDU2_IFU__IDUBusy;
66 22 diegovalve
 
67
 
68
wire [`INSTRUCTION_OP_LENGTH-1:0]                                wOperation;
69
 
70
 
71
wire [`DATA_ROW_WIDTH-1:0] wSource0,wSource1;
72
wire [`DATA_ADDRESS_WIDTH-1:0] wDestination;
73
wire wInstructionAvailable;
74
 
75
//ALU wires
76
wire [`INSTRUCTION_OP_LENGTH-1:0]                ALU2Operation;
77
wire [`WIDTH-1:0]                                        ALU2ChannelA;
78
wire [`WIDTH-1:0]                                        ALU2ChannelB;
79
wire [`WIDTH-1:0]                                        ALU2ChannelC;
80
wire [`WIDTH-1:0]                                        ALU2ChannelD;
81
wire [`WIDTH-1:0]                                        ALU2ChannelE;
82
wire [`WIDTH-1:0]                                        ALU2ChannelF;
83
wire [`WIDTH-1:0]                                        ALU2ResultA;
84
wire [`WIDTH-1:0]                                        ALU2ResultB;
85
wire [`WIDTH-1:0]                                        ALU2ResultC;
86
wire                                                                            wEXE2_ALU__TriggerALU;
87
wire                                                                            ALU2OutputReady;
88 60 diegovalve
wire                                                                            w2FIU__BranchTaken;
89 22 diegovalve
wire    [`ROM_ADDRESS_WIDTH-1:0] JumpIp;
90
 
91
 
92 60 diegovalve
//wire wIDU2_IFU__InputsLatched;        
93
 
94
wire wEPU_Busy,wTriggerIFU;
95
wire [`ROM_ADDRESS_WIDTH-1:0] wEPU_IP,wIFU_IP,wCodeEntryPoint;
96
 
97
assign oInstructionPointer1 = (wEPU_Busy) ? wEPU_IP : wIFU_IP;
98
 
99
 
100
InstructionEntryPoint EPU
101
(
102
.Clock( Clock ),
103
.Reset( Reset ),
104
.iTrigger( iTrigger ),
105
.iInitialCodeAddress( iInitialCodeAddress ),
106
.iIMemInput(iInstruction1),
107
 
108
.oEPU_Busy(wEPU_Busy),
109
.oEntryPoint( wCodeEntryPoint ),
110
.oTriggerIFU( wTriggerIFU ),
111
.oInstructionAddr( wEPU_IP )
112
 
113
);
114
 
115
InstructionFetch IFU
116
(
117
.Clock( Clock                                  ),
118
.Reset( Reset                                  ),
119
.iTrigger(              wTriggerIFU            ),
120
.iInstruction1(         iInstruction1          ),
121
.iInstruction2(         iInstruction2          ),
122
.iInitialCodeAddress(   wCodeEntryPoint        ),
123
.iBranchTaken(          w2FIU__BranchTaken     ),
124
.oCurrentInstruction(   CurrentInstruction     ),
125
.oInstructionAvalable(  wInstructionAvailable  ),
126
.oIP(                   wIFU_IP                ),
127
.oIP2(                  oInstructionPointer2   ),
128
.iEXEDone(              ALU2OutputReady        ),
129
.oMicroCodeReturnValue( oReturnCode            ),
130
.oExecutionDone(        oDone                  )
131
);
132
 
133
/*
134 22 diegovalve
InstructionFetchUnit    IFU
135
(
136
        .Clock( Clock ),
137
        .Reset( Reset ),
138 60 diegovalve
        .iTrigger( wTriggerIFU ),
139
        .iInitialCodeAddress( wCodeEntryPoint ),
140 22 diegovalve
        .oCurrentInstruction( CurrentInstruction ),
141
        .oInstructionAvalable( wInstructionAvailable ),
142 60 diegovalve
        .oInstructionPointer1( wIFU_IP ),
143
        .iInstruction1( iInstruction1 ),
144 22 diegovalve
        .oExecutionDone( oDone ),
145 60 diegovalve
        .iBranchTaken( w2FIU__BranchTaken ),
146 22 diegovalve
        .iBranchNotTaken( wALU2_IFU_BranchNotTaken ),
147
        .iJumpIp( JumpIp ),
148
        .iIDUBusy( wIDU2_IFU__IDUBusy ),
149
        .iExeBusy( wEXE2_IFU__EXEBusy ),
150
        .iDecodeUnitLatchedValues( wIDU2_IFU__InputsLatched ),
151
        .oMicroCodeReturnValue( oReturnCode )
152
 
153
);
154 60 diegovalve
*/
155 22 diegovalve
////---------------------------------------------------------
156
wire wIDU2_EXE_DataReady;
157
wire wEXE2_IDU_ExeLatchedValues;
158
 
159
InstructionDecode IDU
160
(
161
        .Clock( Clock ),
162
        .Reset( Reset ),
163
        .iEncodedInstruction( CurrentInstruction ),
164
        .iInstructionAvailable( wInstructionAvailable ),
165 60 diegovalve
 
166
        .oRamAddress0( oDataReadAddress0 ),
167
        .oRamAddress1( oDataReadAddress1 ),
168
        .iRamValue0( iDataRead0 ),
169
        .iRamValue1( iDataRead1 ),
170
 
171
        .iLastDestination( wEXE2_IDU_DataFordward_LastDestination ),
172
        .iDataForward( {ALU2ResultA,ALU2ResultB,ALU2ResultC} ),
173
 
174
        //Outputs going to the ALU-FSM
175
        .oOperation( wOperation ),
176
        .oDestination( wDestination ),
177
        .oSource0( wSource0 ),
178
        .oSource1( wSource1  ),
179
 
180
        `ifdef DEBUG
181
        .iDebug_CurrentIP( oInstructionPointer1 ),
182
        .oDebug_CurrentIP( wDEBUG_IDU2_EXE_InstructionPointer ),
183
        `endif
184
 
185
        .oDataReadyForExe( wIDU2_EXE_DataReady )
186
 
187
 
188
 
189
 
190
 
191
);
192
 
193 22 diegovalve
 
194
ExecutionFSM     EXE
195
(
196
        .Clock( Clock ),
197 72 diegovalve
        .Reset( Reset | iTrigger ),  //New Sat Jun13
198 22 diegovalve
        .iDecodeDone( wIDU2_EXE_DataReady ),
199
        .iOperation( wOperation ),
200
        .iDestination( wDestination ),
201
        .iSource0( wSource0 ),
202
        .iSource1( wSource1 ) ,
203
 
204
        `ifdef DEBUG
205
                .iDebug_CurrentIP( wDEBUG_IDU2_EXE_InstructionPointer ),
206
        `endif
207
 
208
        //.iJumpResultFromALU( wALU2_EXE__BranchTaken ),
209
        .iBranchTaken( wALU2_EXE__BranchTaken ),
210
        .iBranchNotTaken( wALU2_IFU_BranchNotTaken ),
211 60 diegovalve
        .oJumpFlag( w2FIU__BranchTaken ),
212 22 diegovalve
        .oJumpIp( JumpIp ),
213
        .oRAMWriteEnable( oDataWriteEnable ),
214
        .oRAMWriteAddress( oDataWriteAddress ),
215
        .RAMBus( oDataBus ),
216
        .oBusy( wEXE2_IFU__EXEBusy ),
217
 
218
        .oExeLatchedValues( wEXE2_IDU_ExeLatchedValues ),
219
        .oLastDestination( wEXE2_IDU_DataFordward_LastDestination ),
220
 
221
        //ALU ports and control signals
222
        .oTriggerALU( wEXE2_ALU__TriggerALU ),
223
        .oALUOperation( ALU2Operation ),
224
        .oALUChannelX1( ALU2ChannelA ),
225
        .oALUChannelX2( ALU2ChannelB ),
226
        .oALUChannelY1( ALU2ChannelC ),
227
        .oALUChannelY2( ALU2ChannelD ),
228
        .oALUChannelZ1( ALU2ChannelE ),
229
        .oALUChannelZ2( ALU2ChannelF ),
230
        .iALUResultX( ALU2ResultA ),
231
        .iALUResultY( ALU2ResultB ),
232
        .iALUResultZ( ALU2ResultC ),
233
        .iALUOutputReady( ALU2OutputReady )
234
 
235
);
236
 
237
 
238
//--------------------------------------------------------
239
 
240
VectorALU ALU
241
(
242
        .Clock(Clock),
243
        .Reset(Reset),
244
        .iOperation( ALU2Operation ),
245
        .iChannel_Ax( ALU2ChannelA ),
246
        .iChannel_Bx( ALU2ChannelB ),
247
        .iChannel_Ay( ALU2ChannelC ),
248
        .iChannel_By( ALU2ChannelD ),
249
        .iChannel_Az( ALU2ChannelE ),
250
        .iChannel_Bz( ALU2ChannelF ),
251
        .oResultA( ALU2ResultA ),
252
        .oResultB( ALU2ResultB ),
253
        .oResultC( ALU2ResultC ),
254
        .oBranchTaken( wALU2_EXE__BranchTaken ),
255
        .oBranchNotTaken( wALU2_IFU_BranchNotTaken ),
256
        .iInputReady( wEXE2_ALU__TriggerALU ),
257
        .OutputReady( ALU2OutputReady )
258
 
259
);
260
 
261
 
262
 
263
endmodule
264
//---------------------------------------------------------------------

powered by: WebSVN 2.1.0

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