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

Catting a UInt of width 0 leads to strange sim results #697

Open
da-steve101 opened this issue Apr 26, 2016 · 1 comment
Open

Catting a UInt of width 0 leads to strange sim results #697

da-steve101 opened this issue Apr 26, 2016 · 1 comment

Comments

@da-steve101
Copy link
Contributor

The catting a UInt of width 0 onto a value causes strange results in c simulation

class UserMod extends Module {
  val io = new Bundle {
    val in = UInt( INPUT, 8 )
    val out = UInt( OUTPUT, 8 )
  }
  io.out := ( io.in ## UInt( width = 0 ) )
}

class UserModTests( c : UserMod ) extends Tester( c ) {
  poke( c.io.in, 3 )
  step(1)
  expect( c.io.out, 3 )
  poke( c.io.in, 5 )
  step(1)
  expect( c.io.out, 5 )
}

The output is

  POKE _read__iw__iw__iw__iw_UserMod.io_in <- 0x3
STEP 1 -> 1
  EXPECT _read__iw__iw__iw__iw_UserMod.io_out -> 0xe0 == 0x3 FAIL
  POKE _read__iw__iw__iw__iw_UserMod.io_in <- 0x5
STEP 1 -> 2
  EXPECT _read__iw__iw__iw__iw_UserMod.io_out -> 0xe0 == 0x5 FAIL
@ucbjrl
Copy link
Contributor

ucbjrl commented Apr 27, 2016

This requires explicitly enabling zero-width wire support. Try adding the

--W0W

parameter to the chiselMain() argument list.

We should either make this (zero-width wire support) the default, or generate an error when we encounter zero-width wires.

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

No branches or pull requests

2 participants