From 608eed5c16366cae251f5d12ad1ed0b988b3ce46 Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Wed, 6 Feb 2019 14:42:49 +0100 Subject: Implement simple address-space ranges registration and example peripheral. Signed-off-by: Pavel Pisa --- qtmips_machine/qtmipsmachine.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'qtmips_machine/qtmipsmachine.cpp') diff --git a/qtmips_machine/qtmipsmachine.cpp b/qtmips_machine/qtmipsmachine.cpp index 51e5580..0f65609 100644 --- a/qtmips_machine/qtmipsmachine.cpp +++ b/qtmips_machine/qtmipsmachine.cpp @@ -39,6 +39,7 @@ using namespace machine; QtMipsMachine::QtMipsMachine(const MachineConfig &cc) : QObject(), mcnf(&cc) { + MemoryAccess *cpu_mem; stat = ST_READY; ProgramLoader program(cc.elf()); @@ -49,8 +50,16 @@ QtMipsMachine::QtMipsMachine(const MachineConfig &cc) : QObject(), mcnf(&cc) { if (program.get_executable_entry()) regs->pc_abs_jmp(program.get_executable_entry()); mem = new Memory(*mem_program_only); - cch_program = new Cache(mem, &cc.cache_program(), cc.memory_access_time_read(), cc.memory_access_time_write()); - cch_data = new Cache(mem, &cc.cache_data(), cc.memory_access_time_read(), cc.memory_access_time_write()); + cpu_mem = mem; +#if 1 + physaddrspace = new PhysAddrSpace(); + physaddrspace->insert_range(mem, 0x00000000, 0xefffffff, false); + MemoryAccess *periph = new SimplePeripheral(); + physaddrspace->insert_range(periph, 0xffffc000, 0xffffcfff, false); + cpu_mem = physaddrspace; +#endif + cch_program = new Cache(cpu_mem, &cc.cache_program(), cc.memory_access_time_read(), cc.memory_access_time_write()); + cch_data = new Cache(cpu_mem, &cc.cache_data(), cc.memory_access_time_read(), cc.memory_access_time_write()); if (cc.pipelined()) cr = new CorePipelined(regs, cch_program, cch_data, cc.hazard_unit()); -- cgit v1.2.3