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
17 changed files
with
102 additions
and
92 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
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
33 changes: 1 addition & 32 deletions
33
src/main/scala/ee/hrzn/chryse/platform/resource/BaseInBool.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 |
---|---|---|
@@ -1,36 +1,5 @@ | ||
package ee.hrzn.chryse.platform.resource | ||
|
||
import chisel3._ | ||
import chisel3.experimental.dataview._ | ||
|
||
import scala.language.implicitConversions | ||
|
||
class BaseInBool extends Base[Bool] { | ||
private var invert = false // TODO: invert should do something | ||
|
||
private[chryse] def make(): Bool = Input(Bool()) | ||
|
||
def inverted: this.type = { | ||
invert = true | ||
this | ||
} | ||
} | ||
|
||
object BaseInBool { | ||
object Implicits { | ||
implicit val BaseInBoolProduct: DataProduct[BaseInBool] = | ||
new DataProduct[BaseInBool] { | ||
def dataIterator( | ||
res: BaseInBool, | ||
path: String, | ||
): Iterator[(Data, String)] = | ||
List(res.inst.get -> path).iterator | ||
} | ||
|
||
implicit def view: DataView[BaseInBool, Bool] = | ||
DataView(res => Bool(), _.instOrMake() -> _) | ||
|
||
implicit def BaseInBool2Bool(res: BaseInBool): Bool = | ||
res.viewAs[Bool] | ||
} | ||
} | ||
object BaseInBool extends BaseIn[Bool](Bool()) {} |
27 changes: 27 additions & 0 deletions
27
src/main/scala/ee/hrzn/chryse/platform/resource/BaseOut.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,27 @@ | ||
package ee.hrzn.chryse.platform.resource | ||
|
||
import chisel3._ | ||
import chisel3.experimental.dataview._ | ||
|
||
import scala.language.implicitConversions | ||
|
||
class BaseOut[HW <: Data](gen: => HW) extends Base[HW] { | ||
private[chryse] def make(): HW = Output(gen) | ||
|
||
object Implicits { | ||
implicit val BaseOutProduct: DataProduct[BaseOut[HW]] = | ||
new DataProduct[BaseOut[HW]] { | ||
def dataIterator( | ||
res: BaseOut[HW], | ||
path: String, | ||
): Iterator[(Data, String)] = | ||
List(res.inst.get -> path).iterator | ||
} | ||
|
||
implicit def view: DataView[BaseOut[HW], HW] = | ||
DataView(res => gen, _.instOrMake() -> _) | ||
|
||
implicit def BaseOut2HW(res: BaseOut[HW]): HW = | ||
res.viewAs[HW] | ||
} | ||
} |
33 changes: 1 addition & 32 deletions
33
src/main/scala/ee/hrzn/chryse/platform/resource/BaseOutBool.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 |
---|---|---|
@@ -1,36 +1,5 @@ | ||
package ee.hrzn.chryse.platform.resource | ||
|
||
import chisel3._ | ||
import chisel3.experimental.dataview._ | ||
|
||
import scala.language.implicitConversions | ||
|
||
class BaseOutBool extends Base[Bool] { | ||
private var invert = false // TODO: invert should do something | ||
|
||
private[chryse] def make(): Bool = Output(Bool()) | ||
|
||
def inverted: this.type = { | ||
invert = true | ||
this | ||
} | ||
} | ||
|
||
object BaseOutBool { | ||
object Implicits { | ||
implicit val BaseOutBoolProduct: DataProduct[BaseOutBool] = | ||
new DataProduct[BaseOutBool] { | ||
def dataIterator( | ||
res: BaseOutBool, | ||
path: String, | ||
): Iterator[(Data, String)] = | ||
List(res.inst.get -> path).iterator | ||
} | ||
|
||
implicit def view: DataView[BaseOutBool, Bool] = | ||
DataView(res => Bool(), _.instOrMake() -> _) | ||
|
||
implicit def BaseOutBool2Bool(res: BaseOutBool): Bool = | ||
res.viewAs[Bool] | ||
} | ||
} | ||
object BaseOutBool extends BaseOut[Bool](Bool()) {} |
11 changes: 10 additions & 1 deletion
11
src/main/scala/ee/hrzn/chryse/platform/resource/Button.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
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
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