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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [beta_2.0/] [rtl/] [Module_IO_Station.v] - Blame information for rev 230

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 213 diegovalve
`include "aDefinitions.v"
2
 
3
 
4 230 diegovalve
/**********************************************************************************
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 213 diegovalve
***********************************************************************************/
23
 
24
 
25
module IO_STATION
26
(
27
   input wire Clock,
28
   input wire Reset,
29
   input wire [`MOD_ISSUE_PACKET_SIZE-1:0]                   iIssueBus,
30
   input wire [`MOD_COMMIT_PACKET_SIZE-1:0]                  iCommitBus,
31
        input wire [3:0]                                          iId,
32
        output wire [`COMMIT_PACKET_SIZE-1:0]                     oCommitData,
33
        output wire                                               oCommitResquest,
34
        input wire                                                iCommitGranted,
35
        output wire                                               oBusy,
36 230 diegovalve
        //OMEM
37
   output wire [`DATA_ROW_WIDTH-1:0]                         oOMEMWriteAddress,
38
   output wire [`DATA_ROW_WIDTH-1:0]                         oOMEMWriteData,
39
   output wire                                               oOMEMWriteEnable,
40
        //TMEM
41
        output wire [`DATA_ROW_WIDTH-1:0]                         oTMEMReadAddress,         //3 * 32 addresses to read from TMEM
42
        input wire [`DATA_ROW_WIDTH-1:0]                          iTMEMReadData,            //Contains the data read from the TMEM, 3 * 32 bit words
43
        input wire                                                iTMEMDataAvailable,                   //This is set to one once the TMEM read transaction is complete
44
   output wire                                               oTMEMDataRequest          //Set to one to indicate a TMEM read request
45 213 diegovalve
 
46
);
47
 
48
wire                           wExeDone;
49
wire [2:0]                     wExeDoneTmp;
50
wire                           wRS_OMWRITE_Trigger;
51
wire [`DATA_ROW_WIDTH-1:0]     wRS1_OperandA;
52
wire [`DATA_ROW_WIDTH-1:0]     wRS1_OperandB;
53
wire                           wCommitGranted;
54
 
55 230 diegovalve
wire [2:0]                     wIOOperation;
56
wire                           wIOTrigger,wIOTrigger_Pre;
57
wire                           ReadInProgress_Delay;
58
wire                           wExeDone_pre1,wExeDone_pre2,wExeDone_pre3,wExeDone_pre4;
59
wire                           wCommitResquest;
60
 
61
//assign oTMEMDataRequest    = (wIOTrigger && wIOOperation == `IO_OPERATION_TMREAD ) ? wIOTrigger : 1'b0;
62
wire ReadInProgress;
63
assign ReadInProgress = (wIOOperation == `IO_OPERATION_TMREAD) ? 1'b1 : 1'b0;
64
 
65
assign oTMEMDataRequest    = ((wIOTrigger | ~iTMEMDataAvailable) & ReadInProgress ) ? 1'b1:1'b0;//wIOTrigger : 1'b0;
66
 
67
 
68
assign oTMEMReadAddress    = wRS1_OperandA;             //Three separate 32 bit addresses comes here, for 3 addresses
69
 
70
 
71
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) WOP_FFD0 //TODO: This should be 1 bit
72
(       Clock, Reset, 1'b1 , wIOTrigger_Pre | wExeDone_pre1 | wExeDone_pre2, wIOTrigger );
73
 
74
 
75
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) WOP_CR //TODO: This should be 1 bit
76
(       Clock, Reset, ReadInProgress , wCommitResquest, oCommitResquest );
77
///////////////////////////
78
//
79
// wIOOperation     
80
//  000             OMEM
81
//  001             TMEM
82
//  010             MAILBOX
83
//  
84
///////////////////////////
85
wire wBusy;
86
 
87
ReservationStation_EX RS_EX
88 213 diegovalve
(
89 230 diegovalve
        .Clock(              Clock                           ),
90 213 diegovalve
        .Reset(              Reset                           ),
91
        .iIssueBus(          iIssueBus                       ),
92
        .iCommitBus(         iCommitBus                      ),
93
        .iMyId(              iId                             ),
94
        .iExecutionDone(     wExeDone                        ),
95 230 diegovalve
        .iResult(            iTMEMReadData                   ),
96 213 diegovalve
        .iCommitGranted(     wCommitGranted                  ),
97
        .oSrc1Latched(       wRS1_OperandB                   ),
98
        .oSrc0Latched(       wRS1_OperandA                   ),
99 230 diegovalve
        .oBusy(              wBusy                           ),
100
        .oScale(             wIOOperation                    ),
101
        .oTrigger(           wIOTrigger_Pre                  ),
102
        ///
103
        .oCommitRequest(     wCommitResquest                 ),
104
        .oId(              oCommitData[`COMMIT_RSID_RNG]                                 ),
105
        .oWE(              oCommitData[`COMMIT_WE_RNG]                                   ),
106
        .oDestination(     oCommitData[`COMMIT_DST_RNG]                                  ),
107
        .oResult(          {oCommitData[`X_RNG],oCommitData[`Y_RNG],oCommitData[`Z_RNG]} )
108
 
109 213 diegovalve
 
110
 
111
);
112
 
113 230 diegovalve
assign oBusy = (ReadInProgress)? /*oTMEMDataRequest*/ ~iTMEMDataAvailable : wBusy; /// | wIOTrigger_Pre |  wExeDone_pre1 | wExeDone_pre2 | wExeDone;
114 213 diegovalve
 
115 230 diegovalve
//assign oCommitResquest      = 1'b0;                             //This is always zero since we are not writting anything into the RF
116
//assign oCommitData          = `COMMIT_PACKET_SIZE'd0;    //This is always zero since we are not writting anything into the RF
117
assign oOMEMWriteEnable     = (wIOTrigger && wIOOperation == `IO_OPERATION_OMWRITE ) ? wIOTrigger : 1'b0;
118 213 diegovalve
 
119 230 diegovalve
FFD_POSEDGE_SYNCRONOUS_RESET # ( 96 ) FFD_SRC0
120
(       Clock, Reset, wIOTrigger_Pre , wRS1_OperandA, oOMEMWriteData );
121 213 diegovalve
 
122 230 diegovalve
FFD_POSEDGE_SYNCRONOUS_RESET # ( 96 ) FFD_SRC1
123
(       Clock, Reset, wIOTrigger_Pre , wRS1_OperandB, oOMEMWriteAddress );
124
 
125
 
126
//assign oOMEMWriteData    = wRS1_OperandA;             //Write 96 bits to external memory OMEM
127
//assign oOMEMWriteAddress = wRS1_OperandB;             //Each 32 bit words has the write address
128
 
129
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) DONE_FFD0
130
(       Clock, Reset, 1'b1 , wIOTrigger_Pre | wExeDone_pre1 | wExeDone_pre2, wIOTrigger );
131
 
132 213 diegovalve
//It takes 3 clock cycles to write the 96 bits into OMEM
133
 
134 230 diegovalve
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) DONE_FFD1
135
(       Clock, Reset, 1'b1 , wIOTrigger_Pre, wExeDone_pre1 );
136
 
137
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) DONE_FFD2
138 213 diegovalve
(       Clock, Reset, 1'b1 , wExeDone_pre1, wExeDone_pre2 );
139
 
140 230 diegovalve
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) DONE_FFD3
141
(       Clock, Reset, 1'b1 , wExeDone_pre2, wExeDone_pre3 );
142 213 diegovalve
 
143 230 diegovalve
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) DONE_FFD4
144
(       Clock, Reset, 1'b1 , wExeDone_pre3, wExeDone_pre4 );
145 213 diegovalve
 
146 230 diegovalve
FFD_POSEDGE_SYNCRONOUS_RESET # ( 1 ) DONE_FFD5
147
(       Clock, Reset, 1'b1 ,oTMEMDataRequest , ReadInProgress_Delay );
148
 
149
assign wExeDone = (ReadInProgress_Delay) ? iTMEMDataAvailable : wExeDone_pre3;
150
assign wCommitGranted = (ReadInProgress_Delay) ? wExeDone : wExeDone_pre4;
151
//assign wCommitGranted = wExeDone;
152
 
153 213 diegovalve
endmodule

powered by: WebSVN 2.1.0

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