Updates to Freedom SoCs
[freedom-sifive.git] / src / main / scala / everywhere / e300artydevkit / Config.scala
diff --git a/src/main/scala/everywhere/e300artydevkit/Config.scala b/src/main/scala/everywhere/e300artydevkit/Config.scala
new file mode 100644 (file)
index 0000000..a85d1e6
--- /dev/null
@@ -0,0 +1,65 @@
+// See LICENSE for license details.
+package sifive.freedom.everywhere.e300artydevkit
+
+import freechips.rocketchip.config._
+import freechips.rocketchip.coreplex._
+import freechips.rocketchip.devices.debug._
+import freechips.rocketchip.devices.tilelink._
+import freechips.rocketchip.diplomacy.{DTSModel, DTSTimebase}
+import freechips.rocketchip.system._
+import freechips.rocketchip.tile._
+
+import sifive.blocks.devices.mockaon._
+import sifive.blocks.devices.gpio._
+import sifive.blocks.devices.pwm._
+import sifive.blocks.devices.spi._
+import sifive.blocks.devices.uart._
+import sifive.blocks.devices.i2c._
+
+// Default FreedomEConfig
+class DefaultFreedomEConfig extends Config (
+  new WithNBreakpoints(2)        ++
+  new WithNExtTopInterrupts(0)   ++
+  new WithJtagDTM                ++
+  new TinyConfig
+)
+
+// Freedom E300 Arty Dev Kit Peripherals
+class E300DevKitPeripherals extends Config((site, here, up) => {
+  case PeripheryGPIOKey => List(
+    GPIOParams(address = 0x10012000, width = 32, includeIOF = true))
+  case PeripheryPWMKey => List(
+    PWMParams(address = 0x10015000, cmpWidth = 8),
+    PWMParams(address = 0x10025000, cmpWidth = 16),
+    PWMParams(address = 0x10035000, cmpWidth = 16))
+  case PeripherySPIKey => List(
+    SPIParams(csWidth = 4, rAddress = 0x10024000, sampleDelay = 3),
+    SPIParams(csWidth = 1, rAddress = 0x10034000, sampleDelay = 3))
+  case PeripherySPIFlashKey => List(
+    SPIFlashParams(
+      fAddress = 0x20000000,
+      rAddress = 0x10014000,
+      sampleDelay = 3))
+  case PeripheryUARTKey => List(
+    UARTParams(address = 0x10013000),
+    UARTParams(address = 0x10023000))
+  case PeripheryI2CKey => List(
+    I2CParams(address = 0x10016000))
+  case PeripheryMockAONKey =>
+    MockAONParams(address = 0x10000000)
+  case PeripheryMaskROMKey => List(
+    MaskROMParams(address = 0x10000, name = "BootROM"))
+})
+
+// Freedom E300 Arty Dev Kit Peripherals
+class E300ArtyDevKitConfig extends Config(
+  new E300DevKitPeripherals    ++
+  new DefaultFreedomEConfig().alter((site,here,up) => {
+    case DTSTimebase => BigInt(32768)
+    case JtagDTMKey => new JtagDTMConfig (
+      idcodeVersion = 2,
+      idcodePartNum = 0x000,
+      idcodeManufId = 0x489,
+      debugIdleCycles = 5)
+  })
+)