@@ -42,28 +42,23 @@ class AES(Nk: Int, unrolled: Boolean, SubBytes_SCD: Boolean, InvSubBytes_SCD: Bo
42
42
// A roundKey is Params.StateLength bytes, and 1+(10/12/14) (< EKDepth) of them are needed
43
43
// Mem = combinational/asynchronous-read, sequential/synchronous-write = register banks
44
44
// Create a asynchronous-read, synchronous-write memory block big enough for any key length
45
- // val expandedKeyARMem = Mem(EKDepth, UInt((Params.StateLength * 8).W))
46
45
val expandedKeyARMem = Mem (EKDepth , Vec (Params .StateLength , UInt (8 .W )))
47
46
48
47
49
48
// SyncReadMem = sequential/synchronous-read, sequential/synchronous-write = SRAMs
50
49
// Create a synchronous-read, synchronous-write memory block big enough for any key length
51
- // val expandedKeySRMem = SyncReadMem(EKDepth, UInt((Params.StateLength * 8).W))
52
50
val expandedKeySRMem = SyncReadMem (EKDepth , Vec (Params .StateLength , UInt (8 .W )))
53
51
54
52
// use the same address and dataOut val elements to interface with the parameterized memory
55
53
val address = RegInit (0 .U (log2Ceil(EKDepth ).W ))
56
- // val dataOut = RegInit(0.U((Params.StateLength * 8).W))
57
54
val dataOut = Wire (Vec (Params .StateLength , UInt (8 .W )))
58
55
59
56
when(io.AES_mode === 1 .U ) { // write to memory
60
57
if (expandedKeyMemType == " Mem" ) {
61
58
expandedKeyARMem(address) := io.input_text
62
- // Cat(io.input_text(0), io.input_text(1), io.input_text(2), io.input_text(3), io.input_text(4), io.input_text(5), io.input_text(6), io.input_text(7), io.input_text(8), io.input_text(9), io.input_text(10), io.input_text(11), io.input_text(12), io.input_text(13), io.input_text(14), io.input_text(15))
63
59
}
64
60
else if (expandedKeyMemType == " SyncReadMem" ) {
65
61
expandedKeySRMem(address) := io.input_text
66
- // Cat(io.input_text(0), io.input_text(1), io.input_text(2), io.input_text(3), io.input_text(4), io.input_text(5), io.input_text(6), io.input_text(7), io.input_text(8), io.input_text(9), io.input_text(10), io.input_text(11), io.input_text(12), io.input_text(13), io.input_text(14), io.input_text(15))
67
62
}
68
63
dataOut := DontCare
69
64
address := address + 1 .U
@@ -107,9 +102,7 @@ class AES(Nk: Int, unrolled: Boolean, SubBytes_SCD: Boolean, InvSubBytes_SCD: Bo
107
102
// The roundKey for each round can go to both the cipher and inverse cipher (for now TODO)
108
103
if (expandedKeyMemType == " Mem" || expandedKeyMemType == " SyncReadMem" ) {
109
104
CipherModule .io.roundKey := dataOut
110
- // Array(dataOut(127, 120), dataOut(119, 112), dataOut(111, 104), dataOut(103, 96), dataOut(95, 88), dataOut(87, 80), dataOut(79, 72), dataOut(71, 64), dataOut(63, 56), dataOut(55, 48), dataOut(47, 40), dataOut(39, 32), dataOut(31, 24), dataOut(23, 16), dataOut(15, 8), dataOut(7, 0))
111
105
InvCipherModule .io.roundKey := dataOut
112
- // Array(dataOut(127, 120), dataOut(119, 112), dataOut(111, 104), dataOut(103, 96), dataOut(95, 88), dataOut(87, 80), dataOut(79, 72), dataOut(71, 64), dataOut(63, 56), dataOut(55, 48), dataOut(47, 40), dataOut(39, 32), dataOut(31, 24), dataOut(23, 16), dataOut(15, 8), dataOut(7, 0))
113
106
} else if (expandedKeyMemType == " ROM" ) {
114
107
CipherModule .io.roundKey := ROMeKeyOut
115
108
InvCipherModule .io.roundKey := ROMeKeyOut
0 commit comments