Verified Commit 0b86d106 authored by Minyong Li's avatar Minyong Li 💬
Browse files

core: rename components to match rfc8439 names

parent a57e2844
...@@ -2,7 +2,7 @@ package uk.ac.soton.ecs.can.core ...@@ -2,7 +2,7 @@ package uk.ac.soton.ecs.can.core
import chisel3._ import chisel3._
class ChaChaBlockFunction extends Module { class ChaChaBlock extends Module {
val io = IO(new Bundle { val io = IO(new Bundle {
val muxIn = Input(Bool()) val muxIn = Input(Bool())
val in = Input(Vec(16, UInt(32.W))) val in = Input(Vec(16, UInt(32.W)))
...@@ -10,7 +10,7 @@ class ChaChaBlockFunction extends Module { ...@@ -10,7 +10,7 @@ class ChaChaBlockFunction extends Module {
}) })
val initialState = Reg(Vec(16, UInt(32.W))) val initialState = Reg(Vec(16, UInt(32.W)))
val doubleRound = Module(new DoubleRound(regBetweenRounds = true)) val doubleRound = Module(new ChaChaInnerBlock(regBetweenRounds = true))
val doubleRoundState = Reg(Vec(16, UInt(32.W))) val doubleRoundState = Reg(Vec(16, UInt(32.W)))
initialState := io.in initialState := io.in
......
...@@ -2,7 +2,7 @@ package uk.ac.soton.ecs.can.core ...@@ -2,7 +2,7 @@ package uk.ac.soton.ecs.can.core
import chisel3._ import chisel3._
class DoubleRound(regBetweenRounds: Boolean) extends Module { class ChaChaInnerBlock(regBetweenRounds: Boolean) extends Module {
val io = IO(new Bundle { val io = IO(new Bundle {
val in = Input(Vec(16, UInt(32.W))) val in = Input(Vec(16, UInt(32.W)))
val out = Output(Vec(16, UInt(32.W))) val out = Output(Vec(16, UInt(32.W)))
......
...@@ -4,7 +4,7 @@ import org.scalatest._ ...@@ -4,7 +4,7 @@ import org.scalatest._
import chiseltest._ import chiseltest._
import chisel3._ import chisel3._
class ChaChaBlockFunctionTest extends FlatSpec with ChiselScalatestTester { class ChaChaBlockTest extends FlatSpec with ChiselScalatestTester {
private val rfc8439232TestVector = Seq( private val rfc8439232TestVector = Seq(
"h61707865".U(32.W) -> "he4e7f110".U(32.W), "h61707865".U(32.W) -> "he4e7f110".U(32.W),
...@@ -63,7 +63,7 @@ class ChaChaBlockFunctionTest extends FlatSpec with ChiselScalatestTester { ...@@ -63,7 +63,7 @@ class ChaChaBlockFunctionTest extends FlatSpec with ChiselScalatestTester {
"h00000000".U(32.W) -> "hedc49139".U(32.W) "h00000000".U(32.W) -> "hedc49139".U(32.W)
) )
private def doTest(c: ChaChaBlockFunction, testVector: Seq[(UInt, UInt)]) { private def doTest(c: ChaChaBlock, testVector: Seq[(UInt, UInt)]) {
c.io.in.zip(testVector).foreach { t => c.io.in.zip(testVector).foreach { t =>
t._1.poke(t._2._1) t._1.poke(t._2._1)
} }
...@@ -91,11 +91,11 @@ class ChaChaBlockFunctionTest extends FlatSpec with ChiselScalatestTester { ...@@ -91,11 +91,11 @@ class ChaChaBlockFunctionTest extends FlatSpec with ChiselScalatestTester {
} }
it should "compute RFC8439 2.3.2 test vector correctly" in it should "compute RFC8439 2.3.2 test vector correctly" in
test(new ChaChaBlockFunction)(doTest(_, rfc8439232TestVector)) test(new ChaChaBlock)(doTest(_, rfc8439232TestVector))
it should "compute RFC8439 2.4.2 test vector (first block) correctly" in it should "compute RFC8439 2.4.2 test vector (first block) correctly" in
test(new ChaChaBlockFunction)(doTest(_, rfc8439242B1TestVector)) test(new ChaChaBlock)(doTest(_, rfc8439242B1TestVector))
it should "compute RFC8439 2.4.2 test vector (second block) correctly" in it should "compute RFC8439 2.4.2 test vector (second block) correctly" in
test(new ChaChaBlockFunction)(doTest(_, rfc8439242B2TestVector)) test(new ChaChaBlock)(doTest(_, rfc8439242B2TestVector))
} }
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment