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

Registers Update on the Wrong Cycle #216

Closed
ben-k opened this Issue May 16, 2014 · 9 comments

Comments

Projects
None yet
7 participants
@ben-k
Member

ben-k commented May 16, 2014

Whether using the Tester class or a vcd, Chisel displays the input value of registers, rather than the output, which I don't think is correct behavior. Here's a very simple example:

class Cordic extends Module {
val io = new CordicIo()
val delay = Reg(next=io.in,init=Bool(false))
io.out := delay
}

And here's the Tester result:

STEP 2 -> 2
POKE Cordic.io_in <- 1
STEP 1 -> 3
PEEK Cordic.io_in -> 0x1
PEEK Cordic.delay -> 0x1
PEEK Cordic.io_out -> 0x0
POKE Cordic.io_in <- 0
STEP 1 -> 4
PEEK Cordic.io_in -> 0x0
PEEK Cordic.delay -> 0x0
PEEK Cordic.io_out -> 0x1

Delay is always displayed according to its input value, rather than its output. In particular, io.out is combinationally wired directly to the output of delay, so out and delay should never be different.

I don't think this necessarily impacts functionality, but it makes debugging using the Tester class or Chisel-generated waveforms very confusing.

@albert-magyar

This comment has been minimized.

Show comment
Hide comment
@albert-magyar

albert-magyar May 16, 2014

Contributor

Here, it's not actually showing the input value of the registers. The behavior is that stepping the circuit does a clock_lo followed by a clock_hi, which results in updates to register values from the clock_hi not propagating through any combinational nodes (including wires) to affect values of downstream nodes until another step is performed. This is also mirrored in VCDs from testers. There is ongoing discussion about whether to change this often-confusing behavior.

Contributor

albert-magyar commented May 16, 2014

Here, it's not actually showing the input value of the registers. The behavior is that stepping the circuit does a clock_lo followed by a clock_hi, which results in updates to register values from the clock_hi not propagating through any combinational nodes (including wires) to affect values of downstream nodes until another step is performed. This is also mirrored in VCDs from testers. There is ongoing discussion about whether to change this often-confusing behavior.

@aswaterman

This comment has been minimized.

Show comment
Hide comment
@aswaterman

aswaterman May 16, 2014

Contributor

It's not just confusing; it's wrong, and we should fix it.

On Fri, May 16, 2014 at 3:02 PM, Albert Magyar notifications@github.comwrote:

Here, it's not actually showing the input value of the registers. The
behavior is that stepping the circuit does a clock_lo followed by a
clock_hi, which results in updates to register values from the clock_hinot propagating through any combinational nodes (including wires) to affect
values of downstream nodes until another step is performed. This is also
mirrored in VCDs from testers. There is ongoing discussion about whether to
change this often-confusing behavior.


Reply to this email directly or view it on GitHubhttps://github.com/ucb-bar/chisel/issues/216#issuecomment-43384247
.

Contributor

aswaterman commented May 16, 2014

It's not just confusing; it's wrong, and we should fix it.

On Fri, May 16, 2014 at 3:02 PM, Albert Magyar notifications@github.comwrote:

Here, it's not actually showing the input value of the registers. The
behavior is that stepping the circuit does a clock_lo followed by a
clock_hi, which results in updates to register values from the clock_hinot propagating through any combinational nodes (including wires) to affect
values of downstream nodes until another step is performed. This is also
mirrored in VCDs from testers. There is ongoing discussion about whether to
change this often-confusing behavior.


Reply to this email directly or view it on GitHubhttps://github.com/ucb-bar/chisel/issues/216#issuecomment-43384247
.

@albert-magyar

This comment has been minimized.

Show comment
Hide comment
@albert-magyar

albert-magyar May 16, 2014

Contributor

I personally agree that it was wrong, but there was some debate when I was presenting a possible change for this at the Chisel meeting. Jonathan and I came up with some optimizations for minimizing the performance costs of the extra computation when propagating signals properly for use with the tester, and the plan should be to settle all the tester-behavior questions as soon as possible.

Contributor

albert-magyar commented May 16, 2014

I personally agree that it was wrong, but there was some debate when I was presenting a possible change for this at the Chisel meeting. Jonathan and I came up with some optimizations for minimizing the performance costs of the extra computation when propagating signals properly for use with the tester, and the plan should be to settle all the tester-behavior questions as soon as possible.

@ben-k

This comment has been minimized.

Show comment
Hide comment
@ben-k

ben-k May 17, 2014

Member

To the extent that there is debate about this, I would add that everyone in 290C this semester (BWRC folks, mostly) thought that this behavior didn't make any sense.

Member

ben-k commented May 17, 2014

To the extent that there is debate about this, I would add that everyone in 290C this semester (BWRC folks, mostly) thought that this behavior didn't make any sense.

@sdtwigg

This comment has been minimized.

Show comment
Hide comment
@sdtwigg

sdtwigg May 17, 2014

Contributor

I just checked and this seems to also be a new issue for vcd dumping. I had fixed it before so that the dump function was being called in-between clock_lo and clock_hi (this would then at least dump waveforms that could be somewhat reasoned over); however, with the tester rewrite the same trick cannot be immediately employed.

Contributor

sdtwigg commented May 17, 2014

I just checked and this seems to also be a new issue for vcd dumping. I had fixed it before so that the dump function was being called in-between clock_lo and clock_hi (this would then at least dump waveforms that could be somewhat reasoned over); however, with the tester rewrite the same trick cannot be immediately employed.

@schoeberl

This comment has been minimized.

Show comment
Hide comment
@schoeberl

schoeberl May 18, 2014

Member

If this is still the display of the 'input' value of a register at the waveform, then I also strongly think this is wrong. You see the value 'shifted' by a clock cycle. This confused quite some of my students.

Another argument: compare it with the waveform when simulating the Verilog in ModelSim where you will see the 'output' of the register.

Cheers,
Martin

On 17 May 2014, at 01:05, Albert Magyar notifications@github.com wrote:

I personally agree that it was wrong, but there was some debate when I was presenting a possible change for this at the Chisel meeting. Jonathan and I came up with some optimizations for minimizing the performance costs of the extra computation when propagating signals properly for use with the tester, and the plan should be to settle all the tester-behavior questions as soon as possible.


Reply to this email directly or view it on GitHub.

Member

schoeberl commented May 18, 2014

If this is still the display of the 'input' value of a register at the waveform, then I also strongly think this is wrong. You see the value 'shifted' by a clock cycle. This confused quite some of my students.

Another argument: compare it with the waveform when simulating the Verilog in ModelSim where you will see the 'output' of the register.

Cheers,
Martin

On 17 May 2014, at 01:05, Albert Magyar notifications@github.com wrote:

I personally agree that it was wrong, but there was some debate when I was presenting a possible change for this at the Chisel meeting. Jonathan and I came up with some optimizations for minimizing the performance costs of the extra computation when propagating signals properly for use with the tester, and the plan should be to settle all the tester-behavior questions as soon as possible.


Reply to this email directly or view it on GitHub.

@stevobailey

This comment has been minimized.

Show comment
Hide comment
@stevobailey

stevobailey Jun 23, 2014

I'd like to refresh this discussion and make sure someone is working on fixing it. It feels like a rather problematic bug.

stevobailey commented Jun 23, 2014

I'd like to refresh this discussion and make sure someone is working on fixing it. It feels like a rather problematic bug.

@albert-magyar

This comment has been minimized.

Show comment
Hide comment
@albert-magyar

albert-magyar Jun 24, 2014

Contributor

There is a fix for this that will be going in ASAP, likely in the next day when I return to Berkeley.

Contributor

albert-magyar commented Jun 24, 2014

There is a fix for this that will be going in ASAP, likely in the next day when I return to Berkeley.

@schoeberl

This comment has been minimized.

Show comment
Hide comment
@schoeberl

schoeberl Jun 24, 2014

Member

That's very good news ;-)

Cheers,
Martin

On 24 Jun 2014, at 02:36, Albert Magyar notifications@github.com wrote:

There is a fix for this that will be going in ASAP, likely in the next day when I return to Berkeley.


Reply to this email directly or view it on GitHub.

Member

schoeberl commented Jun 24, 2014

That's very good news ;-)

Cheers,
Martin

On 24 Jun 2014, at 02:36, Albert Magyar notifications@github.com wrote:

There is a fix for this that will be going in ASAP, likely in the next day when I return to Berkeley.


Reply to this email directly or view it on GitHub.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment