Skip to content
Snippets Groups Projects
Select Git revision
  • 404b5cac3b71c91c520f63e5d41a9d45b16d2712
  • master default protected
  • ext-memory
  • feature-develop
4 results

debug.s

Blame
    • MJ's avatar
      d8009948
      Reorganized folders · d8009948
      MJ authored
      NOTE: if simulations are still needed, the protocol-controllers branch should suffice. Otherwise, we just need to re-add sources to Vivado.
      d8009948
      History
      Reorganized folders
      MJ authored
      NOTE: if simulations are still needed, the protocol-controllers branch should suffice. Otherwise, we just need to re-add sources to Vivado.
    debug.s 21.31 KiB
    # This test program tests the functionality of all protocol controllers
    # with the RV32IMC core.
    # --
    # Hardware configuration:
    # UART: ESP8266 running esp8266-spotify-remote.ino
    # SPI: Arduino Uno w/ buttons
    # I2C: LCD
    # --
    # Description:
    # 	- The core polls the SPI device if a button has been pressed.
    # 	- If a button is pressed, the core will send the corresponding command to the UART device.
    # 	- The core will then wait for data from the UART device, stopping only if more than 200ms has passed between bytes received.
    #	- After receiving the data, it is compared with previous data received; if they;re different, send the new string to the I2C device.
    #	- The core will then go back to polling the SPI device.
    # 	- Ideally, a hardware interrupt from the SPI device is connected to the FPGA, s.t. when a button is pressed, the device can
    #		interrupt the core so it can start reading from the device. However, in this case, we only want to show the functionality
    #		of the protocol controllers.
    # --
    # Register usage:
    #		gp -> PROTOCOLMEM address
    #		sp -> points to end of COREMEM (word addr 0x3FF)
    #		s0 -> x0 for compressed instructions
    #		s1 -> UART Output Control
    #		s2 -> I2C Output Control
    #		s3 -> SPI Output Control
    #		s4 -> UART Data Out
    #		s5 -> I2C Data Out (not used in this program)
    #		s6 -> SPI Data Out
    #		s7 -> UART data has been received
    #		s11 -> WRDONE&RDDONE status of previous interrupt
    #		--
    #		a0-a1 -> return values
    #		a2-a7 -> subroutine arguments
    #		t0-t6 -> local subroutine registers (not saved between calls)
    #		ISR stores ax & tx registers to stack before running.
    
    # Strings used for sending commands to the ESP8266
    .data 0x1C				# "PLAYPAUSE\r\n"
    	.ascii "PLAY"		# 0x1c
    	.ascii "PAUS"		# 0x20
    	.ascii "E\r\n"		# 0x24
    
    .data 0x30				# "PREV\r\n"
    	.ascii "PREV"		# 0x30
    	.ascii "\r\n"		# 0x34
    
    .data 0x40				# "NEXT\r\n"
    	.ascii "NEXT"		# 0x40
    	.ascii "\r\n"		# 0x44
    
    .data 0x100
    	.ascii "LCD\n"		# 0x100
    	.ascii "Init"		# 0x104
    	.ascii "iali"		# 0x108
    	.ascii "zed"		# 0x10c
    
    .data 0x120
    	.ascii "NEW "
    	.ascii "SONG"
    
    # Declaring "Global variables" (mostly just memory addresses)
    # #define BUFSIZE 64 (64 bytes/16 word addresses)
    # static char Rxbuffer[BUFSIZE]; (0x50 -> 0x8c)
    # static char prevRx[BUFSIZE]; (0xa0 -> 0xdc)
    
    # NOTE: for debugging purposes, delay subroutines are shortened, & prescale values are set high
    
    .text
    init:
    	addi sp, x0, 0x3FF			# Stack pointer address