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 86

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 76 diegovalve
output wire                            oReturnCode,
47
 
48
`ifdef DEBUG
49
input wire [`MAX_CORES-1:0]            iDebug_CoreID,
50
`endif
51 22 diegovalve
output wire                            oDone
52
 
53
 
54
 
55
 
56
);
57
 
58
 
59
`ifdef DEBUG
60
        wire [`ROM_ADDRESS_WIDTH-1:0] wDEBUG_IDU2_EXE_InstructionPointer;
61
`endif
62
 
63
wire                                                                            wEXE2__uCodeDone;
64
wire                                                                            wEXE2_IFU__EXEBusy;
65
wire [`DATA_ADDRESS_WIDTH-1:0]   wEXE2_IDU_DataFordward_LastDestination;
66
wire                                                                            wALU2_EXE__BranchTaken;
67
wire                                                                            wALU2_IFU_BranchNotTaken;
68
wire [`INSTRUCTION_WIDTH-1:0]    CurrentInstruction;
69 60 diegovalve
//wire                                                                          wIDU2_IFU__IDUBusy;
70 22 diegovalve
 
71
 
72
wire [`INSTRUCTION_OP_LENGTH-1:0]                                wOperation;
73
 
74
 
75
wire [`DATA_ROW_WIDTH-1:0] wSource0,wSource1;
76
wire [`DATA_ADDRESS_WIDTH-1:0] wDestination;
77
wire wInstructionAvailable;
78
 
79
//ALU wires
80
wire [`INSTRUCTION_OP_LENGTH-1:0]                ALU2Operation;
81
wire [`WIDTH-1:0]                                        ALU2ChannelA;
82
wire [`WIDTH-1:0]                                        ALU2ChannelB;
83
wire [`WIDTH-1:0]                                        ALU2ChannelC;
84
wire [`WIDTH-1:0]                                        ALU2ChannelD;
85
wire [`WIDTH-1:0]                                        ALU2ChannelE;
86
wire [`WIDTH-1:0]                                        ALU2ChannelF;
87
wire [`WIDTH-1:0]                                        ALU2ResultA;
88
wire [`WIDTH-1:0]                                        ALU2ResultB;
89
wire [`WIDTH-1:0]                                        ALU2ResultC;
90
wire                                                                            wEXE2_ALU__TriggerALU;
91
wire                                                                            ALU2OutputReady;
92 60 diegovalve
wire                                                                            w2FIU__BranchTaken;
93 22 diegovalve
wire    [`ROM_ADDRESS_WIDTH-1:0] JumpIp;
94
 
95
 
96 60 diegovalve
//wire wIDU2_IFU__InputsLatched;        
97
 
98
wire wEPU_Busy,wTriggerIFU;
99
wire [`ROM_ADDRESS_WIDTH-1:0] wEPU_IP,wIFU_IP,wCodeEntryPoint;
100
 
101
assign oInstructionPointer1 = (wEPU_Busy) ? wEPU_IP : wIFU_IP;
102
 
103
 
104
InstructionEntryPoint EPU
105
(
106
.Clock( Clock ),
107
.Reset( Reset ),
108
.iTrigger( iTrigger ),
109
.iInitialCodeAddress( iInitialCodeAddress ),
110
.iIMemInput(iInstruction1),
111
 
112
.oEPU_Busy(wEPU_Busy),
113
.oEntryPoint( wCodeEntryPoint ),
114
.oTriggerIFU( wTriggerIFU ),
115
.oInstructionAddr( wEPU_IP )
116
 
117
);
118
 
119
InstructionFetch IFU
120
(
121
.Clock( Clock                                  ),
122
.Reset( Reset                                  ),
123
.iTrigger(              wTriggerIFU            ),
124
.iInstruction1(         iInstruction1          ),
125
.iInstruction2(         iInstruction2          ),
126
.iInitialCodeAddress(   wCodeEntryPoint        ),
127
.iBranchTaken(          w2FIU__BranchTaken     ),
128
.oCurrentInstruction(   CurrentInstruction     ),
129
.oInstructionAvalable(  wInstructionAvailable  ),
130
.oIP(                   wIFU_IP                ),
131
.oIP2(                  oInstructionPointer2   ),
132
.iEXEDone(              ALU2OutputReady        ),
133
.oMicroCodeReturnValue( oReturnCode            ),
134
.oExecutionDone(        oDone                  )
135
);
136
 
137 22 diegovalve
////---------------------------------------------------------
138
wire wIDU2_EXE_DataReady;
139
wire wEXE2_IDU_ExeLatchedValues;
140
 
141
InstructionDecode IDU
142
(
143
        .Clock( Clock ),
144
        .Reset( Reset ),
145
        .iEncodedInstruction( CurrentInstruction ),
146
        .iInstructionAvailable( wInstructionAvailable ),
147 60 diegovalve
 
148
        .oRamAddress0( oDataReadAddress0 ),
149
        .oRamAddress1( oDataReadAddress1 ),
150
        .iRamValue0( iDataRead0 ),
151
        .iRamValue1( iDataRead1 ),
152
 
153
        .iLastDestination( wEXE2_IDU_DataFordward_LastDestination ),
154
        .iDataForward( {ALU2ResultA,ALU2ResultB,ALU2ResultC} ),
155
 
156
        //Outputs going to the ALU-FSM
157
        .oOperation( wOperation ),
158
        .oDestination( wDestination ),
159
        .oSource0( wSource0 ),
160
        .oSource1( wSource1  ),
161
 
162
        `ifdef DEBUG
163
        .iDebug_CurrentIP( oInstructionPointer1 ),
164
        .oDebug_CurrentIP( wDEBUG_IDU2_EXE_InstructionPointer ),
165
        `endif
166
 
167
        .oDataReadyForExe( wIDU2_EXE_DataReady )
168
 
169
 
170
 
171
 
172
 
173
);
174
 
175 22 diegovalve
 
176
ExecutionFSM     EXE
177
(
178
        .Clock( Clock ),
179 72 diegovalve
        .Reset( Reset | iTrigger ),  //New Sat Jun13
180 22 diegovalve
        .iDecodeDone( wIDU2_EXE_DataReady ),
181
        .iOperation( wOperation ),
182
        .iDestination( wDestination ),
183
        .iSource0( wSource0 ),
184
        .iSource1( wSource1 ) ,
185
 
186
        `ifdef DEBUG
187 76 diegovalve
                .iDebug_CurrentIP( wDEBUG_IDU2_EXE_InstructionPointer ),
188
                .iDebug_CoreID( iDebug_CoreID ),
189 22 diegovalve
        `endif
190
 
191
        //.iJumpResultFromALU( wALU2_EXE__BranchTaken ),
192
        .iBranchTaken( wALU2_EXE__BranchTaken ),
193
        .iBranchNotTaken( wALU2_IFU_BranchNotTaken ),
194 60 diegovalve
        .oJumpFlag( w2FIU__BranchTaken ),
195 22 diegovalve
        .oJumpIp( JumpIp ),
196
        .oRAMWriteEnable( oDataWriteEnable ),
197
        .oRAMWriteAddress( oDataWriteAddress ),
198
        .RAMBus( oDataBus ),
199
        .oBusy( wEXE2_IFU__EXEBusy ),
200
 
201
        .oExeLatchedValues( wEXE2_IDU_ExeLatchedValues ),
202
        .oLastDestination( wEXE2_IDU_DataFordward_LastDestination ),
203
 
204
        //ALU ports and control signals
205
        .oTriggerALU( wEXE2_ALU__TriggerALU ),
206
        .oALUOperation( ALU2Operation ),
207
        .oALUChannelX1( ALU2ChannelA ),
208
        .oALUChannelX2( ALU2ChannelB ),
209
        .oALUChannelY1( ALU2ChannelC ),
210
        .oALUChannelY2( ALU2ChannelD ),
211
        .oALUChannelZ1( ALU2ChannelE ),
212
        .oALUChannelZ2( ALU2ChannelF ),
213
        .iALUResultX( ALU2ResultA ),
214
        .iALUResultY( ALU2ResultB ),
215
        .iALUResultZ( ALU2ResultC ),
216
        .iALUOutputReady( ALU2OutputReady )
217
 
218
);
219
 
220
 
221
//--------------------------------------------------------
222
 
223
VectorALU ALU
224
(
225
        .Clock(Clock),
226
        .Reset(Reset),
227
        .iOperation( ALU2Operation ),
228
        .iChannel_Ax( ALU2ChannelA ),
229
        .iChannel_Bx( ALU2ChannelB ),
230
        .iChannel_Ay( ALU2ChannelC ),
231
        .iChannel_By( ALU2ChannelD ),
232
        .iChannel_Az( ALU2ChannelE ),
233
        .iChannel_Bz( ALU2ChannelF ),
234
        .oResultA( ALU2ResultA ),
235
        .oResultB( ALU2ResultB ),
236
        .oResultC( ALU2ResultC ),
237
        .oBranchTaken( wALU2_EXE__BranchTaken ),
238
        .oBranchNotTaken( wALU2_IFU_BranchNotTaken ),
239
        .iInputReady( wEXE2_ALU__TriggerALU ),
240
        .OutputReady( ALU2OutputReady )
241
 
242
);
243
 
244
 
245
 
246
endmodule
247
//---------------------------------------------------------------------

powered by: WebSVN 2.1.0

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