Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Cpu and System traits #40

Merged
merged 7 commits into from
Dec 30, 2023
Merged

Conversation

breqdev
Copy link
Owner

@breqdev breqdev commented Dec 30, 2023

  • Refactor out a Cpu trait from the Mos6502 struct to prepare for supporting other CPUs (Z80, etc)
  • Remove the SystemInfo struct (previously only used to store the number of clock ticks) and standardize on using u64 for clock cycle counts
  • Remove the WhateverBuilder unit structs, refactor the SystemBuilder trait into a BuildableSystem trait which is implemented for the system itself
  • Add a get_cpu method to the System trait to allow for provided implementations to be added to System (e.g., upcoming work in trace generation in Add an option to produce a textfile trace of instructions executed #39)
  • Add a cleanup method to the System trait (enables use of a buffered writer in Add an option to produce a textfile trace of instructions executed #39, improving performance)

@ava-silver ava-silver self-requested a review December 30, 2023 04:05
Copy link
Collaborator

@ava-silver ava-silver left a comment

Choose a reason for hiding this comment

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

lgtm! good refactor

Copy link

codecov bot commented Dec 30, 2023

Codecov Report

Attention: 81 lines in your changes are missing coverage. Please review.

Comparison is base (382f14b) 27.49% compared to head (688de5e) 27.40%.

Files Patch % Lines
src/cpu/mos6502/mod.rs 77.89% 21 Missing ⚠️
src/systems/pet/mod.rs 0.00% 7 Missing ⚠️
src/main.rs 0.00% 6 Missing ⚠️
src/systems/c64/mod.rs 0.00% 6 Missing ⚠️
src/systems/vic/mod.rs 0.00% 6 Missing ⚠️
src/memory/mos652x/pia.rs 0.00% 5 Missing ⚠️
src/platform/winit/mod.rs 0.00% 4 Missing ⚠️
src/systems/basic.rs 0.00% 4 Missing ⚠️
src/systems/easy.rs 0.00% 4 Missing ⚠️
src/systems/klaus.rs 40.00% 3 Missing ⚠️
... and 8 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #40      +/-   ##
==========================================
- Coverage   27.49%   27.40%   -0.10%     
==========================================
  Files          41       42       +1     
  Lines        8988     9014      +26     
==========================================
- Hits         2471     2470       -1     
- Misses       6517     6544      +27     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@breqdev breqdev merged commit 8e222b8 into main Dec 30, 2023
5 checks passed
@ava-silver ava-silver deleted the asbc/cpu-system-trait-refactor branch December 30, 2023 07:03
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