forked from ABKGroup/FakeRAM2.0
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathrun.py
More file actions
executable file
·55 lines (45 loc) · 1.55 KB
/
run.py
File metadata and controls
executable file
·55 lines (45 loc) · 1.55 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env python3
import sys
import argparse
from utils.run_utils import RunUtils
from utils.class_process import Process
from utils.memory_config import MemoryConfig
from utils.memory_factory import MemoryFactory
from utils.timing_data import TimingData
def get_args() -> argparse.Namespace:
"""
Get command line arguments
"""
parser = argparse.ArgumentParser(
description="""
This project is designed to generate black-boxed SRAMs for use in CAD
flows where either an SRAM generator is not available or doesn't
exist. """
)
parser.add_argument("config", help="JSON configuration file")
parser.add_argument(
"--output_dir",
action="store",
help="Output directory ",
required=False,
default="results",
)
return parser.parse_args()
def main(args: argparse.Namespace):
json_data = RunUtils.get_config(args.config)
# Create a process object (shared by all srams)
process = Process(json_data)
timing_data = TimingData(json_data)
memory_type = json_data.get("memory_type", "RAM")
port_config = json_data.get("port_configuration", "SP")
# Go through each sram and generate the lib, lef and v files
for sram_data in json_data["srams"]:
mem_config = MemoryConfig.from_json(sram_data)
memory = MemoryFactory.create(
mem_config, memory_type, port_config, process, timing_data
)
RunUtils.write_memory(memory, args.output_dir)
### Entry point
if __name__ == "__main__":
args = get_args()
main(args)