-trait PeripheryI2C {
- this: TopNetwork { val i2cConfigs: Seq[I2CConfig] } =>
- val i2c = i2cConfigs.zipWithIndex.map { case (c, i) =>
- val i2c = LazyModule(new TLI2C(c))
- i2c.node := TLFragmenter(peripheryBusConfig.beatBytes, cacheBlockBytes)(peripheryBus.node)
+case object PeripheryI2CKey extends Field[Seq[I2CParams]]
+
+trait HasPeripheryI2C extends HasTopLevelNetworks {
+ val i2cParams = p(PeripheryI2CKey)
+ val i2c = i2cParams map { params =>
+ val i2c = LazyModule(new TLI2C(peripheryBusBytes, params))
+ i2c.node := TLFragmenter(peripheryBusBytes, cacheBlockBytes)(peripheryBus.node)