From 04849833fe1257f4f7b2ceb88a53ac97f28116a0 Mon Sep 17 00:00:00 2001 From: Matheus Cavalcante Date: Mon, 4 Dec 2023 19:22:21 -0800 Subject: [PATCH] hw: Clean up the bootrom --- hw/system/spatz_cluster/test/bootrom.S | 34 ++++++- hw/system/spatz_cluster/test/bootrom.bin | Bin 148 -> 268 bytes hw/system/spatz_cluster/test/bootrom.dump | 109 ++++++++++++++-------- hw/system/spatz_cluster/test/bootrom.elf | Bin 5184 -> 5304 bytes 4 files changed, 101 insertions(+), 42 deletions(-) diff --git a/hw/system/spatz_cluster/test/bootrom.S b/hw/system/spatz_cluster/test/bootrom.S index bf608fe3..6b9885e9 100644 --- a/hw/system/spatz_cluster/test/bootrom.S +++ b/hw/system/spatz_cluster/test/bootrom.S @@ -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 diff --git a/hw/system/spatz_cluster/test/bootrom.bin b/hw/system/spatz_cluster/test/bootrom.bin index 30047bccdbbee597681560616608f08c9dee388e..09e3c51ed977df41adbcb28a0594719c4562e97e 100755 GIT binary patch literal 268 zcmZY4yA8rH6h`5jIOhGZ^cSp=jsaKzi6JN{vOpv&6S!c2^fa_|48jU*0LKwDVCnOb zaxFPdW~Ra{K_!J8g(?bp3XLc7: - 1000: 00000317 auipc t1,0x0 - 1004: 04430313 addi t1,t1,68 # 1044 - 1008: 30531073 csrw mtvec,t1 - 100c: f1402573 csrr a0,mhartid - 1010: 00000597 auipc a1,0x0 - 1014: 04058593 addi a1,a1,64 # 1050 - 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 + 1084: 30531073 csrw mtvec,t1 + 1088: 00000597 auipc a1,0x0 + 108c: 04058593 addi a1,a1,64 # 10c8 + 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 : - 1044: 10500073 wfi - 1048: ffdff06f j 1044 +000010bc : + 10bc: 10500073 wfi + 10c0: ffdff06f j 10bc Disassembly of section .rodata: -00001050 : - 1050: 1000 addi s0,sp,32 - 1052: 0000 unimp - 1054: 0000 unimp - 1056: 0000 unimp - 1058: 0001 nop +000010c8 : + 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 : - 1090: 1044 addi s1,sp,36 +00001108 : + 1108: 10bc addi a5,sp,104 ... Disassembly of section .Pulp_Chip.Info: @@ -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 + 1c: 20656e6f jal t3,56222 20: 3d757063 bleu s7,a0,3e0 <_start-0xc20> 24: 6f6e flw ft10,216(sp) 26: 656e flw fa0,216(sp) diff --git a/hw/system/spatz_cluster/test/bootrom.elf b/hw/system/spatz_cluster/test/bootrom.elf index 887443af217f8f3404d1d9659b0b7d8b5bb005a3..dfa5d03305eeae97b6abc19ebfead869d70fd4f2 100755 GIT binary patch delta 349 zcmY+;u}T9$5P;#?yX3s+ne5&~3|bfxh}wyrjkQ<>>?{*V6$CN8B33pU=SfT<7AY(& z?iqXwTO0jPlfs3cj~$k~dE0y4e{4s6opw4&=0r00eEQP3HW5*-Mj9b$jHDGLts-fH zq$^08B54gtSCMoLNi!r}N76cyHjp-BsqwS8a^=qs%=;4;J%v_VSmFPY zdEx(N@#1wF>@XbX^Tk-i$u=(---ZiU*k|Y_qsj1cJg}|&%e~u%?o`W<6n3QDBn`iB i2il9WVE1qyYzC8HAKG(w=9;^$?_8w6+y%>Z%JT!m%`o=> delta 192 zcmdm?c|c==0@DqliAqXrQy3T+rZ8;u+Qu&+&dk6d%wU>;+@ zmS+VS5-@qAurk{OAPcDWmarPr6oJW1B5F*J1SV?% YsXqdfgGAIAc_vqis57=tUMM0C06sw~ZU6uP