chipyard icon indicating copy to clipboard operation
chipyard copied to clipboard

Question about the BootROM content

Open crystalbreezy1 opened this issue 4 years ago • 1 comments

Currently we're trying to complete a synthesize flow on a chipyard soc design, and instead of the existing combinational logic, we're planning to use a real ROM IP. To achieve that, we need to to find the current bootROM program binary code for ROM initalization.

According to the webpage https://chipyard.readthedocs.io/en/latest/Customization/Boot-Process.html, current bootrom program code is located in generators/testchipip/src/main/resources/testchipip/bootrom/bootrom.S. However, when I generate the assembly code using ‘make dump' and compare with the generated Verilog netlist, I find that though the beginng section of the ROM code matches, there're more contents in the Verilog BootROM: End of dumped BootROM code (bootrom.rv64.dump): 10098: 00000597 auipc a1,0x0 1009c: 01858593 addi a1,a1,24 # 100b0 <_dtb> 100a0: 08000613 li a2,128 100a4: 30063073 csrc mstatus,a2 100a8: 30200073 mret 100ac: 00000013 nop

Situation in netlist ROM: wire [63:0] _GEN_16 = 9'h10 == index ? 64'h5a02300b505b3 : _GEN_15; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_17 = 9'h11 == index ? 64'h5650300004537 : _GEN_16; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_18 = 9'h12 == index ? 64'hf140257334151073 : _GEN_17; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_19 = 9'h13 == index ? 64'h185859300000597 : _GEN_18; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_20 = 9'h14 == index ? 64'h3006307308000613 : _GEN_19; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_21 = 9'h15 == index ? 64'h1330200073 : _GEN_20; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_22 = 9'h16 == index ? 64'h340d0000edfe0dd0 : _GEN_21; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_23 = 9'h17 == index ? 64'hc0b000038000000 : _GEN_22; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_24 = 9'h18 == index ? 64'h1100000028000000 : _GEN_23; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_25 = 9'h19 == index ? 64'h10000000 : _GEN_24; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_26 = 9'h1a == index ? 64'hd40a000028020000 : _GEN_25; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_27 = 9'h1b == index ? 64'h0 : _GEN_26; // @[BootROM.scala 51:47 BootROM.scala 51:47] wire [63:0] _GEN_28 = 9'h1c == index ? 64'h0 : _GEN_27; // @[BootROM.scala 51:47 BootROM.scala 51:47]

We can see that after bootrom code ends (shown as bolded line), there exists more continuing code. Could you please let us know what's the source of this code?

crystalbreezy1 avatar Dec 15 '21 07:12 crystalbreezy1

That is the DTB (device tree binary), which is baked into the bootrom for the next-stage bootloader to read.

https://github.com/chipsalliance/rocket-chip/blob/330c2b808e19fec66f11fbae33c939b196f0bc42/src/main/scala/devices/tilelink/BootROM.scala#L77

jerryz123 avatar Dec 16 '21 09:12 jerryz123