-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathriscv-2channel-1ccd.py
More file actions
86 lines (74 loc) · 2.19 KB
/
riscv-2channel-1ccd.py
File metadata and controls
86 lines (74 loc) · 2.19 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
from gem5.components.boards.riscv_board import RiscvBoard
from gem5.components.memory.memory import ChanneledMemory
from gem5.components.processors.simple_processor import SimpleProcessor
from gem5.components.processors.cpu_types import CPUTypes
from gem5.isas import ISA
from gem5.utils.requires import requires
from gem5.utils.override import overrides
from gem5.resources.resource import Resource, DiskImageResource
from gem5.simulate.simulator import Simulator
from gem5.components.processors.simple_switchable_processor import (
SimpleSwitchableProcessor,
)
from m5.objects import HBM_1000_4H_1x64
from components.Octopi import OctopiCache
requires(isa_required=ISA.RISCV)
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("--command", type=str)
args = parser.parse_args()
num_ccds = 1
num_cores = 8
command = args.command
cache_hierarchy = OctopiCache(
l1i_size = "32KiB",
l1i_assoc = 8,
l1d_size = "32KiB",
l1d_assoc = 8,
l2_size = "512KiB",
l2_assoc = 8,
l3_size = "32MiB",
l3_assoc = 16,
num_core_complexes = 1,
is_fullsystem = True,
)
memory = ChanneledMemory(
dram_interface_class = HBM_1000_4H_1x64,
num_channels = 2,
interleaving_size = 2**8,
size = "64GiB",
addr_mapping = None
)
processor = SimpleSwitchableProcessor(
starting_core_type=CPUTypes.ATOMIC,
switch_core_type=CPUTypes.TIMING, # TODO
isa=ISA.RISCV,
num_cores=num_cores
)
class HighPerformanceRiscvBoard(RiscvBoard):
@overrides(RiscvBoard)
def get_default_kernel_args(self):
return [
"earlyprintk=ttyS0",
"console=ttyS0",
"lpj=7999923",
"root=/dev/vda1",
"init=/root/init.sh",
"rw",
]
# Setup the board.
board = HighPerformanceRiscvBoard(
clk_freq="4GHz",
processor=processor,
memory=memory,
cache_hierarchy=cache_hierarchy,
)
# Set the Full System workload.
board.set_kernel_disk_workload(
kernel=Resource("riscv-bootloader-vmlinux-5.10"),
disk_image=DiskImageResource("/scr/hn/DISK_IMAGES/ubuntu-2204-riscv.img"),
readfile_contents=f"{command}"
)
simulator = Simulator(board=board)
print("Beginning simulation!")
simulator.run()