ChaChaInnerBlock.scala 698 Bytes
Newer Older
1
2
3
// SPDX-FileCopyrightText: 2021 Minyong Li <ml10g20@soton.ac.uk>
// SPDX-License-Identifier: CERN-OHL-W-2.0

4
5
6
7
package uk.ac.soton.ecs.can.core

import chisel3._

8
class ChaChaInnerBlock(regBetweenRounds: Boolean) extends Module {
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
  val io = IO(new Bundle {
    val in = Input(Vec(16, UInt(32.W)))
    val out = Output(Vec(16, UInt(32.W)))
  })

  val betweenRounds =
    if (regBetweenRounds)
      Reg(Vec(16, UInt(32.W)))
    else
      Wire(Vec(16, UInt(32.W)))

  val columnRound = Module(new ColumnRound)
  val diagonalRound = Module(new DiagonalRound)

  columnRound.io.in := io.in
  betweenRounds := columnRound.io.out
  diagonalRound.io.in := betweenRounds
  io.out := diagonalRound.io.out
}