This repository has been archived by the owner on Jun 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
65 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/scala/ee/hrzn/chryse/platform/ice40/IOStandard.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package ee.hrzn.chryse.platform.ice40 | ||
|
||
object IOStandard { | ||
val LV_CMOS = "SB_LVCMOS" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/scala/ee/hrzn/chryse/platform/ice40/PinType.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package ee.hrzn.chryse.platform.ice40 | ||
|
||
// See SiliconBlue ICE™ Technology Library. | ||
object PinType { | ||
val PIN_INPUT = 0x1 | ||
|
||
val PIN_NO_OUTPUT = 0x0 | ||
val PIN_OUTPUT = 0x18 | ||
val PIN_OUTPUT_TRISTATE = 0x28 | ||
} |
This file was deleted.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
src/main/scala/ee/hrzn/chryse/platform/ice40/SB_GB_IO.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package ee.hrzn.chryse.platform.ice40 | ||
|
||
import chisel3._ | ||
import chisel3.experimental.ExtModule | ||
|
||
class SB_GB_IO(pinType: Int = (PinType.PIN_INPUT | PinType.PIN_NO_OUTPUT)) | ||
extends ExtModule( | ||
Map( | ||
"IO_STANDARD" -> IOStandard.LV_CMOS, | ||
"PIN_TYPE" -> pinType, | ||
), | ||
) { | ||
val PACKAGE_PIN = IO(Input(Clock())) | ||
val GLOBAL_BUFFER_OUTPUT = IO(Output(Clock())) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package ee.hrzn.chryse.platform.ice40 | ||
|
||
import chisel3._ | ||
import chisel3.experimental.Analog | ||
import chisel3.experimental.ExtModule | ||
|
||
class SB_IO( | ||
pinType: Int, | ||
ioStandard: String = IOStandard.LV_CMOS, | ||
pullup: Boolean = false, | ||
) extends ExtModule( | ||
Map( | ||
"IO_STANDARD" -> ioStandard, | ||
"PIN_TYPE" -> pinType, | ||
"PULLUP" -> (if (pullup) 1 else 0), | ||
), | ||
) { | ||
|
||
private def genPin(): Data = { | ||
if (pinType == PinType.PIN_INPUT) | ||
Input(Bool()) | ||
else if (pinType == PinType.PIN_OUTPUT) | ||
Output(Bool()) | ||
else if (pinType == (PinType.PIN_INPUT | PinType.PIN_OUTPUT_TRISTATE)) | ||
Analog(1.W) | ||
else | ||
throw new IllegalArgumentException(s"unhandled pinType: $pinType") | ||
|
||
} | ||
val PACKAGE_PIN = IO(genPin()) | ||
val GLOBAL_BUFFER_OUTPUT = IO(genPin()) | ||
} |