Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
# Lab 6 boot monitor source (documentary assembly)
#
# The current teaching MIPS core supports only:
# add/sub/and/or/slt/lw/sw/beq/addi/j
# The reproducible ROM image is generated by gen_lab6_boot.py instead of a
# full MIPS assembler. This file documents the intended monitor algorithm.
#define UART_TXDATA 0x00001000 /* alias for 0x10001000 */
#define UART_RXDATA 0x00001004 /* alias for 0x10001004 */
#define UART_STATUS 0x00001008 /* alias for 0x10001008 */
#define GPIO_OUT 0x00000000 /* alias for 0x10000000 */
#define TX_READY_MASK 0x00000001
#define RX_VALID_MASK 0x00000002
reset:
# initialize constants and show boot activity on LEDs
addi $t7, $zero, TX_READY_MASK
addi $t4, $zero, RX_VALID_MASK
addi $t0, $zero, 1
sw $t0, GPIO_OUT($zero)
# print: "step_into_mips boot monitor\r\n> "
# gen_lab6_boot.py expands each character into:
# wait until UART_STATUS.tx_ready
# sw char, UART_TXDATA($zero)
main:
lw $t3, UART_STATUS($zero)
and $t5, $t3, $t4
beq $t5, $zero, main
nop
# Echo one received byte and advance LEDs as activity indicator.
lw $t6, UART_RXDATA($zero)
addi $t0, $t0, 1
sw $t0, GPIO_OUT($zero)
wait_tx_ready:
lw $t3, UART_STATUS($zero)
and $t5, $t3, $t7
beq $t5, $zero, wait_tx_ready
nop
sw $t6, UART_TXDATA($zero)
j main
nop
bbabecca6This file is pinned to the selected release. Download the original to open it in your design tool.