From bd28a583c9e53b6c0e4954c3279955ced68d8e63 Mon Sep 17 00:00:00 2001 From: Minyong Li <ml10g20@soton.ac.uk> Date: Wed, 16 Jun 2021 23:47:46 +0100 Subject: [PATCH] core.*Test: add subjects --- src/test/scala/uk/ac/soton/ecs/can/core/ChaChaBlockTest.scala | 2 ++ src/test/scala/uk/ac/soton/ecs/can/core/DataMemoryTest.scala | 2 ++ src/test/scala/uk/ac/soton/ecs/can/core/ProgramMemoryTest.scala | 2 ++ src/test/scala/uk/ac/soton/ecs/can/core/QuarterRoundTest.scala | 2 ++ 4 files changed, 8 insertions(+) diff --git a/src/test/scala/uk/ac/soton/ecs/can/core/ChaChaBlockTest.scala b/src/test/scala/uk/ac/soton/ecs/can/core/ChaChaBlockTest.scala index 62f101f..c0e9799 100644 --- a/src/test/scala/uk/ac/soton/ecs/can/core/ChaChaBlockTest.scala +++ b/src/test/scala/uk/ac/soton/ecs/can/core/ChaChaBlockTest.scala @@ -90,6 +90,8 @@ class ChaChaBlockTest extends FlatSpec with ChiselScalatestTester { } } + behavior of "The ChaCha Block Function" + it should "compute RFC8439 2.3.2 test vector correctly" in test(new ChaChaBlock)(doTest(_, rfc8439232TestVector)) diff --git a/src/test/scala/uk/ac/soton/ecs/can/core/DataMemoryTest.scala b/src/test/scala/uk/ac/soton/ecs/can/core/DataMemoryTest.scala index 18184e3..6638385 100644 --- a/src/test/scala/uk/ac/soton/ecs/can/core/DataMemoryTest.scala +++ b/src/test/scala/uk/ac/soton/ecs/can/core/DataMemoryTest.scala @@ -12,6 +12,8 @@ class DataMemoryTest extends FlatSpec with ChiselScalatestTester { private val dataWidth = 16 private val size = 32 + behavior of "The Data Memory" + it should "store some values" in { test(new DataMemory(addrWidth, dataWidth, size)) { c => c.io.write.addr.poke("h01".U(addrWidth.W)) diff --git a/src/test/scala/uk/ac/soton/ecs/can/core/ProgramMemoryTest.scala b/src/test/scala/uk/ac/soton/ecs/can/core/ProgramMemoryTest.scala index 118d902..99f4571 100644 --- a/src/test/scala/uk/ac/soton/ecs/can/core/ProgramMemoryTest.scala +++ b/src/test/scala/uk/ac/soton/ecs/can/core/ProgramMemoryTest.scala @@ -36,6 +36,8 @@ class ProgramMemoryTest extends FlatSpec with ChiselScalatestTester { pm.reset.poke(false.B) } + behavior of "The Program Memory" + it should "be writable and readable as PC increments" in { test(new ProgramMemory(addrWidth, cwWidth, size)) { c => c.io.br.abs.poke(false.B) diff --git a/src/test/scala/uk/ac/soton/ecs/can/core/QuarterRoundTest.scala b/src/test/scala/uk/ac/soton/ecs/can/core/QuarterRoundTest.scala index e1821be..10a0238 100644 --- a/src/test/scala/uk/ac/soton/ecs/can/core/QuarterRoundTest.scala +++ b/src/test/scala/uk/ac/soton/ecs/can/core/QuarterRoundTest.scala @@ -8,6 +8,8 @@ import chiseltest._ import chisel3._ class QuarterRoundTest extends FlatSpec with ChiselScalatestTester { + behavior of "The ChaCha Quarter Round Function" + it should "compute RFC8439 2.1.1 test vector correctly" in { test(new QuarterRound) { c => c.io.in(0).poke("h11111111".U(32.W)) -- GitLab