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
19 changed files
with
316 additions
and
117 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
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
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
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
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,39 @@ | ||
package ee.hrzn.chryse.platform.ecp5 | ||
|
||
import chisel3.experimental.IntParam | ||
import chisel3.experimental.Param | ||
import chisel3.experimental.StringParam | ||
import ee.hrzn.chryse.platform.resource.PinString | ||
|
||
final case class LPF( | ||
ios: Map[String, (PinString, Map[String, Param])], | ||
freqs: Map[String, BigInt], | ||
) { | ||
private val attr2String: Param => String = { | ||
case IntParam(v) => | ||
v.toString() | ||
case StringParam(v) => v | ||
case v => throw new Exception(s"unhandled attribute: $v") | ||
} | ||
|
||
override def toString(): String = { | ||
val sb = new StringBuilder | ||
sb.append("BLOCK ASYNCPATHS;\n") | ||
sb.append("BLOCK RESETPATHS;\n") | ||
|
||
for { (name, (pin, attrs)) <- ios } { | ||
sb.append(s"LOCATE COMP \"$name\" SITE \"$pin\";\n") | ||
if (!attrs.isEmpty) { | ||
sb.append(s"IOBUF PORT \"$name\""); | ||
for { (k, v) <- attrs } | ||
sb.append(s" $k=${attr2String(v)}") | ||
sb.append(";\n"); | ||
} | ||
} | ||
|
||
for { (name, freq) <- freqs } | ||
sb.append(s"FREQUENCY PORT \"$name\" $freq HZ;\n") | ||
|
||
sb.toString() | ||
} | ||
} |
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
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
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
Oops, something went wrong.