ucb-bar / chisel2-deprecated

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

The <> operator and overriding #685

Closed da-steve101 closed 8 years ago

da-steve101 commented 8 years ago

The <> operator does not override := Is this intentional?

class MyBundle extends Bundle {
  val a = UInt( INPUT, 4 )
  val b = UInt( INPUT, 4 )
}

class UserMod extends Module {
  val io = new Bundle {
    val in = new MyBundle
    val out = (new MyBundle).flip
  }
  val c = RegNext( io.in )
  io.out.a := UInt( 0, 4 )
  io.out.b := UInt( 0, 4 )
  io.out <> c
}

class UserModTests( c : UserMod ) extends Tester( c ) {
  poke( c.io.in.a, 4 )
  poke( c.io.in.b, 5 )
  step(1)
  expect( c.io.out.a, 4 )
  expect( c.io.out.b, 5 )
}
maltanar commented 8 years ago

The 2.2 manual says the following:

The <> operator bulk connects interfaces of opposite gender between sibling modules or interfaces of same gender between parent/child modules. Bulk connections connect leaf ports using pathname matching. **Connections are only made if one of the ports is non-null**, allowing users to repeatedly bulk-connect partially filled interfaces.

I interpret non-null here as not connected to anything else previously, hence <> not overriding := should be expected behavior.