@@ -22,6 +22,9 @@ case class BootROMParams(
22
22
address : BigInt = 0x10000 ,
23
23
size : Int = 0x10000 ,
24
24
hang : BigInt = 0x10040 , // The hang parameter is used as the power-on reset vector
25
+ driveResetVector : Boolean = true ,
26
+ appendDTB : Boolean = true ,
27
+ name : String = " bootrom" ,
25
28
contentFileName : String )
26
29
27
30
class TLROM (val base : BigInt , val size : Int , contentsDelayed : => Seq [Byte ], executable : Boolean = true , beatBytes : Int = 4 ,
@@ -63,7 +66,7 @@ class TLROM(val base: BigInt, val size: Int, contentsDelayed: => Seq[Byte], exec
63
66
}
64
67
}
65
68
66
- case class BootROMLocated (loc : HierarchicalLocation ) extends Field [Option [BootROMParams ]](None )
69
+ case class BootROMLocated (loc : HierarchicalLocation ) extends Field [Seq [BootROMParams ]](Nil )
67
70
68
71
object BootROM {
69
72
/** BootROM.attach not only instantiates a TLROM and attaches it to the tilelink interconnect
@@ -73,27 +76,33 @@ object BootROM {
73
76
def attach (params : BootROMParams , subsystem : BaseSubsystem with HasHierarchicalElements with HasTileInputConstants , where : TLBusWrapperLocation )
74
77
(implicit p : Parameters ): TLROM = {
75
78
val tlbus = subsystem.locateTLBusWrapper(where)
76
- val bootROMDomainWrapper = tlbus.generateSynchronousDomain(" BootROM " ).suggestName(" bootrom_domain " )
79
+ val bootROMDomainWrapper = tlbus.generateSynchronousDomain(params.name ).suggestName(s " ${params.name} _domain " )
77
80
78
81
val bootROMResetVectorSourceNode = BundleBridgeSource [UInt ]()
79
82
lazy val contents = {
80
83
val romdata = Files .readAllBytes(Paths .get(params.contentFileName))
81
84
val rom = ByteBuffer .wrap(romdata)
82
- rom.array() ++ subsystem.dtb.contents
85
+ if (params.appendDTB) {
86
+ rom.array() ++ subsystem.dtb.contents
87
+ } else {
88
+ rom.array()
89
+ }
83
90
}
84
91
85
92
val bootrom = bootROMDomainWrapper {
86
93
LazyModule (new TLROM (params.address, params.size, contents, true , tlbus.beatBytes))
87
94
}
88
95
89
- bootrom.node := tlbus.coupleTo(" bootrom " ){ TLFragmenter (tlbus, Some (" BootROM " )) := _ }
96
+ bootrom.node := tlbus.coupleTo(params.name ){ TLFragmenter (tlbus, Some (params.name )) := _ }
90
97
// Drive the `subsystem` reset vector to the `hang` address of this Boot ROM.
91
- subsystem.tileResetVectorNexusNode := bootROMResetVectorSourceNode
92
- InModuleBody {
93
- val reset_vector_source = bootROMResetVectorSourceNode.bundle
94
- require(reset_vector_source.getWidth >= params.hang.bitLength,
95
- s " BootROM defined with a reset vector ( ${params.hang})too large for physical address space ( ${reset_vector_source.getWidth}) " )
96
- bootROMResetVectorSourceNode.bundle := params.hang.U
98
+ if (params.driveResetVector) {
99
+ subsystem.tileResetVectorNexusNode := bootROMResetVectorSourceNode
100
+ InModuleBody {
101
+ val reset_vector_source = bootROMResetVectorSourceNode.bundle
102
+ require(reset_vector_source.getWidth >= params.hang.bitLength,
103
+ s " BootROM defined with a reset vector ( ${params.hang})too large for physical address space ( ${reset_vector_source.getWidth}) " )
104
+ bootROMResetVectorSourceNode.bundle := params.hang.U
105
+ }
97
106
}
98
107
bootrom
99
108
}
0 commit comments