Hi Jerry,
Not sure if you'll see this (being that this thread is now a year old) - but any help would be greatly appreciated.
My team is taping out a chip, and we have taken our Chipyard-generated RTL out into a fresh Verilator simulation environment and written a "lean" TestHarness.v (without the convenient DUT connection features like TSI and ChipLink) that more closely reflects the boot program/pattern we intend to have with our ASIC.
We would like our final boot scenario to be like the last one you described:
"- Total-self-boot where CustomBootPin writes the address of an alternative on-chip second-stage-bootloader in ROM. For example, this second stage bootloader can be something that copies a binary from a SPI device to DRAM, before jumping into DRAM"
But for now, we want to totally replace the BootROM with a simple program that writes text out of the UART with a program like this:
```
#define UART_BASE 0x54000000 // UART memory mapped registers base address
#define UART_TXFIFO 0x00 // Transmit FIFO register
#define UART_RXFIFO 0x04 // Receive FIFO register
#define UART_TXCTRL 0x08 // Transmit control (bit 0 = txen)
#define UART_TXMARK 0x0a // Transmit mark ( ?? )
#define UART_RXCTRL 0x0c // Receive control (bit 0 = rxen ??)
#define UART_RXMARK 0x0e // Receive mark ( ?? )
// define ie
#define UART_IP 0x14 // Interrupt pending (bit 0 = txwm_ip)
// define div
// define parity
// define wire4
// define either8or9 -> frame length?
.section .text.hang, "ax", @progbits
.global _hang
_hang:
li t0, UART_BASE
li t1, 'A' // ASCII 'A'
# Enable transmitter (txen = 1)
li t2, 1
sw t2, UART_TXCTRL(t0)
wait_uart_ready:
lw t2, UART_IP(t0) # Read interrupt pending
andi t2, t2, 0x1 # Check txwm_ip bit
beqz t2, wait_uart_ready
sw t1, UART_TXFIFO(t0) # Write to txfifo
done:
j done
```
But it is not working so far. The synchronization of the instructions being fetched and exected does not correlate with the ROM addresses being accessed according to waveform dumps on the simulations we have viewed.
Can you spot any problems? Any help would be greatly appreciated, even if you can only give a general consult and not specific debugging