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

Integrate combin memory into pipelined and single-cycle CPUs #82

Merged
merged 16 commits into from
Aug 8, 2019

Conversation

jardhu
Copy link
Collaborator

@jardhu jardhu commented Jul 24, 2019

This PR (hopefully) modifies the existing CPU models to use the newer memory with no side effects to overall functionality.

@jardhu
Copy link
Collaborator Author

jardhu commented Jul 24, 2019

At the moment the code does not work because I've hit a hard wall with that one treadle simulator issue. I've tried to remove all relevant DontCares from the memory modules, but the NoSuchElementException still gets raised with the DualPortedCombinMemory.memory module. The elaborated firrtl doesn't have any invalid signals anywhere in the three memory modules (DualPortedCombinMemory, ICombinMemPort, and DCombinMemPort).

It doesn't work with the non-combinational memory, either - the same exception is raised.

If DCE really is the case of this problem, I may experiment with adding the firrtl.transforms.NoDCEAnnotation option to the simulator's optionsManager as suggested by chipsalliance/chisel#971 though I am not sure if that would be a desired long-term fix.

@powerjg
Copy link
Contributor

powerjg commented Jul 24, 2019

That seems like a fine short term fix. Does it work if you add that option?

Copy link
Contributor

@powerjg powerjg left a comment

Choose a reason for hiding this comment

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

LGTM. I assume that all of the tests are using the combinational memory, correct?

@jardhu
Copy link
Collaborator Author

jardhu commented Jul 25, 2019

Finally had some time to work on splitting the IO. That flipped bus definitely seemed to be the issue, since the CPU is now sending signals to the memory and the memory address size check assert is failing.

@powerjg
Copy link
Contributor

powerjg commented Jul 25, 2019

Changes look good! Sounds like we're getting somewhere!

@jardhu jardhu force-pushed the integrate-new-memory branch from 49e4b66 to 9223254 Compare July 25, 2019 21:00
@jardhu
Copy link
Collaborator Author

jardhu commented Jul 26, 2019

Alright, I got almost all of the single cycle CPU tests passing. The ones that do fail are due to the CSR evec signal being DontCare/invalid, so the imem address gets assigned to 0x80000000. This address is too large for the memory address assert.

I can work around this by removing that assert and outputting 0 when the address exceeds the memory's size, which is what the old memory does, but ideally we should have that assert when the CSR is fully incorporated into the CPU.

@powerjg
Copy link
Contributor

powerjg commented Jul 26, 2019

This looks good to me. However, I would prefer if you could rebase and clean up the history to make sure that each commit is its own thing.

As a couple of examples:

  • make sure to keep the csr thing in its own commit
  • Make changes to the CPUs their own commits
  • Moving CoreIO around
  • Etc.

@jardhu jardhu force-pushed the integrate-new-memory branch from e0650dc to c7f6ec7 Compare July 27, 2019 03:30
@jardhu
Copy link
Collaborator Author

jardhu commented Jul 27, 2019

I rebased most of the combinational memory work. Hopefully the commit history is more clear.

My plan right now is to integrate the non-combinational memory into the pipelined CPUs, then rebase any frivolous commits starting at b44429b if needed before the final merge.

@jardhu jardhu force-pushed the integrate-new-memory branch 3 times, most recently from 581efaf to f4827be Compare July 27, 2019 07:00
@powerjg
Copy link
Contributor

powerjg commented Jul 31, 2019

Looks like we're ready to merge??? :D

@jardhu
Copy link
Collaborator Author

jardhu commented Jul 31, 2019

Not yet, the non combin memory does not work with the pipelined CPUs, but the combinational memory does. I'm debugging them right now, seems to be how I'm stalling the CPU.

@powerjg The best way to stall the entire CPU would be to set the if_id bubble to true, ex_mem bubble to true, and pcwrite to 2.0 so that the CPU doesn't proceed, correct?

@powerjg
Copy link
Contributor

powerjg commented Jul 31, 2019 via email

@jardhu jardhu changed the title Integrate combin/noncombin memory Integrate combin memory into pipelined and single-cycle CPUs Aug 2, 2019
@jardhu jardhu force-pushed the integrate-new-memory branch from b88c78f to 388baa0 Compare August 2, 2019 00:45
@jardhu
Copy link
Collaborator Author

jardhu commented Aug 2, 2019

Commit history rebased to stash away code for the non-combin memory, the PR should only involve the combinational memory except for the pipeline/bus IO commit.

I'm getting some strange dependency cycle/StackOverflowError that seems to happen randomly, but I'm positive all of the tests should pass after this force push.

@jardhu
Copy link
Collaborator Author

jardhu commented Aug 2, 2019

@powerjg, seems like the Chisel snapshots screwed up and now there's a dependency desync. Could you perhaps look at it? The only thing preventing this PR from being merged is a compilation error in the replrunner, which I haven't touched at all.

@powerjg
Copy link
Contributor

powerjg commented Aug 2, 2019

There are actually two issues. First, treadle was updated. I made the required changes to the replrunner to compile. Then, there's an issue with the output directory. I'm seeing the following:

[error] (run-main-1) firrtl.options.OptionsException: Exactly one target directory must be specified, but found `test_run_dir/pipelined/add1, test_run_dir/pipelined/add1` specified via:
[error]     - explicit target directory: -td, --target-dir, TargetDirAnnotation
[error]     - fallback default value
[error] firrtl.options.OptionsException: Exactly one target directory must be specified, but found `test_run_dir/pipelined/add1, test_run_dir/pipelined/add1` specified via:
[error]     - explicit target directory: -td, --target-dir, TargetDirAnnotation
[error]     - fallback default value

I found this: https://groups.google.com/forum/#!topic/chisel-users/SgB7M65F4Ow

If you comment out line 19 of CPUTesterDriver.scala things seem to work, but it makes a mess in the CWD.

PS: There's a bunch of warnings in configuration.scala. I'm not sure what they mean.

@powerjg
Copy link
Contributor

powerjg commented Aug 8, 2019

Looks great to me! Please rebase then merge!

PS: Could you open an issue about the output directory for the tester?

Jared Barocsi and others added 9 commits August 8, 2019 08:40
Adds parallel documentation to DMemPortIO and fixes some whitespace.

Signed-off-by: Jason Lowe-Power <[email protected]>
This will pollute the CWD with testing files in the meantime.
Be sure to not `git add .`, and instead add the files you actually changed.
@jardhu jardhu force-pushed the integrate-new-memory branch from 10ecfbd to 429192b Compare August 8, 2019 15:44
@jardhu jardhu merged commit 9ffea16 into jlpteaching:master Aug 8, 2019
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