-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathPrefetchReceiver.scala
More file actions
61 lines (52 loc) · 2.28 KB
/
PrefetchReceiver.scala
File metadata and controls
61 lines (52 loc) · 2.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
/** *************************************************************************************
* Copyright (c) 2020-2021 Institute of Computing Technology, Chinese Academy of Sciences
* Copyright (c) 2020-2021 Peng Cheng Laboratory
*
* XiangShan is licensed under Mulan PSL v2.
* You can use this software according to the terms and conditions of the Mulan PSL v2.
* You may obtain a copy of Mulan PSL v2 at:
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
* EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
* *************************************************************************************
*/
package coupledL2.prefetch
import org.chipsalliance.cde.config.Parameters
import chisel3._
import chisel3.util._
import freechips.rocketchip.tilelink._
import coupledL2._
import utility.{Constantin, RegNextN}
// TODO: PrefetchReceiver is temporarily used since L1&L2 do not support Hint.
// TODO: Delete this after Hint is accomplished.
case class PrefetchReceiverParams(n: Int = 32) extends PrefetchParameters {
override val hasPrefetchBit: Boolean = true
override val hasPrefetchSrc: Boolean = true
override val inflightEntries: Int = n
override def toString: String = s"Receiver for prefetches from L1"
}
class PrefetchReceiver()(implicit p: Parameters) extends PrefetchModule {
val io = IO(new PrefetchIO())
val io_enable = IO(Input(Bool()))
// 0 / 1: whether to enable
private val cstEnable = Constantin.createRecord("pfRcv_enable"+cacheParams.hartId.toString, initValue = 1)
val enable = io_enable && cstEnable.orR
// just ignore train reqs
io.train.ready := true.B
io.resp.ready := true.B
io.req.bits.tag := parseFullAddress(io.recv_addr.bits.addr)._1
io.req.bits.set := parseFullAddress(io.recv_addr.bits.addr)._2
io.req.bits.vaddr.foreach(_ := 0.U)
io.req.bits.needT := false.B
io.req.bits.source := 0.U // TODO: ensure source 0 is dcache
io.req.bits.pfSource := io.recv_addr.bits.pfSource
io.req.valid := enable && io.recv_addr.valid
io.tlb_req.req.valid := false.B
io.tlb_req.req.bits := DontCare
io.tlb_req.req_kill := DontCare
io.tlb_req.resp.ready := true.B
}