|
4 | 4 |
|
5 | 5 | Example::
|
6 | 6 |
|
| 7 | + import pyrtl |
| 8 | + from pyrtl.rtllib.aes import AES |
| 9 | +
|
7 | 10 | aes = AES()
|
8 | 11 | plaintext = pyrtl.Input(bitwidth=128, name='aes_plaintext')
|
9 | 12 | key = pyrtl.Input(bitwidth=128, name='aes_key')
|
10 | 13 | aes_ciphertext = pyrtl.Output(bitwidth=128, name='aes_ciphertext')
|
11 |
| - reset = pyrtl.Input(1) |
| 14 | + reset = pyrtl.Input(1, name='reset') |
12 | 15 | ready = pyrtl.Output(1, name='ready')
|
13 |
| - ready_out, aes_cipher = aes.encryption_statem(plaintext, key, reset) |
| 16 | + ready_out, aes_cipher = aes.encrypt_state_m(plaintext, key, reset) |
14 | 17 | ready <<= ready_out
|
15 | 18 | aes_ciphertext <<= aes_cipher
|
16 | 19 | sim_trace = pyrtl.SimulationTrace()
|
17 | 20 | sim = pyrtl.Simulation(tracer=sim_trace)
|
18 | 21 | sim.step ({
|
19 |
| - aes_plaintext: 0x00112233445566778899aabbccddeeff, |
20 |
| - aes_key: 0x000102030405060708090a0b0c0d0e0f, |
21 |
| - reset: 1 |
| 22 | + 'aes_plaintext': 0x00112233445566778899aabbccddeeff, |
| 23 | + 'aes_key': 0x000102030405060708090a0b0c0d0e0f, |
| 24 | + 'reset': 1 |
22 | 25 | })
|
23 | 26 | for cycle in range(1,10):
|
24 | 27 | sim.step ({
|
25 |
| - aes_plaintext: 0x00112233445566778899aabbccddeeff, |
26 |
| - aes_key: 0x000102030405060708090a0b0c0d0e0f, |
27 |
| - reset: 0 |
| 28 | + 'aes_plaintext': 0x00112233445566778899aabbccddeeff, |
| 29 | + 'aes_key': 0x000102030405060708090a0b0c0d0e0f, |
| 30 | + 'reset': 0 |
28 | 31 | })
|
29 | 32 | sim_trace.render_trace(symbol_len=40, segment_size=1)
|
30 | 33 |
|
|
0 commit comments