Replies: 1 comment 8 replies
-
Yes i agree, some target specific parameters would be realy realy much needed to select default implementations
I always have been hesitante on the way to do it XD Currently there is the SpinalConfig device property which kinda of map toward that idea. case class Device(vendor: String = "?",
family: String = "?",
name: String = "?",
supportBootResetKind : Boolean = true){
def isVendorDefault = vendor == "?"
}
object Device{
val ALTERA = Device(vendor = "altera")
val XILINX = Device(vendor = "xilinx")
val LATTICE = Device(vendor = "lattice")
val ACTEL = Device(vendor = "actel")
val ASIC = Device(vendor = "asic", supportBootResetKind = false)
val NONE = Device(vendor = "none")
} Maybe it could be extended toward something which would allow : trait OhMuxImpl
object OhMuxImpl extends DeviceSetting[OhMuxImpl]
object OhMuxByOr extends OhMuxImpl
object OhMuxByMux extends OhMuxImpl
object CustomImpl extends App{
val ASIC = Device(vendor = "asic", supportBootResetKind = false) //in the example we define ASIC, but in realy this would be already defined in spinal.core itself.
ASIC(OhMuxImpl) = OhMuxByOr
val config = SpinalConfig(device = ASIC)
config.generateVerilog(new Component{
//OhMux impl
Device(OhMuxImpl) match {
case OhMuxByOr => xxx
case OhMuxByMux => yyy
}
})
} So having some sort of data base in the Spinal.core.Device base class, and being able to ask stuff to it durring generation. |
Beta Was this translation helpful? Give feedback.
8 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
As discussed in #1376, the same fundamental facility implemented by different vendors or technical would require different generating policy. However, in user's code it's best to remain the core logic unchanged.
So abstract out a vendor related HAL to fit this requirement becomes normal strategy.
For example, in user code they could do
While elaborating, the
mux
can be replaced by a vendor specific object or class.I think this could be implemented as a rework of mux, which can clear all original design of mux and adapt newly created XilinxPriorityMux into it.
However, I do not know if it is a good way to do that.
Beta Was this translation helpful? Give feedback.
All reactions