Skip to content
Snippets Groups Projects
Verified Commit 5bd73e7e authored by Minyong Li's avatar Minyong Li :speech_balloon:
Browse files

core.*Round: add quarter round type configs

parent ea5e3f9f
No related branches found
No related tags found
No related merge requests found
...@@ -10,5 +10,6 @@ case class CanCoreConfiguration( ...@@ -10,5 +10,6 @@ case class CanCoreConfiguration(
syncReadMemory: Boolean, syncReadMemory: Boolean,
regAfterBlockInitializer: Boolean, regAfterBlockInitializer: Boolean,
regBetweenRounds: Boolean, regBetweenRounds: Boolean,
regAfterAdder: Boolean regAfterAdder: Boolean,
quarterRoundType: Int
) )
...@@ -4,8 +4,10 @@ ...@@ -4,8 +4,10 @@
package uk.ac.soton.ecs.can.core package uk.ac.soton.ecs.can.core
import chisel3._ import chisel3._
import uk.ac.soton.ecs.can.config.CanCoreConfiguration
abstract class BaseRound extends MultiIOModule { abstract class BaseRound(implicit cfg: CanCoreConfiguration)
extends MultiIOModule {
val in = IO(Input(UInt(512.W))) val in = IO(Input(UInt(512.W)))
val out = IO(Output(UInt(512.W))) val out = IO(Output(UInt(512.W)))
...@@ -15,7 +17,13 @@ abstract class BaseRound extends MultiIOModule { ...@@ -15,7 +17,13 @@ abstract class BaseRound extends MultiIOModule {
protected def wire(wireBox: Seq[Seq[Int]]): Unit = wireBox.foreach { protected def wire(wireBox: Seq[Seq[Int]]): Unit = wireBox.foreach {
wireSeq => wireSeq =>
val quarterRound = Module(new CombinationalQuarterRound) val quarterRound = cfg.quarterRoundType match {
case 1 => Module(new CombinationalQuarterRound)
case 2 => Module(new TwoStageQuarterRound)
case 8 => Module(new EightStageQuarterRound)
case _ =>
throw new Exception("quarterRoundType should be either 1, 2, or 8")
}
quarterRound.in.zip(quarterRound.out).zip(wireSeq).foreach { quarterRound.in.zip(quarterRound.out).zip(wireSeq).foreach {
case ((i, o), w) => case ((i, o), w) =>
i := _in(w) i := _in(w)
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
package uk.ac.soton.ecs.can.core package uk.ac.soton.ecs.can.core
class ColumnarRound extends BaseRound { import uk.ac.soton.ecs.can.config.CanCoreConfiguration
class ColumnarRound(implicit cfg: CanCoreConfiguration) extends BaseRound {
wire( wire(
Seq( Seq(
Seq(0, 4, 8, 12), Seq(0, 4, 8, 12),
......
...@@ -3,7 +3,9 @@ ...@@ -3,7 +3,9 @@
package uk.ac.soton.ecs.can.core package uk.ac.soton.ecs.can.core
class DiagonalRound extends BaseRound { import uk.ac.soton.ecs.can.config.CanCoreConfiguration
class DiagonalRound(implicit cfg: CanCoreConfiguration) extends BaseRound {
wire( wire(
Seq( Seq(
Seq(0, 5, 10, 15), Seq(0, 5, 10, 15),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment