SpinalHDL / SpinalHDL

Scala based HDL
Other
1.57k stars 304 forks source link

`:=` behaves unexpectedly on `Fragment[BaseType]` #1465

Open knapheide opened 4 days ago

knapheide commented 4 days ago
import spinal.core._
import spinal.lib._

object Test extends App {
  // implicit def toDataPimper[T <: Data](_data: Fragment[T]) = new DataPimper(_data)

  SpinalConfig().generateVerilog(new Component {
    val io = new Bundle {
      val input = in port Fragment(Bool())
      val output = out port Fragment(Bool())
    }
    io.output := io.input
  })
}

In this example, i would expect := to assign both io.output.fragment and io.output.last. Instead i get an error NO DRIVER ON (toplevel/io_output_last : out Bool).

It seems the scala compiler prefers easyFragment over DataPimped because the former is more specific.

I can work around it by uncommenting line 5, but it would be nicer if it worked correctly out of the box.