Skip to content

Commit

Permalink
Bump
Browse files Browse the repository at this point in the history
  • Loading branch information
abejgonzalez committed Aug 9, 2024
1 parent 1ab01dd commit 61b5ebc
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 122 deletions.
49 changes: 22 additions & 27 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ lazy val chiselSettings = (if (chisel6) chisel6Settings else chisel3Settings) ++
lazy val hardfloat = freshProject("hardfloat", file("generators/hardfloat/hardfloat"))
.settings(chiselSettings)
.settings(commonSettings)
.dependsOn(if (chisel6) midasStandaloneTargetUtils else midasTargetUtils)
.dependsOn(if (chisel6) midas_standalone_target_utils else midas_target_utils)
.settings(
libraryDependencies ++= Seq(
"org.scalatest" %% "scalatest" % "3.2.0" % "test"
Expand Down Expand Up @@ -149,15 +149,6 @@ lazy val rocketLibDeps = (rocketchip / Keys.libraryDependencies)

// -- Chipyard-managed External Projects --

// Contains annotations & firrtl passes you may wish to use in rocket-chip without
// introducing a circular dependency between RC and MIDAS
lazy val midasTargetUtils = (project in file ("sims/firesim/sim/midas/targetutils"))
.settings(commonSettings)
.settings(chiselSettings)
lazy val midasStandaloneTargetUtils = (project in file("tools/midas-targetutils"))
.settings(commonSettings)
.settings(chiselSettings)

lazy val testchipip = (project in file("generators/testchipip"))
.dependsOn(rocketchip, rocketchip_blocks)
.settings(libraryDependencies ++= rocketLibDeps.value)
Expand Down Expand Up @@ -321,40 +312,44 @@ lazy val rocketchip_inclusive_cache = (project in file("generators/rocket-chip-i
.dependsOn(rocketchip)
.settings(libraryDependencies ++= rocketLibDeps.value)

lazy val fpga_shells = (project in file("./fpga/fpga-shells"))
.dependsOn(rocketchip, rocketchip_blocks)
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(commonSettings)

lazy val chipyard_fpga = (project in file("./fpga"))
.dependsOn(chipyard, fpga_shells)
.settings(commonSettings)

// Components of FireSim

lazy val firesimAsLibrary = sys.env.get("FIRESIM_STANDALONE") == None
lazy val firesimDir = if(firesimAsLibrary) {
file("sims/firesim")
} else {
file("sims/firesim-staging/firesim-symlink")
}

// Library components of FireSim
lazy val midas = (project in firesimDir / "sim/midas")
.dependsOn(rocketchip, midasTargetUtils)
.settings(libraryDependencies ++= Seq(
"org.scalatestplus" %% "scalacheck-1-14" % "3.1.3.0" % "test"))
// Contains annotations & firrtl passes you may wish to use in rocket-chip without
// introducing a circular dependency between RC and MIDAS
lazy val midas_target_utils = (project in firesimDir / "sim/midas/targetutils")
.settings(commonSettings)
.settings(chiselSettings)

lazy val midas_standalone_target_utils = (project in file("tools/midas-targetutils"))
.settings(commonSettings)
.settings(chiselSettings)

lazy val firesimLib = (project in firesimDir / "sim/firesim-lib")
.dependsOn(midas)
lazy val firesim_lib = (project in firesimDir / "sim/firesim-lib")
.dependsOn(midas_target_utils)
.settings(commonSettings)
.settings(chiselSettings)

lazy val firechip = (project in file("generators/firechip"))
.dependsOn(chipyard, midasTargetUtils, midas, firesimLib % "test->test;compile->compile")
.dependsOn(chipyard, firesim_lib)
.settings(
chiselSettings,
commonSettings,
Test / testGrouping := isolateAllTests( (Test / definedTests).value ),
Test / testOptions += Tests.Argument("-oF")
)

lazy val fpga_shells = (project in file("./fpga/fpga-shells"))
.dependsOn(rocketchip, rocketchip_blocks)
.settings(libraryDependencies ++= rocketLibDeps.value)
.settings(commonSettings)

lazy val chipyard_fpga = (project in file("./fpga"))
.dependsOn(chipyard, fpga_shells)
.settings(commonSettings)
38 changes: 0 additions & 38 deletions generators/firechip/src/main/scala/bridges/Config.scala

This file was deleted.

8 changes: 8 additions & 0 deletions generators/firechip/src/main/scala/bridges/Configs.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@
package firesim.bridges

import org.chipsalliance.cde.config.Config
import freechips.rocketchip.subsystem.{PeripheryBusKey, PeripheryBusParams}
import testchipip.iceblk.{BlockDeviceConfig, BlockDeviceKey}
import firesim.bridges.{LoopbackNIC}

// Enables NIC loopback the NIC widget
class WithNICWidgetLoopback extends Config((site, here, up) => {
case LoopbackNIC => true
})

class BlockDevConfig
extends Config((site, here, up) => {
case PeripheryBusKey =>
case BlockDeviceKey => Some(BlockDeviceConfig())
})
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,12 @@ package firesim.bridges
import chisel3._

import org.chipsalliance.cde.config.Parameters
import freechips.rocketchip.subsystem.PeripheryBusKey

import sifive.blocks.devices.uart.UARTParams

class UARTDUT(implicit val p: Parameters) extends Module {
val uartParams = UARTParams(address = 0x10013000)

val ep = Module(new UARTBridge(uartParams, p(PeripheryBusKey).dtsFrequency.get.toInt / 1000000))
val ep = Module(new UARTBridge(uartParams, 1e8 / 1e6))
ep.io.reset := reset
ep.io.clock := clock
ep.io.uart.txd := ep.io.uart.rxd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,60 +11,6 @@ import sifive.blocks.devices.uart.{UARTPortIO, UARTParams}
//Note: This file is heavily commented as it serves as a bridge walkthrough
//example in the FireSim docs

// DOC include start: UART Bridge Target-Side Interface
class UARTBridgeTargetIO(val uParams: UARTParams) extends Bundle {
val clock = Input(Clock())
val uart = Flipped(new UARTPortIO(uParams))
// Note this reset is optional and used only to reset target-state modelled
// in the bridge This reset just like any other Bool included in your target
// interface, simply appears as another Bool in the input token.
val reset = Input(Bool())
}
// DOC include end: UART Bridge Target-Side Interface

// DOC include start: UART Bridge Constructor Arg
// Out bridge module constructor argument. This captures all of the extra
// metadata we'd like to pass to the host-side BridgeModule. Note, we need to
// use a single case class to do so, even if it is simply to wrap a primitive
// type, as is the case for UART (int)
case class UARTKey(uParams: UARTParams, div: Int)
// DOC include end: UART Bridge Constructor Arg

// DOC include start: UART Bridge Target-Side Module
class UARTBridge(uParams: UARTParams, freqMHz: Int)(implicit p: Parameters) extends BlackBox
with Bridge[HostPortIO[UARTBridgeTargetIO], UARTBridgeModule] {
// Since we're extending BlackBox this is the port will connect to in our target's RTL
val io = IO(new UARTBridgeTargetIO(uParams))
// Implement the bridgeIO member of Bridge using HostPort. This indicates that
// we want to divide io, into a bidirectional token stream with the input
// token corresponding to all of the inputs of this BlackBox, and the output token consisting of
// all of the outputs from the BlackBox
val bridgeIO = HostPort(io)

// Do some intermediate work to compute our host-side BridgeModule's constructor argument
val baudrate = uParams.initBaudRate
val div = (BigInt(freqMHz) * 1000000 / baudrate).toInt

// And then implement the constructorArg member
val constructorArg = Some(UARTKey(uParams, div))

// Finally, and this is critical, emit the Bridge Annotations -- without
// this, this BlackBox would appear like any other BlackBox to Golden Gate
generateAnnotations()
}
// DOC include end: UART Bridge Target-Side Module

// DOC include start: UART Bridge Companion Object
object UARTBridge {
def apply(clock: Clock, uart: UARTPortIO, reset: Bool, freqMHz: Int)(implicit p: Parameters): UARTBridge = {
val ep = Module(new UARTBridge(uart.c, freqMHz))
ep.io.uart <> uart
ep.io.clock := clock
ep.io.reset := reset
ep
}
}
// DOC include end: UART Bridge Companion Object

// DOC include start: UART Bridge Header
// Our UARTBridgeModule definition, note:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
//See LICENSE for license details
package firesim.bridges

import midas.widgets._

import chisel3._
import chisel3.util._
import org.chipsalliance.cde.config.Parameters
import sifive.blocks.devices.uart.{UARTPortIO, UARTParams}

//Note: This file is heavily commented as it serves as a bridge walkthrough
//example in the FireSim docs


// DOC include start: UART Bridge Target-Side Interface
class UARTBridgeTargetIO(val uParams: UARTParams) extends Bundle {
val clock = Input(Clock())
val uart = Flipped(new UARTPortIO(uParams))
// Note this reset is optional and used only to reset target-state modelled
// in the bridge This reset just like any other Bool included in your target
// interface, simply appears as another Bool in the input token.
val reset = Input(Bool())
}
// DOC include end: UART Bridge Target-Side Interface

// DOC include start: UART Bridge Constructor Arg
// Out bridge module constructor argument. This captures all of the extra
// metadata we'd like to pass to the host-side BridgeModule. Note, we need to
// use a single case class to do so, even if it is simply to wrap a primitive
// type, as is the case for UART (int)
case class UARTKey(uParams: UARTParams, div: Int)
// DOC include end: UART Bridge Constructor Arg

// DOC include start: UART Bridge Target-Side Module
class UARTBridge(uParams: UARTParams, freqMHz: Int)(implicit p: Parameters) extends BlackBox
with Bridge {
// Module portion corresponding to this bridge
val moduleName = "UARTBridgeModule"
// Since we're extending BlackBox this is the port will connect to in our target's RTL
val io = IO(new UARTBridgeTargetIO(uParams))
// Implement the bridgeIO member of Bridge using HostPort. This indicates that
// we want to divide io, into a bidirectional token stream with the input
// token corresponding to all of the inputs of this BlackBox, and the output token consisting of
// all of the outputs from the BlackBox
val bridgeIO = HostPort(io)

// Do some intermediate work to compute our host-side BridgeModule's constructor argument
val baudrate = uParams.initBaudRate
val div = (BigInt(freqMHz) * 1000000 / baudrate).toInt

// And then implement the constructorArg member
val constructorArg = Some(UARTKey(uParams, div))

// Finally, and this is critical, emit the Bridge Annotations -- without
// this, this BlackBox would appear like any other BlackBox to Golden Gate
generateAnnotations()
}
// DOC include end: UART Bridge Target-Side Module

// DOC include start: UART Bridge Companion Object
object UARTBridge {
def apply(clock: Clock, uart: UARTPortIO, reset: Bool, freqMHz: Int)(implicit p: Parameters): UARTBridge = {
val ep = Module(new UARTBridge(uart.c, freqMHz))
ep.io.uart <> uart
ep.io.clock := clock
ep.io.reset := reset
ep
}
}
// DOC include end: UART Bridge Companion Object

0 comments on commit 61b5ebc

Please sign in to comment.