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' 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 = """ template = """
`ifndef VX_DEFINE_SYNTH
`define VX_DEFINE_SYNTH
`define NT {threads} export V_NT={threads}
`define NW {warps} export V_NW={warps}
`define NUMBER_CORES_PER_CLUSTER {cores} export V_NUMBER_CORES_PER_CLUSTER={cores}
`define NUMBER_CLUSTERS {clusters} export V_NUMBER_CLUSTERS={clusters}
`define DCACHE_SIZE_BYTES {dcachek} export V_DCACHE_SIZE_BYTES={dcachek}
`define ICACHE_SIZE_BYTES {icachek} export V_ICACHE_SIZE_BYTES={icachek}
// L2 Cache size # L2 Cache size
`define LLCACHE_SIZE_BYTES {l2k} export V_LLCACHE_SIZE_BYTES={l2k}
{codegen} {codegen}
`endif
""" """
# cluster, cores, warps, threads, l2, dcache, icache # cluster, cores, warps, threads, l2, dcache, icache
@@ -39,23 +36,13 @@ configs = [
(2, 4, 8, 8, 16, 8, 1), (2, 4, 8, 8, 16, 8, 1),
] ]
files = glob.glob(config_location + '/*') files = glob.glob(config_location + '/*.sh')
for f in files: for f in files:
os.remove(f) os.remove(f)
for clusters, cores, warps, threads, l2, dcache, icache in configs: for clusters, cores, warps, threads, l2, dcache, icache in configs:
l2k, dcachek, icachek = 1024 * l2, 1024 * dcache, 1024 * icache l2k, dcachek, icachek = 1024 * l2, 1024 * dcache, 1024 * icache
for force_mlab in [False]: name_suffix = ''
name_suffix = '' with open(config_location + '/' + name_template.format(**locals()), 'w') as f:
if force_mlab: codegen = ''
name_suffix += '-mlab' f.write(template.format(**locals()))
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()))