-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample_usage.py
More file actions
35 lines (32 loc) · 946 Bytes
/
example_usage.py
File metadata and controls
35 lines (32 loc) · 946 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from amaranth.back import verilog
from pycachegen import *
cache_wrapper = CacheWrapper(
num_ports=1,
address_width=25,
cache_configs=[
CacheConfig(
data_width=32,
num_ways=2,
num_sets=1,
block_size=2,
replacement_policy=ReplacementPolicies.PLRU_TREE,
write_policy=WritePolicies.WRITE_BACK,
write_allocate=True,
write_buffer_size=4,
),
CacheConfig(
data_width=32,
num_ways=2,
num_sets=2,
block_size=4,
replacement_policy=ReplacementPolicies.FIFO,
write_policy=WritePolicies.WRITE_BACK,
write_allocate=True,
write_buffer_size=8,
),
],
main_memory_data_width=128,
create_main_memory=False,
)
with open("cache_wrapper.v", "w") as f:
f.write(verilog.convert(cache_wrapper, name="CacheWrapper"))