VfcHdApplication.v 8.32 KB
Newer Older
1
2
3
`timescale 1ns/100ps 

module VfcHdApplication   
4
5
#(parameter g_ApplicationVersion_b8	     = 8'hC5,
            g_ApplicationReleaseDay_b8 	 = 8'h17, 
Manoel Barros Marin's avatar
Manoel Barros Marin committed
6
            g_ApplicationReleaseMonth_b8 = 8'h07, 
7
            g_ApplicationReleaseYear_b8  = 8'h16)   
8
9
10
11
(	
//@@@@@@@@@@@@@@@@@@@@@@@@@
//External connections
//@@@@@@@@@@@@@@@@@@@@@@@@@
12
13
14
15
16
17
18
19
20
21
22
23
   input         BstSfpRx_i, // Comment: Differential signal
   output        BstSfpTx_o, // Comment: Differential signal
   input         EthSfpRx_i, // Comment: Differential signal
   output        EthSfpTx_o, // Comment: Differential signal
   // SFP Gbit:
   input  [ 4:1] AppSfpRx_ib4, // Comment: Differential signal
   output [ 4:1] AppSfpTx_ob4, // Comment: Differential signal
   // DDR3 SO-DIMM:
   output [ 2:0] DdrBa_ob3,
   output [ 7:0] DdrDm_ob8,
   inout  [ 7:0] DdrDqs_iob8, // Comment: Differential signal
   inout  [63:0] DdrDq_iob64,
24
   output [15:0] DdrA_ob16,
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
   output [ 1:0] DdrCk_okb2,  // Comment: Differential signal
   output [ 1:0] DdrCkE_ohb2,
   output        DdrReset_orn, 
   output        DdrRas_on,
   output        DdrCas_on,
   output        DdrWe_on,
   output [ 1:0] DdrCs_onb2,
   output [ 1:0] DdrOdt_ob2,
   input         DdrTempEvent_in,
   output        DdrI2cScl_ok,
   inout         DdrI2cSda_io,
   // TestIo:
   inout         TestIo1_io,
   inout         TestIo2_io, 
   // FMC connector:
40
   output        VfmcEnableN_oen,
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
   inout  [33:0] FmcLaP_iob34,
   inout  [33:0] FmcLaN_iob34,
   inout  [23:0] FmcHaP_iob24,
   inout  [23:0] FmcHaN_iob24,   
   inout  [21:0] FmcHbP_iob22,
   inout  [21:0] FmcHbN_iob22,
   input         FmcPrsntM2C_in, 
   output        FmcTck_ok,
   output        FmcTms_o,
   output        FmcTdi_o,
   input         FmcTdo_i,
   output        FmcTrstL_orn,
   inout         FmcScl_iok,
   inout         FmcSda_io,
   input         FmcPgM2C_in,
   output        FmcPgC2M_on, 
   input         FmcClk0M2CCmos_ik,
   input         FmcClk1M2CCmos_ik,
   inout         FmcClk2Bidir_iok, // Comment: Differential signal
   inout         FmcClk3Bidir_iok, // Comment: Differential signal
   input         FmcClkDir_i,
   output [ 9:0] FmcDpC2M_ob10, // Comment: Differential signal
   input  [ 9:0] FmcDpM2C_ib10,
   input         FmcGbtClk0M2CLeft_ik,  // Comment: Differential signal
   input         FmcGbtClk1M2CLeft_ik,  // Comment: Differential signal
   input         FmcGbtClk0M2CRight_ik, // Comment: Differential signal
   input         FmcGbtClk1M2CRight_ik, // Comment: Differential signal  
   // Clock sources and control:
   output        OeSi57x_oe,
   input         Si57xClk_ik,
   output        ClkFb_ok,
   input         ClkFb_ik,
   input         Clk20VCOx_ik,
   output        PllDac20Sync_o,
   output        PllDac25Sync_o,
   output        PllDacSclk_ok,
   output        PllDacDin_o,  
   output        PllRefScl_ok,
   inout         PllRefSda_io,
   input         PllRefInt_i,
   output        PllSourceMuxOut_ok,
   input         PllRefClkOut_ik,   // Comment: Differential reference for the Gbit lines
   input         GbitTrxClkRefR_ik, // Comment: Differential reference for the Gbit lines ~125MHz
   // SW1:
   input  [ 1:0] Switch_ib2,
   // P2 RTM:
   inout  [19:0] P2DataP_iob20, //Comment: The 0 is a clock capable input
   inout  [19:0] P2DataN_iob20,
   // P0 Timing:
   input  [ 7:0] P0HwHighByte_ib8,
   input  [ 7:0] P0HwLowByte_ib8,
   output        DaisyChain1Cntrl_o,
   output        DaisyChain2Cntrl_o,
   input         VmeP0BunchClk_ik,
   input         VmeP0Tclk_ik,
   // GPIO:
   inout  [ 4:1] GpIo_iob4,
   // Specials:
   input         PushButtonN_in,
100
101
102
//@@@@@@@@@@@@@@@@@@@@@@@@@
//System-Application interface
//@@@@@@@@@@@@@@@@@@@@@@@@@ 
103
104
105
106
107
108
109
110
111
112
   // Reset:
   input         Reset_irqp,       // Comment: Reset Synchronous with the WbClk_ik
   output        ResetRequest_oqp, // Comment: Request to issue a reset 
   // WishBone:
   output        WbClk_ok,
   input         WbSlaveCyc_i,
   input         WbSlaveStb_i,
   input  [24:0] WbSlaveAdr_ib25,
   input         WbSlaveWr_i,
   input  [31:0] WbSlaveDat_ib32,
113
   output [31:0] WbSlaveDat_ob32,
114
115
116
   output        WbSlaveAck_o,   
   output        WbMasterCyc_o,
   output        WbMasterStb_o,
117
   output [24:0] WbMasterAdr_ob25,
118
   output        WbMasterWr_o,
119
   output [31:0] WbMasterDat_ob32,
120
121
122
123
124
125
126
   input  [31:0] WbMasterDat_ib32,
   input         WbMasterAck_i,
   // LED control:
   output [ 1:0] TopLed_ob2,
   output [ 3:0] BottomLed_ob4,
   // BST input:
   input         BstOn_i,
127
128
129
130
   input         BstClk_ik, // Comment: 160 MHz
   input         BunchClkFlag_i,
   input         TurnClkFlag_i,
   input  [ 7:0] BstByteAddress_ib8,
131
   input  [ 7:0] BstByte_ib8,
132
133
   output        BstByteStrobe_i,
   output        BstByteError_i,   
134
   // Interrupt:
135
   output [23:0] InterruptRequest_opb24,
136
137
   // Ethernet streamer:
   output        StreamerClk_ok,
138
   output [31:0] StreamerData_ob32,
139
140
141
142
143
144
145
   output        SreamerDav_o,
   output        StreamerPckt_o,
   input         StreamerWait_i,  
   // GPIO direction:
   output        GpIo1DirOut_o,
   output        GpIo2DirOut_o,
   output        GpIo34DirOut_o   
146
147
148
149
150
151
);

//****************************
//Declarations
//****************************

152
wire        Clk_k;
153

154
wire        WbStbAppReleaseId, WbAckAppReleaseId;
155
wire [31:0] WbDatAppReleaseId_b32;
156
wire        WbStbCtrlReg, WbAckCtrlReg;
157
wire [31:0] WbDatCtrlReg_b32;
158
wire        WbStbStatReg, WbAckStatReg;
159
160
161
wire [31:0] WbDatStatReg_b32;

wire [31:0] Reg0Value_b32;
162
163
164
165
166
167
168
169
170
171
172

//****************************
//Fixed assignments
//****************************

assign OeSi57x_oe = 1'b1;

//****************************
//Clocking
//****************************

173
assign Clk_k    = GbitTrxClkRefR_ik; //~125MHz
174
175
176
177
178
179
180
assign WbClk_ok = Clk_k;

//****************************
//WB address decoder
//****************************

AddrDecoderWBApp i_AddrDecoderWbApp( 
181
182
183
184
185
    .Clk_ik               (Clk_k),
    .Adr_ib21             (WbSlaveAdr_ib25[20:0]),
    .Stb_i                (WbSlaveStb_i),
    .Dat_ob32             (WbSlaveDat_ob32),
    .Ack_o                (WbSlaveAck_o),
186
    //--
187
188
189
    .DatAppReleaseId_ib32 (WbDatAppReleaseId_b32),
    .AckAppReleaseId_i    (WbAckAppReleaseId),
    .StbAppReleaseId_o    (WbStbAppReleaseId),
190
    //--
191
192
193
    .DatCtrlReg_ib32      (WbDatCtrlReg_b32),
    .AckCtrlReg_i         (WbAckCtrlReg),
    .StbCtrlReg_o         (WbStbCtrlReg),
194
    //--
195
196
197
    .DatStatReg_ib32      (WbDatStatReg_b32),
    .AckStatReg_i         (WbAckStatReg),
    .StbStatReg_o         (WbStbStatReg));    
198
199

//****************************
200
//Release ID
201
202
//****************************

203
204
205
206
207
208
209
210
211
212
213
214
Generic4InputRegs i_AppReleaseId(
    .Rst_irq        (Reset_irqp),
    .Clk_ik         (Clk_k),
    .Cyc_i          (WbSlaveCyc_i),
    .Stb_i          (WbStbAppReleaseId),
    .Adr_ib2        (WbSlaveAdr_ib25[1:0]),
    .Dat_oab32      (WbDatAppReleaseId_b32),
    .Ack_oa         (WbAckAppReleaseId),
    .Reg0Value_ib32 ("VFC-"),
    .Reg1Value_ib32 ("HD b"),
    .Reg2Value_ib32 ("ase "),
    .Reg3Value_ib32 ({g_ApplicationVersion_b8, g_ApplicationReleaseDay_b8, g_ApplicationReleaseMonth_b8, g_ApplicationReleaseYear_b8}));
215
216

//****************************
217
//Example registers
218
219
//****************************

220
//Control register bank:
221
222
Generic4OutputRegs  #(  
    .Reg0Default     (32'hBABEB00B), 
223
    .Reg0AutoClrMask (32'hFFFFFFFF), 
Manoel Barros Marin's avatar
Manoel Barros Marin committed
224
    .Reg1Default     (32'h00000000),
225
    .Reg1AutoClrMask (32'hFFFFFFFF), 
Manoel Barros Marin's avatar
Manoel Barros Marin committed
226
    .Reg2Default     (32'h00000000),
227
    .Reg2AutoClrMask (32'hFFFFFFFF), 
Manoel Barros Marin's avatar
Manoel Barros Marin committed
228
    .Reg3Default     (32'h00000000),
229
    .Reg3AutoClrMask (32'hFFFFFFFF))
230
231
i_ControlRegs (
    .Clk_ik          (Clk_k),
232
    .Rst_irq         (Reset_irqp),
233
234
235
236
237
238
239
240
241
    .Cyc_i           (WbSlaveCyc_i),
    .Stb_i           (WbStbCtrlReg),
    .We_i            (WbSlaveWr_i),
    .Adr_ib2         (WbSlaveAdr_ib25[1:0]),
    .Dat_ib32        (WbSlaveDat_ib32),
    .Dat_oab32       (WbDatCtrlReg_b32),
    .Ack_oa          (WbAckCtrlReg),
    //--
    .Reg0Value_ob32  (Reg0Value_b32),
Manoel Barros Marin's avatar
Manoel Barros Marin committed
242
243
244
    .Reg1Value_ob32  (),
    .Reg2Value_ob32  (),
    .Reg3Value_ob32  ());
245

246
//Status registers bank:
247
Generic4InputRegs i_StatusRegs  (
248
249
250
251
252
253
254
    .Clk_ik         (Clk_k),
    .Rst_irq        (Reset_irqp),
    .Cyc_i          (WbSlaveCyc_i),
    .Stb_i          (WbStbStatReg),
    .Adr_ib2        (WbSlaveAdr_ib25[1:0]),
    .Dat_oab32      (WbDatStatReg_b32),
    .Ack_oa         (WbAckStatReg),
255
    //--          
256
257
258
259
    .Reg0Value_ib32 (Reg0Value_b32),
    .Reg1Value_ib32 (32'hCAFEAC1D),
    .Reg2Value_ib32 (32'hACDCDEAD),
    .Reg3Value_ib32 (32'hFEEDBEEF)); 
260
261
    
endmodule