Skip to content

Extended mips - #116

Merged
Spooky-Firefox merged 49 commits into
masterfrom
extended_mips
Sep 24, 2026
Merged

Spooky-Firefox merged 49 commits into
masterfrom
extended_mips

Conversation

@Spooky-Firefox

Copy link
Copy Markdown
Collaborator

This is the version the students have been using the last two years, i think its battle tested and does not require much of a review.

Summary:

This pull request introduces several enhancements and refactors to the MIPS simulation codebase, primarily focused on improving memory control signal handling, expanding component capabilities, and updating dependencies. The most significant changes include the addition of explicit memory read enable signals throughout the control unit and data memory, the introduction of new example files, and updates to optional dependencies and feature flags.

Key changes:

Memory Control Signal Improvements

  • Added a dedicated mem_read_enable signal to the control unit (ControlUnit), including new constants, default values, and logic for setting this signal for relevant instructions. This ensures more precise control over memory read operations. [1] [2] [3] [4] [5] [6] [7]
  • Updated the data memory (DataMem) structure and related input wiring to support the new read_enable_input, enabling components to respond correctly to read enable signals. [1] [2] [3] [4] [5]
  • Modified JSON configuration files (mips_pipe.json, mips_single_cycle.json) to include the new read_enable_input field for data memory components. [1] [2]

Control Unit Refactoring and CP0 Handling

  • Refactored and clarified CP0-related constants and logic, introducing new signals (CP0_MV_OP_OUT, IS_SYSCALL, IS_RFE) and handling for CP0 instructions in the control unit. This lays groundwork for future CP0 instruction support. [1] [2] [3] [4]
  • Updated the output fields and signal initialization to ensure all relevant control signals are set with explicit default values, improving code safety and maintainability. [1] [2]

Example and Test Expansion

  • Added new example files: mips_io.rs and mips_timer.rs, which demonstrate the use of new components and signals, and updated existing examples to use more descriptive file names and to wire up the new signals. [1] [2] [3] [4]

Dependency and Feature Management

  • Marked the rfd crate as optional in Cargo.toml and ensured it is only enabled for the gui-egui feature, improving build flexibility and reducing unnecessary dependencies. [1] [2] [3] [4]
  • Added the bitvec crate as a dependency for potential future use with bit manipulation.

Development Environment Updates

  • Expanded the list of recognized words in .vscode/settings.json to include new identifiers and terms relevant to recent code additions, aiding code navigation and linting.

- Added support for dynamic symbols in InstrMem with a default value for PC_IM.
- Implemented a method to set all dynamic symbols in MemViewWindow while preserving visibility of existing symbols.
The zoom fix (#114) added canvas_rect to Gui and disabled egui's built in
keyboard zoom in gui(), but extended_mips builds the Gui through
Gui::new/run (used by the mips-lib cli), which missed both.
- mips_im_dm_regfile: the DataMem read enable was wired to a probe named
  data_read_enable but the probe was named read_enable, giving
  "A port left unconnected"
- mips_extended_pipe_example: CP0 EPC input used the port name
  instruction_ex_4_address_in as component id, wire it to mux_b2_reg
  like mips_pipe_ex.json does
- mips_pipe_example_1 and mips_extended_pipe_example saved to
  mips_pipe_ex.json, overwriting the hand tuned in built extended model,
  save to their own files instead
- un_clock computed compare - 1 which overflowed when compare is 0
  (the default), panicking in debug and desyncing the compare flag
  history in release. Use the same check as clock (counter == compare)
  before undoing the counter step instead.
- clock computed compare + 1 which overflowed for compare = u32::MAX,
  use wrapping_add.
- Add clock/unclock round trip tests for the timer.

@Spooky-Firefox Spooky-Firefox left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look through the code that we wrote 2 years ago with new eyes, everything looks good but cant approve my own pr :(

@salon64 salon64 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@Spooky-Firefox
Spooky-Firefox merged commit 743fbae into master Sep 24, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants