Skip to content
Snippets Groups Projects
  1. Nov 14, 2021
    • Geo Ster's avatar
      Move header files to src dir · 9969bd6f
      Geo Ster authored
      * Having the header files in a seperate dir is only useful when developing
      libraries that are meant to be used by other programs. In our case though
      it makes the file structure more tedious so gather everything in one place.
      9969bd6f
    • Geo Ster's avatar
      Migrate to fmt for logging · 035008f7
      Geo Ster authored
      * std::cout is not fit for our usecase, which is format heavy output.
      This results in a lot of code bloat from switching between std::dec and
      std::hex. Switching to fmt yields significantly cleaner code.
      035008f7
    • Geo Ster's avatar
      Improve PC handling · 40b83f7b
      Geo Ster authored
      * Currently the way PC was logged was kinda broken, especially on branch
      delay slots where it would show the jump address instead. This doesn't
      affect the functionality but makes debugging a bit harder so to fix this,
      cache the PC together with the instruction being loaded to always have
      the correct address.
      40b83f7b
    • Geo Ster's avatar
      Continue going through the BIOS · 95f02f67
      Geo Ster authored
      * Implement more instructions as usual
      * Rename instr.doubleword to instr.dword for more compat code
      * Add the skip branch delay slots feature for beq* instructions
      95f02f67
  2. Nov 13, 2021
    • Geo Ster's avatar
      Remove dependency on int128 · 5cafeb61
      Geo Ster authored
      * This is only supported on GCC/Clang making compilation fail on
      MSVC. In addition we don't really need this since accessing the
      entire 128bit register is very rare and can be emulated by setting
      each of 64bit parts seperately.
      5cafeb61
    • Geo Ster's avatar
      Implement more instructions in the CPU · 2daed618
      Geo Ster authored
      * Nothing special really, just adding more instructions and fixes minor
      bugs to progress further
      2daed618
  3. Nov 04, 2021
    • Geo Ster's avatar
      Add scratchpad handler · 49a61fb1
      Geo Ster authored
      * Currently the BIOS tries to write something to scratchpad and it fails
      because its address is not our currently supported range. So add a new buffer
      for the 16KB scratchpad used by the CPU and add a function to use it if the
      address is in the correct range.
      
      * Also shorten some function names and change some array to C-style because we
      like to work with pointers and STL doesn't like that.
      49a61fb1
    • Geo Ster's avatar
      Implement MADD1/MTC0/JALR/SD and rewrite COP0 decoding · e2559bb5
      Geo Ster authored
      * COP0 instructions sadly have way too many encoding to use a single template one them,
      so rewrite the decoder to manually extract the required bits for each instruction. This
      fixes a bug where the MTC0 instruction was mistaken for MFC0.
      
      * Implement more instructions so we can execute more of the BIOS. In addition fix
      an oopsie in the ORI instruction which fixes some bugged memory writes. As of now the
      BIOS tries to write address 0x70003fe0 which maps to the scratchpad memory (assuming no further
      logic errors are present). Need to investigate why this is and how to emulate it before
      continuing...
      e2559bb5
  4. Nov 03, 2021
    • Geo Ster's avatar
      Implement ORI/ADDI/LQ · ebf1986d
      Geo Ster authored
      In addition:
      * Correct register notation (word refers to a 32bit quantity not 16bit)
      * Simplify sign extension casing
      * Add more useful logging
      ebf1986d
    • Geo Ster's avatar
      Handle branch delay slots · 2f7596b8
      Geo Ster authored
      * MIPS has an architectural feature, where instead of flushing the
      pipeline when executing a branch instruction, it goes ahead and executes
      the instruction following the branch as well. Flushing the pipeline
      is costly and is the cause of those complex branch predictors on
      modern CPUs that try to guess when a branch will be taken.
      
      * To properly emulate this behaviour we must act how the pipeline acts. We
      will always have 2 instructions loaded the current one and the next one. This way
      we can load the instruction after the branch even though the pc changes.
      2f7596b8
    • Geo Ster's avatar
      Implement first instructions mfc0/sw/bne/sll · 0e09c3a1
      Geo Ster authored
      * The instruction decoding was based on the handy table in ps2tek [1]
      while the instructions themselves were written based on the document
      added.
      
      * The implementation makes heavy use of bitfields and unions in C++ to
      make accessing different bits/sections of registers easier and more
      intuitive. You may also notice the frequent casting (uint32_t)(int16_t)
      which might seem useless but is there to force the compiler to generate
      instructions to sign extend the offsets.
      
      [1] https://psi-rockin.github.io/ps2tek/#eeinstructiondecoding
      0e09c3a1
  5. Oct 31, 2021
    • Geo Ster's avatar
      Add initial EE/Bus implementations · 2ad0640f
      Geo Ster authored
      * This commit adds a most basic CPU class that acts as a template
      which we will slowly build.
      
      * The architecture is pretty simple; the ComponentManager will create all
      the seperate components (EE, VP, IOP, GS etc) as unique_ptr's since
      it owns them and only it has access to them. All the other components
      must pass through the manager to read/write data to memory.
      To achieve this they are given a pointer to the ComponentManger in their constructor.
      
      * For now the CPU directly accesses the bios which shouldn't
      happen but will be fixed eventually when I implement generic
      read/writes. The goal is to start implementing the CPU as fast as
      possible in order to get to the GPU/VPU's and display something!
      2ad0640f
Loading