-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathPrefetchTemplate.scala
More file actions
53 lines (45 loc) · 1.79 KB
/
PrefetchTemplate.scala
File metadata and controls
53 lines (45 loc) · 1.79 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
/** *************************************************************************************
* 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 chisel3._
import chisel3.util._
import org.chipsalliance.cde.config.Parameters
case class MyPrefetchParameters(
// TODO
) extends PrefetchParameters {
override val hasPrefetchBit: Boolean = true
override val hasPrefetchSrc: Boolean = true
override val inflightEntries: Int = 16 // TODO
override def toString: String = s"My prefetch :)"
}
trait HasMyPrefetchParams extends HasPrefetcherHelper {
def params = prefetchers.find {
case p: MyPrefetchParameters => true
case _ => false
}.get.asInstanceOf[MyPrefetchParameters]
// TODO
}
abstract class MyPrefetchModule(implicit val p: Parameters) extends Module with HasMyPrefetchParams
class MyPrefetch(implicit p: Parameters) extends MyPrefetchModule {
val io = IO(new L2PrefetchIO())
val addr = io.train.bits.addr + (1 << offsetBits).U
io <> DontCare
io.req.valid := io.train.valid
io.req.bits.tag := parseFullAddress(addr)._1
io.req.bits.set := parseFullAddress(addr)._2
io.train.ready := true.B
}