Switch the script based build config generation

This commit is contained in:
wgulian3
2020-04-05 19:59:40 -04:00
parent 0270fce6d3
commit 8d4d07d56b
2 changed files with 16 additions and 28 deletions

View File

@@ -1 +1,2 @@
*.v
*.v
*.sh

View File

@@ -4,25 +4,22 @@ import glob
config_location = 'configs'
name_template = '{clusters}cl-{cores}c-{warps}w-{threads}t-{l2}Kl2-{dcache}Kd-{icache}Ki{name_suffix}.v'
name_template = '{clusters}cl-{cores}c-{warps}w-{threads}t-{l2}Kl2-{dcache}Kd-{icache}Ki{name_suffix}.sh'
template = """
`ifndef VX_DEFINE_SYNTH
`define VX_DEFINE_SYNTH
`define NT {threads}
`define NW {warps}
`define NUMBER_CORES_PER_CLUSTER {cores}
`define NUMBER_CLUSTERS {clusters}
`define DCACHE_SIZE_BYTES {dcachek}
`define ICACHE_SIZE_BYTES {icachek}
export V_NT={threads}
export V_NW={warps}
export V_NUMBER_CORES_PER_CLUSTER={cores}
export V_NUMBER_CLUSTERS={clusters}
export V_DCACHE_SIZE_BYTES={dcachek}
export V_ICACHE_SIZE_BYTES={icachek}
// L2 Cache size
`define LLCACHE_SIZE_BYTES {l2k}
# L2 Cache size
export V_LLCACHE_SIZE_BYTES={l2k}
{codegen}
`endif
"""
# cluster, cores, warps, threads, l2, dcache, icache
@@ -39,23 +36,13 @@ configs = [
(2, 4, 8, 8, 16, 8, 1),
]
files = glob.glob(config_location + '/*')
files = glob.glob(config_location + '/*.sh')
for f in files:
os.remove(f)
for clusters, cores, warps, threads, l2, dcache, icache in configs:
l2k, dcachek, icachek = 1024 * l2, 1024 * dcache, 1024 * icache
for force_mlab in [False]:
name_suffix = ''
if force_mlab:
name_suffix += '-mlab'
with open(config_location + '/' + name_template.format(**locals()), 'w') as f:
codegen = ''
if force_mlab:
codegen += '\n`define QUEUE_FORCE_MLAB 1'
else:
codegen += '\n// `define QUEUE_FORCE_MLAB 1'
codegen += '\n\n// Use l3 cache (required for cluster behavior)'
f.write(template.format(**locals()))
name_suffix = ''
with open(config_location + '/' + name_template.format(**locals()), 'w') as f:
codegen = ''
f.write(template.format(**locals()))