diff options
author | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-25 11:19:39 +0100 |
---|---|---|
committer | Pavel Pisa <pisa@cmp.felk.cvut.cz> | 2019-02-25 11:19:39 +0100 |
commit | ca242e325d823bc627ca4e6ff8eca24b888a6113 (patch) | |
tree | 55d880f4527970654a82e52c1c56030bafe7bbe4 /qtmips_machine | |
parent | a921347d7e4ceb212021599469e38c5ac9e19598 (diff) | |
download | qtmips-ca242e325d823bc627ca4e6ff8eca24b888a6113.tar.gz qtmips-ca242e325d823bc627ca4e6ff8eca24b888a6113.tar.bz2 qtmips-ca242e325d823bc627ca4e6ff8eca24b888a6113.zip |
Exceptions causes align with SPIM and add serial port range alias equivalent to SPIM.
Signed-off-by: Pavel Pisa <pisa@cmp.felk.cvut.cz>
Diffstat (limited to 'qtmips_machine')
-rw-r--r-- | qtmips_machine/machinedefs.h | 13 | ||||
-rw-r--r-- | qtmips_machine/peripspiled.cpp | 16 | ||||
-rw-r--r-- | qtmips_machine/qtmipsmachine.cpp | 3 |
3 files changed, 21 insertions, 11 deletions
diff --git a/qtmips_machine/machinedefs.h b/qtmips_machine/machinedefs.h index f575648..16a72b0 100644 --- a/qtmips_machine/machinedefs.h +++ b/qtmips_machine/machinedefs.h @@ -58,12 +58,13 @@ enum AccessControl { }; enum ExceptionCause { - EXCAUSE_NONE, - EXCAUSE_BREAK, - EXCAUSE_SYSCALL, - EXCAUSE_HWBREAK, - EXCAUSE_TRAP, - EXCAUSE_OVERFLOW, + EXCAUSE_NONE = 0, + EXCAUSE_INT = 1, + EXCAUSE_SYSCALL = 8, + EXCAUSE_BREAK = 9, + EXCAUSE_OVERFLOW = 12, + EXCAUSE_TRAP = 13, + EXCAUSE_HWBREAK = 14, }; enum AluOp : std::uint8_t { diff --git a/qtmips_machine/peripspiled.cpp b/qtmips_machine/peripspiled.cpp index 03b74f9..c4333e7 100644 --- a/qtmips_machine/peripspiled.cpp +++ b/qtmips_machine/peripspiled.cpp @@ -46,7 +46,13 @@ using namespace machine; #define SPILED_REG_KNOBS_8BIT_o 0x024 PeripSpiLed::PeripSpiLed() { + spiled_reg_led_line = 0; + spiled_reg_led_rgb1 = 0; + spiled_reg_led_rgb2 = 0; + spiled_reg_led_kbdwr_direct = 0; + spiled_reg_kbdrd_knobs_direct = 0; + spiled_reg_knobs_8bit = 0; } PeripSpiLed::~PeripSpiLed() { @@ -83,10 +89,7 @@ bool PeripSpiLed::wword(std::uint32_t address, std::uint32_t value) { std::uint32_t PeripSpiLed::rword(std::uint32_t address, bool debug_access) const { (void)debug_access; std::uint32_t value = 0x00000000; -#if 0 - printf("PeripSpiLed::rword address 0x%08lx\n", - (unsigned long)address); -#endif + switch (address) { case SPILED_REG_LED_LINE_o: value = spiled_reg_led_line; @@ -112,6 +115,11 @@ std::uint32_t PeripSpiLed::rword(std::uint32_t address, bool debug_access) const emit read_notification(address, &value); +#if 0 + printf("PeripSpiLed::rword address 0x%08lx value 0x%08lx\n", + (unsigned long)address, (unsigned long)value); +#endif + return value; } diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp index e1ecf93..171a50f 100644 --- a/qtmips_machine/qtmipsmachine.cpp +++ b/qtmips_machine/qtmipsmachine.cpp @@ -61,7 +61,8 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc, bool load_symtab) : cpu_mem = physaddrspace; ser_port = new SerialPort(); - addressapce_insert_range(ser_port, 0xffffc000, 0xffffc0ff, true); + addressapce_insert_range(ser_port, 0xffffc000, 0xffffc03f, true); + addressapce_insert_range(ser_port, 0xffff0000, 0xffff003f, false); perip_spi_led = new PeripSpiLed(); addressapce_insert_range(perip_spi_led, 0xffffc100, 0xffffc1ff, true); |