Skip to content

Commit

Permalink
hw: Clean up the bootrom
Browse files Browse the repository at this point in the history
  • Loading branch information
suehtamacv committed Dec 5, 2023
1 parent 921484b commit 0484983
Show file tree
Hide file tree
Showing 4 changed files with 101 additions and 42 deletions.
34 changes: 33 additions & 1 deletion hw/system/spatz_cluster/test/bootrom.S
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,41 @@
.global BOOTDATA

_start:
// Clear integer registers
mv x1, x0
mv x2, x0
mv x3, x0
mv x4, x0
mv x5, x0
mv x6, x0
mv x7, x0
mv x8, x0
mv x9, x0
mv x10, x0
mv x11, x0
mv x12, x0
mv x13, x0
mv x14, x0
mv x15, x0
mv x16, x0
mv x17, x0
mv x18, x0
mv x19, x0
mv x20, x0
mv x21, x0
mv x22, x0
mv x23, x0
mv x24, x0
mv x25, x0
mv x26, x0
mv x27, x0
mv x28, x0
mv x29, x0
mv x30, x0
mv x31, x0

la t1, exception
csrw mtvec, t1
csrr a0, mhartid
la a1, BOOTDATA

// Activate MEIP
Expand Down
Binary file modified hw/system/spatz_cluster/test/bootrom.bin
Binary file not shown.
109 changes: 68 additions & 41 deletions hw/system/spatz_cluster/test/bootrom.dump
Original file line number Diff line number Diff line change
Expand Up @@ -5,56 +5,83 @@ test/bootrom.elf: file format elf32-littleriscv
Disassembly of section .text:

00001000 <_start>:
1000: 00000317 auipc t1,0x0
1004: 04430313 addi t1,t1,68 # 1044 <exception>
1008: 30531073 csrw mtvec,t1
100c: f1402573 csrr a0,mhartid
1010: 00000597 auipc a1,0x0
1014: 04058593 addi a1,a1,64 # 1050 <BOOTDATA>
1018: 00001337 lui t1,0x1
101c: 80030313 addi t1,t1,-2048 # 800 <_start-0x800>
1020: 30431073 csrw 0x304,t1
1024: 10500073 wfi
1028: 0185a383 lw t2,24(a1)
102c: 0205ae03 lw t3,32(a1)
1030: 01c383b3 add t2,t2,t3
1034: 05838393 addi t2,t2,88
1038: 00038393 mv t2,t2
103c: 0003a383 lw t2,0(t2)
1040: 00038067 jr t2
1000: 00000093 li ra,0
1004: 00000113 li sp,0
1008: 00000193 li gp,0
100c: 00000213 li tp,0
1010: 00000293 li t0,0
1014: 00000313 li t1,0
1018: 00000393 li t2,0
101c: 00000413 li s0,0
1020: 00000493 li s1,0
1024: 00000513 li a0,0
1028: 00000593 li a1,0
102c: 00000613 li a2,0
1030: 00000693 li a3,0
1034: 00000713 li a4,0
1038: 00000793 li a5,0
103c: 00000813 li a6,0
1040: 00000893 li a7,0
1044: 00000913 li s2,0
1048: 00000993 li s3,0
104c: 00000a13 li s4,0
1050: 00000a93 li s5,0
1054: 00000b13 li s6,0
1058: 00000b93 li s7,0
105c: 00000c13 li s8,0
1060: 00000c93 li s9,0
1064: 00000d13 li s10,0
1068: 00000d93 li s11,0
106c: 00000e13 li t3,0
1070: 00000e93 li t4,0
1074: 00000f13 li t5,0
1078: 00000f93 li t6,0
107c: 00000317 auipc t1,0x0
1080: 04030313 addi t1,t1,64 # 10bc <exception>
1084: 30531073 csrw mtvec,t1
1088: 00000597 auipc a1,0x0
108c: 04058593 addi a1,a1,64 # 10c8 <BOOTDATA>
1090: 00001337 lui t1,0x1
1094: 80030313 addi t1,t1,-2048 # 800 <_start-0x800>
1098: 30431073 csrw 0x304,t1
109c: 10500073 wfi
10a0: 0185a383 lw t2,24(a1)
10a4: 0205ae03 lw t3,32(a1)
10a8: 01c383b3 add t2,t2,t3
10ac: 05838393 addi t2,t2,88
10b0: 00038393 mv t2,t2
10b4: 0003a383 lw t2,0(t2)
10b8: 00038067 jr t2

00001044 <exception>:
1044: 10500073 wfi
1048: ffdff06f j 1044 <exception>
000010bc <exception>:
10bc: 10500073 wfi
10c0: ffdff06f j 10bc <exception>

Disassembly of section .rodata:

00001050 <BOOTDATA>:
1050: 1000 addi s0,sp,32
1052: 0000 unimp
1054: 0000 unimp
1056: 0000 unimp
1058: 0001 nop
000010c8 <BOOTDATA>:
10c8: 1000 addi s0,sp,32
10ca: 0000 unimp
10cc: 0000 unimp
10ce: 0000 unimp
10d0: 0002 0x2
...
106a: 0010 addi a2,sp,0
106c: 0000 unimp
106e: 0000 unimp
1070: 0000 unimp
1072: 0002 0x2
10e2: 0010 addi a2,sp,0
10e4: 0000 unimp
10e6: 0000 unimp
10e8: 0000 unimp
10ea: 0002 0x2
...
1080: 0000 unimp
1082: 2000 fld fs0,0(s0)
1084: 0000 unimp
1086: 0000 unimp
1088: 0000 unimp
108a: 2004 fld fs1,0(s0)
108c: 0000 unimp
10f8: 0000 unimp
10fa: 8000 0x8000
...
1104: 0001 nop
...

Disassembly of section .boot_section:

00001090 <entry_addr>:
1090: 1044 addi s1,sp,36
00001108 <entry_addr>:
1108: 10bc addi a5,sp,104
...

Disassembly of section .Pulp_Chip.Info:
Expand All @@ -71,7 +98,7 @@ Disassembly of section .Pulp_Chip.Info:
10: 495f 666e 006f 0x6f666e495f
16: 70696863 bltu s2,t1,726 <_start-0x8da>
1a: 6e3d lui t3,0xf
1c: 20656e6f jal t3,56222 <entry_addr+0x55192>
1c: 20656e6f jal t3,56222 <entry_addr+0x5511a>
20: 3d757063 bleu s7,a0,3e0 <_start-0xc20>
24: 6f6e flw ft10,216(sp)
26: 656e flw fa0,216(sp)
Expand Down
Binary file modified hw/system/spatz_cluster/test/bootrom.elf
Binary file not shown.

0 comments on commit 0484983

Please sign in to comment.