Skip to content

Commit 72224ba

Browse files
update docs and regenerate wrappers
1 parent 04c3b2b commit 72224ba

27 files changed

+3453
-1213
lines changed

SW_AES.yaml EF_AES.yaml

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
---
22
info:
3-
name: SW_AES
4-
description: Verilog implementation of the symmetric block cipher AES (Advanced
5-
Encryption Standard) as specified in NIST FIPS 197. This implementation supports
6-
128 and 256 bit keys.
7-
repo: github.com/efabless/SW_AES
8-
owner: secworks
9-
license: MIT
10-
author: Joachim Strombergson
11-
email: ''
3+
name: EF_AES
4+
description: APB, AHBL and wishbone wrappers for the symmetric block cipher AES (Advanced Encryption Standard) which is implemented in Verilog in the [secworks/aes](https://github.com/secworks/aes/tree/master) repository.
5+
repo: github.com/efabless/EF_AES
6+
owner: Efabless Corp.
7+
license: Apache 2.0
8+
author: Efabless Corp.
9+
1210
version: v1.0.2
1311
date: 12-11-2024
1412
category: digital
@@ -254,6 +252,7 @@ registers:
254252

255253
clock:
256254
name: clk
255+
gated: "yes"
257256
reset:
258257
name: reset_n
259258
level: 0

README.md

+61-47
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
1-
# SW_AES
2-
3-
Verilog implementation of the symmetric block cipher AES (Advanced Encryption Standard) as specified in NIST FIPS 197. This implementation supports 128 and 256 bit keys. The AES rtl is based on [this repo](https://github.com/secworks/aes/tree/master)
1+
# EF_AES
42

3+
APB, AHBL and wishbone wrappers for the symmetric block cipher AES (Advanced Encryption Standard) which is implemented in Verilog in the [secworks/aes](https://github.com/secworks/aes/tree/master) repository.
54
## The wrapped IP
65

76

8-
APB, AHBL, and Wishbone wrappers, generated by the [BusWrap](https://github.com/efabless/BusWrap/tree/main) `bus_wrap.py` utility, are provided. All wrappers provide the same programmer's interface as outlined in the following sections.
7+
APB, AHBL, and Wishbone wrappers are provided. All wrappers provide the same programmer's interface as outlined in the following sections.
98

10-
### Wrapped IP System Integration
9+
#### Wrapped IP System Integration
1110

12-
Based on your use case, use one of the provided wrappers or create a wrapper for your system bus type. For an example of how to integrate the APB wrapper:
11+
Based on your use case, use one of the provided wrappers or create a wrapper for your system bus type. For an example of how to integrate the wishbone wrapper:
1312
```verilog
14-
SW_AES_APB INST (
15-
`TB_APB_SLAVE_CONN
13+
EF_AES_WB INST (
14+
.clk_i(clk_i),
15+
.rst_i(rst_i),
16+
.adr_i(adr_i),
17+
.dat_i(dat_i),
18+
.dat_o(dat_o),
19+
.sel_i(sel_i),
20+
.cyc_i(cyc_i),
21+
.stb_i(stb_i),
22+
.ack_o(ack_o),
23+
.we_i(we_i),
24+
.IRQ(irq),
1625
);
1726
```
18-
> **_NOTE:_** `TB_APB_SLAVE_CONN is a convenient macro provided by [BusWrap](https://github.com/efabless/BusWrap/tree/main).
27+
#### Wrappers with DFT support
28+
Wrappers in the directory ``/hdl/rtl/bus_wrappers/DFT`` have an extra input port ``sc_testmode`` to disable the clock gate whenever the scan chain testmode is enabled.
1929

2030
## Implementation example
2131

22-
The following table is the result for implementing the SW_AES IP with different wrappers using Sky130 PDK and [OpenLane2](https://github.com/efabless/openlane2) flow.
32+
The following table is the result for implementing the EF_AES IP with different wrappers using Sky130 PDK and [OpenLane2](https://github.com/efabless/openlane2) flow.
2333
|Module | Number of cells | Max. freq |
2434
|---|---|---|
25-
|SW_AES|TBD| TBD |
26-
|SW_AES_APB|TBD|TBD|
27-
|SW_AES_AHBL|TBD|TBD|
28-
|SW_AES_WB|TBD|TBD|
35+
|EF_AES|TBD| TBD |
36+
|EF_AES_APB|TBD|TBD|
37+
|EF_AES_AHBL|TBD|TBD|
38+
|EF_AES_WB|TBD|TBD|
2939
## The Programmer's Interface
3040

3141

@@ -55,6 +65,7 @@ The following table is the result for implementing the SW_AES IP with different
5565
|RIS|ff08|0x00000000|w|Raw Interrupt Status; reflects the current interrupts status;check the interrupt flags table for more details|
5666
|MIS|ff04|0x00000000|w|Masked Interrupt Status; On a read, this register gives the current masked status value of the corresponding interrupt. A write has no effect; check the interrupt flags table for more details|
5767
|IC|ff0c|0x00000000|w|Interrupt Clear Register; On a write of 1, the corresponding interrupt (both raw interrupt and masked interrupt, if enabled) is cleared; check the interrupt flags table for more details|
68+
|GCLK|ff10|0x00000000|w|Gated clock enable; 1: enable clock, 0: disable clock|
5869

5970
### STATUS Register [Offset: 0x0, mode: r]
6071

@@ -66,7 +77,6 @@ Status register bit 6: ready , bit 7: valid
6677
|6|ready_reg|1|Ready to start|
6778
|7|valid_reg|1|Result is valid|
6879

69-
7080
### CTRL Register [Offset: 0x4, mode: w]
7181

7282
Control register bit 0: Initial bit (init), bit 1: Next bit , bit 2: Encipher/Decipher control, bit 3: Key length control
@@ -79,115 +89,108 @@ Control register bit 0: Initial bit (init), bit 1: Next bit , bit 2: Encipher/De
7989
|2|encdec_reg|1|Encipher/Decipher control (“0” means Decipher “1” means Encipher)|
8090
|3|keylen_reg|1|Key length control (“0” means 128 bit key length “1” means 256 bit key length")|
8191

82-
8392
### KEY0 Register [Offset: 0x8, mode: w]
8493

8594
Contains the bits 31-0 of the input key value
8695
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY0', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
8796

88-
8997
### KEY1 Register [Offset: 0xc, mode: w]
9098

9199
Contains the bits 63-32 of the input key value
92100
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY1', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
93101

94-
95102
### KEY2 Register [Offset: 0x10, mode: w]
96103

97104
Contains the bits 95-64 of the input key value
98105
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY2', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
99106

100-
101107
### KEY3 Register [Offset: 0x14, mode: w]
102108

103109
Contains the bits 127-96 of the input key value
104110
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY3', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
105111

106-
107112
### KEY4 Register [Offset: 0x18, mode: w]
108113

109114
Contains the bits 159-128 of the input key value
110115
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY4', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
111116

112-
113117
### KEY5 Register [Offset: 0x1c, mode: w]
114118

115119
Contains the bits 191-160 of the input key value
116120
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY5', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
117121

118-
119122
### KEY6 Register [Offset: 0x20, mode: w]
120123

121124
Contains the bits 223-192 of the input key value
122125
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY6', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
123126

124-
125127
### KEY7 Register [Offset: 0x24, mode: w]
126128

127129
Contains the bits 255-224 of the input key value
128130
<img src="https://svg.wavedrom.com/{reg:[{name:'KEY7', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
129131

130-
131132
### BLOCK0 Register [Offset: 0x28, mode: w]
132133

133134
Contains the bits 31-0 of the input block value
134135
<img src="https://svg.wavedrom.com/{reg:[{name:'BLOCK0', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
135136

136-
137137
### BLOCK1 Register [Offset: 0x2c, mode: w]
138138

139139
Contains the bits 63-32 of the input block value
140140
<img src="https://svg.wavedrom.com/{reg:[{name:'BLOCK1', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
141141

142-
143142
### BLOCK2 Register [Offset: 0x30, mode: w]
144143

145144
Contains the bits 95-64 of the input block value
146145
<img src="https://svg.wavedrom.com/{reg:[{name:'BLOCK2', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
147146

148-
149147
### BLOCK3 Register [Offset: 0x34, mode: w]
150148

151149
Contains the bits 127-96 of the input block value
152150
<img src="https://svg.wavedrom.com/{reg:[{name:'BLOCK3', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
153151

154-
155152
### RESULT0 Register [Offset: 0x38, mode: w]
156153

157154
Contains the bits 31-0 of the input result value
158155
<img src="https://svg.wavedrom.com/{reg:[{name:'RESULT0', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
159156

160-
161157
### RESULT1 Register [Offset: 0x3c, mode: w]
162158

163159
Contains the bits 63-32 of the input result value
164160
<img src="https://svg.wavedrom.com/{reg:[{name:'RESULT1', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
165161

166-
167162
### RESULT2 Register [Offset: 0x40, mode: w]
168163

169164
Contains the bits 95-64 of the input result value
170165
<img src="https://svg.wavedrom.com/{reg:[{name:'RESULT2', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
171166

172-
173167
### RESULT3 Register [Offset: 0x44, mode: w]
174168

175169
Contains the bits 127-96 of the input result value
176170
<img src="https://svg.wavedrom.com/{reg:[{name:'RESULT3', bits:32},{bits: 0}], config: {lanes: 2, hflip: true}} "/>
177171

172+
### GCLK Register [Offset: 0xff10, mode: w]
173+
174+
Gated clock enable register
175+
<img src="https://svg.wavedrom.com/{reg:[{name:'gclk_enable', bits:1},{bits: 31}], config: {lanes: 2, hflip: true}} "/>
176+
177+
|bit|field name|width|description|
178+
|---|---|---|---|
179+
|0|gclk_enable|1|Gated clock enable; 1: enable clock, 0: disable clock|
180+
178181

179182
### Interrupt Flags
180183

181-
The wrapped IP provides four registers to deal with interrupts: IM, RIS, MIS and IC. These registers exist for all wrapper types generated by the [BusWrap](https://github.com/efabless/BusWrap/tree/main) `bus_wrap.py` utility.
184+
The wrapped IP provides four registers to deal with interrupts: IM, RIS, MIS and IC. These registers exist for all wrapper types.
182185

183186
Each register has a group of bits for the interrupt sources/flags.
184-
- `IM`: is used to enable/disable interrupt sources.
187+
- `IM` [offset: 0xff00]: is used to enable/disable interrupt sources.
185188

186-
- `RIS`: has the current interrupt status (interrupt flags) whether they are enabled or disabled.
189+
- `RIS` [offset: 0xff08]: has the current interrupt status (interrupt flags) whether they are enabled or disabled.
187190

188-
- `MIS`: is the result of masking (ANDing) RIS by IM.
191+
- `MIS` [offset: 0xff04]: is the result of masking (ANDing) RIS by IM.
189192

190-
- `IC`: is used to clear an interrupt flag.
193+
- `IC` [offset: 0xff0c]: is used to clear an interrupt flag.
191194

192195

193196
The following are the bit definitions for the interrupt registers:
@@ -196,11 +199,18 @@ The following are the bit definitions for the interrupt registers:
196199
|---|---|---|---|
197200
|0|VALID|1|Result is valid|
198201
|1|READY|1|Ready to start|
202+
### Clock Gating
203+
The IP includes a clock gating feature that allows selective activation and deactivation of the clock using the ``GCLK`` register. This capability is implemented through the ``ef_util_gating_cell`` module, which is part of the common modules library, [ef_util_lib.v](https://github.com/efabless/EF_IP_UTIL/blob/main/hdl/ef_util_lib.v). By default, the clock gating is disabled. To enable behavioral implmentation clock gating, only for simulation purposes, you should define the ``CLKG_GENERIC`` macro. Alternatively, define the ``CLKG_SKY130_HD`` macro if you wish to use the SKY130 HD library clock gating cell, ``sky130_fd_sc_hd__dlclkp_4``.
199204

200-
### The Interface
205+
**Note:** If you choose the [OpenLane2](https://github.com/efabless/openlane2) flow for implementation and would like to enable the clock gating feature, you need to add ``CLKG_SKY130_HD`` macro to the ``VERILOG_DEFINES`` configuration variable. Update OpenLane2 YAML configuration file as follows:
206+
```
207+
VERILOG_DEFINES:
208+
- CLKG_SKY130_HD
209+
```
201210

202-
<img src="docs/aes_core.svg" width="600"/>
211+
### The Interface
203212

213+
<img src="docs/_static/EF_AES.svg" width="600"/>
204214

205215
#### Ports
206216

@@ -215,13 +225,17 @@ The following are the bit definitions for the interrupt registers:
215225
|block|input|128|block value|
216226
|result|output|128|result value|
217227
|result_valid|output|1|result is valid|
218-
## F/W Usage Guidelines:
219-
TBD
228+
## Firmware Drivers:
229+
Firmware drivers for EF_AES can be found in the [fw](https://github.com/efabless/EF_AES/tree/main/fw) directory. EF_AES driver documentation is available [here](https://github.com/efabless/EF_AES/blob/main/fw/README.md).
230+
You can also find an example C application using the EF_AES drivers [here]().
220231
## Installation:
221-
You can either clone repo or use [IPM](https://github.com/efabless/IPM) which is an open-source IPs Package Manager
222-
* To clone repo:
223-
```git clone https://github.com/efabless/SW_AES```
224-
* To download via IPM , follow installation guides [here](https://github.com/efabless/IPM/blob/main/README.md) then run
225-
```ipm install SW_AES```
226-
### Run cocotb UVM Testbench:
227-
TBD
232+
You can install the IP either by cloning this repository or by using [IPM](https://github.com/efabless/IPM).
233+
##### 1. Using [IPM](https://github.com/efabless/IPM):
234+
- [Optional] If you do not have IPM installed, follow the installation guide [here](https://github.com/efabless/IPM/blob/main/README.md)
235+
- After installing IPM, execute the following command ```ipm install EF_AES```.
236+
> **Note:** This method is recommended as it automatically installs [EF_IP_UTIL](https://github.com/efabless/EF_IP_UTIL.git) as a dependency.
237+
##### 2. Cloning this repo:
238+
- Clone [EF_IP_UTIL](https://github.com/efabless/EF_IP_UTIL.git) repository, which includes the required modules from the common modules library, [ef_util_lib.v](https://github.com/efabless/EF_IP_UTIL/blob/main/hdl/ef_util_lib.v).
239+
```git clone https://github.com/efabless/EF_IP_UTIL.git```
240+
- Clone the IP repository
241+
```git clone github.com/efabless/EF_AES```
File renamed without changes.

0 commit comments

Comments
 (0)