@@ -23,7 +23,7 @@ import sideband._
23
23
*/
24
24
class UCITLFront (val tlParams : TileLinkParams , val protoParams : ProtocolLayerParams ,
25
25
val fdiParams : FdiParams )
26
- (implicit p : Parameters ) extends LazyModule {
26
+ (implicit p : Parameters ) extends ClockSinkDomain ( ClockSinkParameters ())(p) {
27
27
28
28
val device = new SimpleDevice (" ucie-front" , Seq (" ucie,ucie0" ))
29
29
@@ -49,40 +49,40 @@ class UCITLFront(val tlParams: TileLinkParams, val protoParams: ProtocolLayerPar
49
49
val clientNode : TLClientNode = TLClientNode (Seq (TLMasterPortParameters .v1(
50
50
Seq (TLMasterParameters .v1(
51
51
name = " ucie-client" ,
52
- sourceId = IdRange (0 , 32 ),
52
+ sourceId = IdRange (0 , 1 << tlParams.sourceIDWidth ),
53
53
requestFifo = true ,
54
54
visibility = Seq (AddressSet (tlParams.ADDRESS , tlParams.ADDR_RANGE ))
55
55
)))))
56
56
57
- lazy val module = new UCITLFrontImp (this )
58
- }
57
+ override lazy val module = new UCITLFrontImp
59
58
60
- class UCITLFrontImp ( outer : UCITLFront ) extends LazyModuleImp (outer) {
59
+ class UCITLFrontImp extends Impl {
61
60
val io = IO (new Bundle {
62
61
// val sbus_clk = Input(Clock()) // System bus clock
63
62
// val sbus_reset = Input(Bool()) // System bus reset
64
63
// val lclk = Input(Clock()) // lclk is the FDI signalling clock
65
64
// val lreset = Input(Bool()) // should the UCIe modules have its own reset?
66
- val fdi = new Fdi (outer. fdiParams)
65
+ val fdi = new Fdi (fdiParams)
67
66
})
67
+ withClockAndReset(clock, reset) {
68
68
69
69
val fault = RegInit (false .B ) // if fault in ecc code
70
70
71
71
// Instantiate the agnostic protocol layer
72
- val protocol = Module (new ProtocolLayer (outer. fdiParams))
72
+ val protocol = Module (new ProtocolLayer (fdiParams))
73
73
io.fdi <> protocol.io.fdi
74
74
protocol.io.fault := fault
75
75
76
76
// Hamming encode and decode
77
- val hammingEncoder = Module (new HammingEncode (outer. protoParams))
78
- val hammingDecoder = Module (new HammingDecode (outer. protoParams))
77
+ val hammingEncoder = Module (new HammingEncode (protoParams))
78
+ val hammingDecoder = Module (new HammingDecode (protoParams))
79
79
// Defaults
80
80
hammingEncoder.io.data := 0 .U
81
81
hammingDecoder.io.data := 0 .U
82
82
hammingDecoder.io.checksum := 0 .U
83
83
84
84
// Sideband node for protocol layer
85
- val protocol_sb_node = Module (new SidebandNode ((new SidebandParams ), outer. fdiParams))
85
+ val protocol_sb_node = Module (new SidebandNode ((new SidebandParams ), fdiParams))
86
86
87
87
protocol_sb_node.io.outer.rx.bits := protocol.io.fdi.lpConfig.bits
88
88
protocol_sb_node.io.outer.rx.valid := protocol.io.fdi.lpConfig.valid
@@ -92,33 +92,33 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
92
92
protocol.io.fdi.plConfig.valid := protocol_sb_node.io.outer.tx.valid
93
93
protocol_sb_node.io.outer.tx.credit := protocol.io.fdi.plConfigCredit
94
94
95
- protocol_sb_node.io.inner.layer_to_node.bits := Cat (outer. regNode.module.io.sb_csrs.sideband_mailbox_sw_to_node_data_high,
96
- outer. regNode.module.io.sb_csrs.sideband_mailbox_sw_to_node_data_low,
97
- outer. regNode.module.io.sb_csrs.sidebank_mailbox_sw_to_node_index_high,
98
- outer. regNode.module.io.sb_csrs.sideband_mailbox_sw_to_node_index_low)
99
- protocol_sb_node.io.inner.layer_to_node.valid := outer. regNode.module.io.sb_csrs.sideband_mailbox_sw_valid
95
+ protocol_sb_node.io.inner.layer_to_node.bits := Cat (regNode.module.io.sb_csrs.sideband_mailbox_sw_to_node_data_high,
96
+ regNode.module.io.sb_csrs.sideband_mailbox_sw_to_node_data_low,
97
+ regNode.module.io.sb_csrs.sidebank_mailbox_sw_to_node_index_high,
98
+ regNode.module.io.sb_csrs.sideband_mailbox_sw_to_node_index_low)
99
+ protocol_sb_node.io.inner.layer_to_node.valid := regNode.module.io.sb_csrs.sideband_mailbox_sw_valid
100
100
101
- outer. regNode.module.io.sb_csrs.sideband_mailbox_index_low := protocol_sb_node.io.inner.node_to_layer.bits(31 , 0 )
102
- outer. regNode.module.io.sb_csrs.sideband_mailbox_index_high := protocol_sb_node.io.inner.node_to_layer.bits(63 , 32 )
103
- outer. regNode.module.io.sb_csrs.sideband_mailbox_data_low := protocol_sb_node.io.inner.node_to_layer.bits(95 , 64 )
104
- outer. regNode.module.io.sb_csrs.sideband_mailbox_data_high := protocol_sb_node.io.inner.node_to_layer.bits(127 , 96 )
105
- protocol_sb_node.io.inner.node_to_layer.ready := outer. regNode.module.io.sb_csrs.sideband_mailbox_ready
106
- outer. regNode.module.io.sb_csrs.sideband_mailbox_valid := protocol_sb_node.io.inner.node_to_layer.valid
107
-
108
- val tlBundleParams = new TLBundleParameters (addressBits = outer. tlParams.addressWidth,
109
- dataBits = outer. tlParams.dataWidth,
110
- sourceBits = outer. tlParams.sourceIDWidth,
111
- sinkBits = outer. tlParams.sinkIDWidth,
112
- sizeBits = outer. tlParams.sizeWidth,
101
+ regNode.module.io.sb_csrs.sideband_mailbox_index_low := protocol_sb_node.io.inner.node_to_layer.bits(31 , 0 )
102
+ regNode.module.io.sb_csrs.sideband_mailbox_index_high := protocol_sb_node.io.inner.node_to_layer.bits(63 , 32 )
103
+ regNode.module.io.sb_csrs.sideband_mailbox_data_low := protocol_sb_node.io.inner.node_to_layer.bits(95 , 64 )
104
+ regNode.module.io.sb_csrs.sideband_mailbox_data_high := protocol_sb_node.io.inner.node_to_layer.bits(127 , 96 )
105
+ protocol_sb_node.io.inner.node_to_layer.ready := regNode.module.io.sb_csrs.sideband_mailbox_ready
106
+ regNode.module.io.sb_csrs.sideband_mailbox_valid := protocol_sb_node.io.inner.node_to_layer.valid
107
+
108
+ val tlBundleParams = new TLBundleParameters (addressBits = tlParams.addressWidth,
109
+ dataBits = tlParams.dataWidth,
110
+ sourceBits = tlParams.sourceIDWidth,
111
+ sinkBits = tlParams.sinkIDWidth,
112
+ sizeBits = tlParams.sizeWidth,
113
113
echoFields = Nil ,
114
114
requestFields = Nil ,
115
115
responseFields = Nil ,
116
116
hasBCE = false )
117
117
118
- val client_tl = outer. clientNode.out(0 )._1
119
- val client_edge = outer. clientNode.out(0 )._2
120
- val manager_tl = outer. managerNode.in(0 )._1
121
- val manager_edge = outer. managerNode.in(0 )._2
118
+ val client_tl = clientNode.out(0 )._1
119
+ val client_edge = clientNode.out(0 )._2
120
+ val manager_tl = managerNode.in(0 )._1
121
+ val manager_edge = managerNode.in(0 )._2
122
122
123
123
val clientParams = client_edge.bundle
124
124
val managerParams = manager_edge.bundle
@@ -139,21 +139,21 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
139
139
// The TX packets can be A request from manager node or D response from
140
140
// the client node. This needs to be arbitrated to be sent to partner die.
141
141
// =======================
142
- val txArbiter = Module (new Arbiter (new TLBundleAUnionD (outer. tlParams), 2 ))
143
- val txATLPayload = Wire (new TLBundleAUnionD (outer. tlParams))
144
- val txDTLPayload = Wire (new TLBundleAUnionD (outer. tlParams))
145
- // val txTLPayload = Wire(new TLBundleAUnionD(outer. tlParams))
142
+ val txArbiter = Module (new Arbiter (new TLBundleAUnionD (tlParams), 2 ))
143
+ val txATLPayload = Wire (new TLBundleAUnionD (tlParams))
144
+ val txDTLPayload = Wire (new TLBundleAUnionD (tlParams))
145
+ // val txTLPayload = Wire(new TLBundleAUnionD(tlParams))
146
146
147
147
val aHasData = manager_edge.hasData(manager_tl.a.bits)
148
148
val rx_fire = protocol.io.TLplData_valid
149
- val uciRxPayload = Wire (new UCIRawPayloadFormat (outer. tlParams, outer. protoParams)) // User-defined UCIe flit for streaming
150
- val uciTxPayload = Wire (new UCIRawPayloadFormat (outer. tlParams, outer. protoParams)) // User-defined UCIe flit for streaming
149
+ val uciRxPayload = Wire (new UCIRawPayloadFormat (tlParams, protoParams)) // User-defined UCIe flit for streaming
150
+ val uciTxPayload = Wire (new UCIRawPayloadFormat (tlParams, protoParams)) // User-defined UCIe flit for streaming
151
151
152
152
// defaults
153
- uciRxPayload := 0 .U .asTypeOf(new UCIRawPayloadFormat (outer. tlParams, outer. protoParams))
154
- uciTxPayload := 0 .U .asTypeOf(new UCIRawPayloadFormat (outer. tlParams, outer. protoParams))
155
- txATLPayload := 0 .U .asTypeOf(new TLBundleAUnionD (outer. tlParams))
156
- txDTLPayload := 0 .U .asTypeOf(new TLBundleAUnionD (outer. tlParams))
153
+ uciRxPayload := 0 .U .asTypeOf(new UCIRawPayloadFormat (tlParams, protoParams))
154
+ uciTxPayload := 0 .U .asTypeOf(new UCIRawPayloadFormat (tlParams, protoParams))
155
+ txATLPayload := 0 .U .asTypeOf(new TLBundleAUnionD (tlParams))
156
+ txDTLPayload := 0 .U .asTypeOf(new TLBundleAUnionD (tlParams))
157
157
158
158
/*
159
159
manager_tl.a.ready = (inward.io.enq.ready & ~protocol.io.fdi.lpStallAck &
@@ -191,7 +191,7 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
191
191
// Arbitrate the A and D channels from the credited msgs
192
192
creditedMsgA.io.out.ready := txArbiter.io.in(0 ).ready
193
193
txArbiter.io.in(0 ).valid := creditedMsgA.io.out.fire
194
- // txArbiter.io.in(0).bits <> creditedMsgA.io.out.bits.asTypeOf(new TLBundleAUnionD(outer. tlParams))
194
+ // txArbiter.io.in(0).bits <> creditedMsgA.io.out.bits.asTypeOf(new TLBundleAUnionD(tlParams))
195
195
txArbiter.io.in(0 ).bits.opcode := creditedMsgA.io.out.bits.opcode
196
196
txArbiter.io.in(0 ).bits.param := creditedMsgA.io.out.bits.param
197
197
txArbiter.io.in(0 ).bits.size := creditedMsgA.io.out.bits.size
@@ -204,7 +204,7 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
204
204
205
205
creditedMsgD.io.out.ready := txArbiter.io.in(1 ).ready
206
206
txArbiter.io.in(1 ).valid := creditedMsgD.io.out.fire
207
- // txArbiter.io.in(1).bits <> creditedMsgD.io.out.bits.asTypeOf(new TLBundleAUnionD(outer. tlParams))
207
+ // txArbiter.io.in(1).bits <> creditedMsgD.io.out.bits.asTypeOf(new TLBundleAUnionD(tlParams))
208
208
txArbiter.io.in(1 ).bits.opcode := creditedMsgD.io.out.bits.opcode
209
209
txArbiter.io.in(1 ).bits.param := creditedMsgD.io.out.bits.param
210
210
txArbiter.io.in(1 ).bits.size := creditedMsgD.io.out.bits.size
@@ -233,7 +233,7 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
233
233
val checksum_reg = RegInit (0 .U (64 .W ))
234
234
checksum_reg := hammingEncoder.io.checksum
235
235
236
- val tx_pipe = Module (new Pipe (new UCIRawPayloadFormat (outer. tlParams, outer. protoParams), 1 ))
236
+ val tx_pipe = Module (new Pipe (new UCIRawPayloadFormat (tlParams, protoParams), 1 ))
237
237
tx_pipe.io.enq.bits := uciTxPayload
238
238
tx_pipe.io.enq.valid := txArbiter.io.out.fire
239
239
// Dequeue the TX TL packets and translate to UCIe flit
@@ -252,8 +252,8 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
252
252
outwardA.io.credit.ready := tx_pipe.io.deq.valid && creditA
253
253
outwardD.io.credit.ready := tx_pipe.io.deq.valid && creditD
254
254
255
- val txACredit = WireDefault (0 .U (outer. protoParams.creditWidth.W ))
256
- val txDCredit = WireDefault (0 .U (outer. protoParams.creditWidth.W ))
255
+ val txACredit = WireDefault (0 .U (protoParams.creditWidth.W ))
256
+ val txDCredit = WireDefault (0 .U (protoParams.creditWidth.W ))
257
257
258
258
when(outwardA.io.credit.valid){
259
259
txACredit := outwardA.io.credit.bits
@@ -300,19 +300,19 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
300
300
// =======================
301
301
// TL RX packets coming from the UCIe stack to the System, push on the outward queue
302
302
// =======================
303
- val rxTLPayload = Wire (new TLBundleAUnionD (outer. tlParams))
304
- rxTLPayload := 0 .U .asTypeOf(new TLBundleAUnionD (outer. tlParams))
303
+ val rxTLPayload = Wire (new TLBundleAUnionD (tlParams))
304
+ rxTLPayload := 0 .U .asTypeOf(new TLBundleAUnionD (tlParams))
305
305
// protocol.io.fdi.lpData.irdy := outward.io.enq.ready
306
306
307
307
// map the uciRxPayload and the plData based on the uciPayload formatting
308
308
// map the uciRxPayload to the rxTLPayload TLBundle
309
309
when(rx_fire) {
310
310
// ucie cmd
311
- uciRxPayload.cmd := protocol.io.TLplData_bits (511 , 448 ).asTypeOf(new UCICmdFormat (outer. protoParams))
311
+ uciRxPayload.cmd := protocol.io.TLplData_bits (511 , 448 ).asTypeOf(new UCICmdFormat (protoParams))
312
312
// ucie header 1
313
- uciRxPayload.header1 := protocol.io.TLplData_bits (447 ,384 ).asTypeOf(new UCIHeader1Format (outer. tlParams))
313
+ uciRxPayload.header1 := protocol.io.TLplData_bits (447 ,384 ).asTypeOf(new UCIHeader1Format (tlParams))
314
314
// ucie header 2
315
- uciRxPayload.header2 := protocol.io.TLplData_bits (383 , 320 ).asTypeOf(new UCIHeader2Format (outer. tlParams))
315
+ uciRxPayload.header2 := protocol.io.TLplData_bits (383 , 320 ).asTypeOf(new UCIHeader2Format (tlParams))
316
316
// ucie data payload
317
317
uciRxPayload.data(3 ) := protocol.io.TLplData_bits (319 ,256 )
318
318
uciRxPayload.data(2 ) := protocol.io.TLplData_bits (255 ,192 )
@@ -372,6 +372,6 @@ class UCITLFrontImp(outer: UCITLFront) extends LazyModuleImp(outer) {
372
372
373
373
// soft resets: can be reset or flush and reset, in flush and reset, the packets are
374
374
// sent out before triggering reset
375
- protocol.io.soft_reset := (outer. regNode.module.io.d2d_csrs.d2d_state_can_reset |
376
- outer. regNode.module.io.d2d_csrs.d2d_flush_and_reset)
377
- }
375
+ protocol.io.soft_reset := (regNode.module.io.d2d_csrs.d2d_state_can_reset |
376
+ regNode.module.io.d2d_csrs.d2d_flush_and_reset)
377
+ }}}
0 commit comments