-
Notifications
You must be signed in to change notification settings - Fork 38
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
Conversation
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 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 |
That seems like a fine short term fix. Does it work if you add that option? |
There was a problem hiding this 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?
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. |
Changes look good! Sounds like we're getting somewhere! |
49e4b66
to
9223254
Compare
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 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. |
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:
|
e0650dc
to
c7f6ec7
Compare
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. |
581efaf
to
f4827be
Compare
Looks like we're ready to merge??? :D |
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? |
Seems reasonable, but let's talk more details in our meeting today.
…On Wed, Jul 31, 2019 at 4:01 AM Jared Barocsi ***@***.***> wrote:
So, I need to make a more fundamental change to the design of the
pipelined CPU that will deviate slightly from the pattern in Patterson &
Hennessy.
I need to be able to freeze the ex_mem register - right now, the CPU flushes
the register with 0 when there is a bubble
<https://github.com/jlpteaching/dinocpu/blob/bb0ca05b56d5dd7503555851c1abbbd1d266ad70/src/main/scala/pipelined/cpu.scala#L296-L302>,
but the control signals otherwise propagate through to the mem_wb stage.
This results in some *desync* between the writeback signals and the
readdata signal, which is delayed.
I took the lw1 test and added some relevant debug info:
...
>>> Cycle #7
PC: 12
1 => 0 => 0 (readdata = 0)
Issuing a read
>>> Cycle #8
PC: 16
0 => 1 => 0 (readdata = 0)
*** Stalling! ***
>>> Cycle #9
PC: 20
0 => 0 => 1 (readdata = 0)
*** Stalling! ***
>>> Cycle #10
PC: 20
0 => 0 => 0 (readdata = 0)
*** Stalling! ***
>>> Cycle #11
PC: 20
0 => 0 => 0 (readdata = 0)
*** Stalling! ***
Data received: 4294967295
>>> Cycle #12
PC: 20
0 => 0 => 0 (readdata = 0)
*** Stalling! ***
>>> Cycle #13
PC: 20
0 => 0 => 0 (readdata = 0)
>>> Cycle #14
PC: 24
0 => 0 => 0 (readdata = 4294967295)
>>> Cycle #15
PC: 28
0 => 0 => 0 (readdata = 0)
This corresponds with a lw t0, 0x400(zero) instruction entering the mem
stage, being delayed for five cycles (the configured latency), and
continuing on with execution.
The third line of each cycle printout (x => x => x) corresponds with the
wbcontrol.toreg signal in the id_ex, ex_mem, and mem_wb registers
respectively. The readdata corresponds with mem_wb.readdata.
The main issue is that at cycle #9
<#9> (a stalling cycle), the
desired toreg signal, 1, is located in mem_wb, so the CPU will write back
the contents of readdata, which is 0. At cycle #14
<#14>, mem_wb.readdata is set
to 0xFFFFFFFF, but toreg is 0 in mem_wb. So the readdata is lost entirely.
Ideally I must be able to freeze ex_mem as so:
...
>>> Cycle #7
PC: 12
1 => 0 => 0 (readdata = 0)
Issuing a read
>>> Cycle #8
PC: 16
0 => 1 => 0 (readdata = 0)
*** Stalling! ***
>>> Cycle #9
PC: 20
0 => 1 => 0 (readdata = 0)
*** Stalling! ***
>>> Cycle #10
PC: 20
0 => 1 => 0 (readdata = 0)
*** Stalling! ***
>>> Cycle #11
PC: 20
0 => 1 => 0 (readdata = 0)
*** Stalling! ***
Data received: 4294967295
>>> Cycle #12
PC: 20
*** Stalling! ***
0 => 1 => 0 (readdata = 0)
>>> Cycle #13
PC: 20
0 => 1 => 0 (readdata = 0)
>>> Cycle #14
PC: 24
0 => 0 => 1 (readdata = 4294967295)
>>> Cycle #15
PC: 28
0 => 0 => 0 (readdata = 0)
>>> Cycle #16
Which would synchronize the readdata and toreg signals properly.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#82?email_source=notifications&email_token=AAA2YHHY2VF6BQSB5QVINRTQCFWHBA5CNFSM4IGOW5K2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD3G4LVQ#issuecomment-516802006>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAA2YHG3RYMGGLWBC5FVY33QCFWHBANCNFSM4IGOW5KQ>
.
--
Jason Lowe-Power (he/him/his)
Assistant Professor, Computer Science Department
University of California, Davis
3049 Kemper Hall
https://arch.cs.ucdavis.edu/
|
b88c78f
to
388baa0
Compare
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/ |
@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. |
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:
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 |
Looks great to me! Please rebase then merge! PS: Could you open an issue about the output directory for the tester? |
All single cycle CPU tests now pass.
Adds parallel documentation to DMemPortIO and fixes some whitespace. Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
Signed-off-by: Jason Lowe-Power <jason@lowepower.com>
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.
10ecfbd
to
429192b
Compare
This PR (hopefully) modifies the existing CPU models to use the newer memory with no side effects to overall functionality.