From de1ed2978bc2ee275db11b32506e4175d71dd206 Mon Sep 17 00:00:00 2001 From: Brendan Haines Date: Fri, 29 Aug 2025 00:22:51 -0600 Subject: [PATCH] add .text.startup section --- src/bh_cpu.v | 2 ++ tests/test_c/tb.ld | 2 +- tests/test_c/test.S | 10 +++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/bh_cpu.v b/src/bh_cpu.v index 58356db..ecd22f3 100644 --- a/src/bh_cpu.v +++ b/src/bh_cpu.v @@ -479,6 +479,8 @@ always @(posedge clk) begin: pipeline_update end end else begin + // $display("%0t:\tPC=0x%h", $time, s_if_next_pc); + // IF if (!s_if_stall) begin r_if_pc <= s_if_next_pc; diff --git a/tests/test_c/tb.ld b/tests/test_c/tb.ld index 84e815c..5cebe17 100644 --- a/tests/test_c/tb.ld +++ b/tests/test_c/tb.ld @@ -1,5 +1,4 @@ OUTPUT_ARCH( "riscv" ) -ENTRY(_start) MEMORY { @@ -14,6 +13,7 @@ SECTIONS { /* . = ALIGN(4); */ _text = .; + *(.text.startup) *(.text*) *(.rodata*) _etext = .; diff --git a/tests/test_c/test.S b/tests/test_c/test.S index 95c96dd..c151232 100644 --- a/tests/test_c/test.S +++ b/tests/test_c/test.S @@ -1,9 +1,17 @@ .global _start +.section .text.startup # start vector + j _start + nop + nop + nop + nop + nop + .text _start: - addi a0, zero, 0x134 + addi a1, zero, 0x0 nop nop nop