ucb-bar / chisel2-deprecated

chisel.eecs.berkeley.edu
388 stars 90 forks source link

Warning message needed? #686

Open da-steve101 opened 8 years ago

da-steve101 commented 8 years ago

I accidentally mixed UInt and Vec assigns

class UIntToVecAssign extends Module {
  val io = new Bundle {
    val in = UInt( INPUT, 64 )
    val out = Vec.fill(8) { UInt( OUTPUT, 8 ) }
  }
  io.out := io.in
}

class UIntToVecAssignTests( c : UIntToVecAssign ) extends Tester( c ) {
  poke( c.io.in, (BigInt(1) << 64) - 1)
  peek( c.io.out )
}

The output is

  POKE _read__iw__iw__iw__iw_UIntToVecAssign.io_in <- 0xffffffffffffffff
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_7 <- 0x1
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_6 <- 0x1
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_5 <- 0x1
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_4 <- 0x1
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_3 <- 0x1
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_2 <- 0x1
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_1 <- 0x1
  PEEK _read__iw__iw__iw__iw_UIntToVecAssign.io_out_0 <- 0x1

Perhaps this should produce a warning message or be disallowed all together? If it is meant to work then there is a bug somewhere.