Merge pull request #226 from ucb-bar/coreplex_peripheral_interrupts
Allow some External Interrupts to come from Periphery
This commit is contained in:
		| @@ -115,7 +115,10 @@ class BasePlatformConfig extends Config ( | |||||||
|           idBits = Dump("MEM_ID_BITS", site(MIFTagBits))) |           idBits = Dump("MEM_ID_BITS", site(MIFTagBits))) | ||||||
|       } |       } | ||||||
|       case BuildCoreplex => (p: Parameters) => Module(new DefaultCoreplex(p)) |       case BuildCoreplex => (p: Parameters) => Module(new DefaultCoreplex(p)) | ||||||
|       case NExtInterrupts => 2 |       case NExtTopInterrupts => 2 | ||||||
|  |       case NExtPeripheryInterrupts => site(ExtraDevices).nInterrupts | ||||||
|  |       // Note that PLIC asserts that this is > 0. | ||||||
|  |       case NExtInterrupts => site(NExtTopInterrupts) + site(NExtPeripheryInterrupts) | ||||||
|       case AsyncDebugBus => false |       case AsyncDebugBus => false | ||||||
|       case IncludeJtagDTM => false |       case IncludeJtagDTM => false | ||||||
|       case AsyncMMIOChannels => false |       case AsyncMMIOChannels => false | ||||||
| @@ -262,6 +265,7 @@ class WithTestRAM extends Config( | |||||||
|         def builder( |         def builder( | ||||||
|           mmioPorts: HashMap[String, ClientUncachedTileLinkIO], |           mmioPorts: HashMap[String, ClientUncachedTileLinkIO], | ||||||
|           clientPorts: Seq[ClientUncachedTileLinkIO], |           clientPorts: Seq[ClientUncachedTileLinkIO], | ||||||
|  |           interrupts: Seq[Bool], | ||||||
|           extra: Bundle, p: Parameters) { |           extra: Bundle, p: Parameters) { | ||||||
|           val testram = Module(new TileLinkTestRAM(ramSize)(p)) |           val testram = Module(new TileLinkTestRAM(ramSize)(p)) | ||||||
|           testram.io <> mmioPorts("testram") |           testram.io <> mmioPorts("testram") | ||||||
|   | |||||||
| @@ -14,6 +14,10 @@ abstract class DeviceBlock { | |||||||
|   def nClientPorts: Int |   def nClientPorts: Int | ||||||
|   /** Address map entries for all of the devices */ |   /** Address map entries for all of the devices */ | ||||||
|   def addrMapEntries: Seq[AddrMapEntry] |   def addrMapEntries: Seq[AddrMapEntry] | ||||||
|  |   /** | ||||||
|  |    * The total number of interrupt signals coming  | ||||||
|  |    *  from all the devices                       */ | ||||||
|  |   def nInterrupts : Int = 0 | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
|    * The function that elaborates all the extra devices and connects them |    * The function that elaborates all the extra devices and connects them | ||||||
| @@ -23,12 +27,14 @@ abstract class DeviceBlock { | |||||||
|    *    Use the names specified in addrMapEntries to get |    *    Use the names specified in addrMapEntries to get | ||||||
|    *    the mmio port for each device. |    *    the mmio port for each device. | ||||||
|    * @param clientPorts All the client ports available for the devices |    * @param clientPorts All the client ports available for the devices | ||||||
|  |    * @param interrupts External interrupts from Periphery to Coreplex  | ||||||
|    * @param extra The extra top-level IO bundle |    * @param extra The extra top-level IO bundle | ||||||
|    * @param p The CDE parameters for the devices |    * @param p The CDE parameters for the devices | ||||||
|    */ |    */ | ||||||
|   def builder( |   def builder( | ||||||
|     mmioPorts: HashMap[String, ClientUncachedTileLinkIO], |     mmioPorts: HashMap[String, ClientUncachedTileLinkIO], | ||||||
|     clientPorts: Seq[ClientUncachedTileLinkIO], |     clientPorts: Seq[ClientUncachedTileLinkIO], | ||||||
|  |     interrupts : Seq[Bool], | ||||||
|     extra: Bundle, p: Parameters): Unit |     extra: Bundle, p: Parameters): Unit | ||||||
|  |  | ||||||
|   /** |   /** | ||||||
| @@ -46,6 +52,8 @@ abstract class DeviceBlock { | |||||||
|        "}\n" |        "}\n" | ||||||
|     }.mkString |     }.mkString | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |  | ||||||
| } | } | ||||||
|  |  | ||||||
| class EmptyDeviceBlock extends DeviceBlock { | class EmptyDeviceBlock extends DeviceBlock { | ||||||
| @@ -55,5 +63,6 @@ class EmptyDeviceBlock extends DeviceBlock { | |||||||
|   def builder( |   def builder( | ||||||
|     mmioPorts: HashMap[String, ClientUncachedTileLinkIO], |     mmioPorts: HashMap[String, ClientUncachedTileLinkIO], | ||||||
|     clientPorts: Seq[ClientUncachedTileLinkIO], |     clientPorts: Seq[ClientUncachedTileLinkIO], | ||||||
|  |     interrupts : Seq[Bool],  | ||||||
|     extra: Bundle, p: Parameters) {} |     extra: Bundle, p: Parameters) {} | ||||||
| } | } | ||||||
|   | |||||||
| @@ -47,6 +47,11 @@ case object BuildCoreplex extends Field[Parameters => Coreplex] | |||||||
| case object ConnectExtraPorts extends Field[(Bundle, Bundle, Parameters) => Unit] | case object ConnectExtraPorts extends Field[(Bundle, Bundle, Parameters) => Unit] | ||||||
| /** Specifies the size of external memory */ | /** Specifies the size of external memory */ | ||||||
| case object ExtMemSize extends Field[Long] | case object ExtMemSize extends Field[Long] | ||||||
|  | /** Specifies the actual sorce of External Interrupts as Top and Periphery. | ||||||
|  |   *  NExtInterrupts = NExtTopInterrupts + NExtPeripheryInterrupts  | ||||||
|  |   **/ | ||||||
|  | case object NExtTopInterrupts extends Field[Int] | ||||||
|  | case object NExtPeripheryInterrupts extends Field[Int] | ||||||
|  |  | ||||||
| /** Utility trait for quick access to some relevant parameters */ | /** Utility trait for quick access to some relevant parameters */ | ||||||
| trait HasTopLevelParameters { | trait HasTopLevelParameters { | ||||||
| @@ -79,7 +84,7 @@ class TopIO(implicit p: Parameters) extends BasicTopIO()(p) { | |||||||
|   val mem_axi = Vec(nMemAXIChannels, new NastiIO) |   val mem_axi = Vec(nMemAXIChannels, new NastiIO) | ||||||
|   val mem_ahb = Vec(nMemAHBChannels, new HastiMasterIO) |   val mem_ahb = Vec(nMemAHBChannels, new HastiMasterIO) | ||||||
|   val mem_tl  = Vec(nMemTLChannels,  new ClientUncachedTileLinkIO()(outermostParams)) |   val mem_tl  = Vec(nMemTLChannels,  new ClientUncachedTileLinkIO()(outermostParams)) | ||||||
|   val interrupts = Vec(p(NExtInterrupts), Bool()).asInput |   val interrupts = Vec(p(NExtTopInterrupts), Bool()).asInput | ||||||
|   val bus_clk = if (p(AsyncBusChannels)) Some(Vec(p(NExtBusAXIChannels), Clock(INPUT))) else None |   val bus_clk = if (p(AsyncBusChannels)) Some(Vec(p(NExtBusAXIChannels), Clock(INPUT))) else None | ||||||
|   val bus_rst = if (p(AsyncBusChannels)) Some(Vec(p(NExtBusAXIChannels), Bool (INPUT))) else None |   val bus_rst = if (p(AsyncBusChannels)) Some(Vec(p(NExtBusAXIChannels), Bool (INPUT))) else None | ||||||
|   val bus_axi = Vec(p(NExtBusAXIChannels), new NastiIO).flip |   val bus_axi = Vec(p(NExtBusAXIChannels), new NastiIO).flip | ||||||
| @@ -181,7 +186,11 @@ class Top(topParams: Parameters) extends Module with HasTopLevelParameters { | |||||||
|       asyncAxiFrom(io.bus_clk.get, io.bus_rst.get, io.bus_axi) |       asyncAxiFrom(io.bus_clk.get, io.bus_rst.get, io.bus_axi) | ||||||
|     else io.bus_axi) |     else io.bus_axi) | ||||||
|  |  | ||||||
|   coreplex.io.interrupts <> io.interrupts |   // This places the Periphery Interrupts at Bits [0...] | ||||||
|  |   // Top-level interrupts are at the higher Bits. | ||||||
|  |   // This may have some implications for prioritization of the interrupts, | ||||||
|  |   // but PLIC could do some internal swizzling in the future. | ||||||
|  |   coreplex.io.interrupts <> (periphery.io.interrupts ++ io.interrupts) | ||||||
|  |  | ||||||
|   io.extra <> periphery.io.extra |   io.extra <> periphery.io.extra | ||||||
|   p(ConnectExtraPorts)(io.extra, coreplex.io.extra, p) |   p(ConnectExtraPorts)(io.extra, coreplex.io.extra, p) | ||||||
| @@ -200,6 +209,7 @@ class Periphery(implicit val p: Parameters) extends Module | |||||||
|     val mmio_axi = Vec(p(NExtMMIOAXIChannels), new NastiIO) |     val mmio_axi = Vec(p(NExtMMIOAXIChannels), new NastiIO) | ||||||
|     val mmio_ahb = Vec(p(NExtMMIOAHBChannels), new HastiMasterIO) |     val mmio_ahb = Vec(p(NExtMMIOAHBChannels), new HastiMasterIO) | ||||||
|     val mmio_tl  = Vec(p(NExtMMIOTLChannels),  new ClientUncachedTileLinkIO()(outermostMMIOParams)) |     val mmio_tl  = Vec(p(NExtMMIOTLChannels),  new ClientUncachedTileLinkIO()(outermostMMIOParams)) | ||||||
|  |     val interrupts = Vec(p(NExtPeripheryInterrupts), Bool()).asOutput | ||||||
|     val extra = p(ExtraTopPorts)(p) |     val extra = p(ExtraTopPorts)(p) | ||||||
|   } |   } | ||||||
|  |  | ||||||
| @@ -255,7 +265,8 @@ class Periphery(implicit val p: Parameters) extends Module | |||||||
|       case OuterTLId => "L1toL2"   // Device client port |       case OuterTLId => "L1toL2"   // Device client port | ||||||
|     }) |     }) | ||||||
|  |  | ||||||
|     extraDevices.builder(deviceMMIO.result(), deviceClients, io.extra, buildParams) |     extraDevices.builder(deviceMMIO.result(), deviceClients, | ||||||
|  |                          io.interrupts, io.extra, buildParams) | ||||||
|  |  | ||||||
|     val ext = p(ExtMMIOPorts).map( |     val ext = p(ExtMMIOPorts).map( | ||||||
|       port => TileLinkWidthAdapter(mmioNetwork.port(port.name), "MMIO_Outermost")) |       port => TileLinkWidthAdapter(mmioNetwork.port(port.name), "MMIO_Outermost")) | ||||||
|   | |||||||
| @@ -191,6 +191,7 @@ class WithBusMasterTest extends Config( | |||||||
|         def builder( |         def builder( | ||||||
|           mmioPorts: HashMap[String, ClientUncachedTileLinkIO], |           mmioPorts: HashMap[String, ClientUncachedTileLinkIO], | ||||||
|           clientPorts: Seq[ClientUncachedTileLinkIO], |           clientPorts: Seq[ClientUncachedTileLinkIO], | ||||||
|  |           interrupts : Seq[Bool],  | ||||||
|           extra: Bundle, p: Parameters) { |           extra: Bundle, p: Parameters) { | ||||||
|           val busmaster = Module(new ExampleBusMaster()(p)) |           val busmaster = Module(new ExampleBusMaster()(p)) | ||||||
|           busmaster.io.mmio <> mmioPorts("busmaster") |           busmaster.io.mmio <> mmioPorts("busmaster") | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user