#!/bin/bash # Reference solution: installs the estimator into /app/estimator. # estimate.py port of memory_libmap / memlib (library parser, port assignment, geometry, int-truncated cost, # selection, emulation flip-flops) plus the INIT emission (gen_swizzle with the widest hardware # width, the INIT row loop, clean_undef for no_undef libraries) and the cell-listing digest # premap.py the $mem_v2 the flow hands to memory_libmap: write/read ports per coding idiom, the $meminit # entries of each init program and of $readmemh (Yosys' readmem loop), wreduce's address trim, # opt_mem's constant-lane test over the raw entries, dead read ports, get_init_data # gen11.py a copy of /app/ramgen/gen11.py (hexfile() gives the text $readmemh reads) # memlibs.json the eight library files of /app/yosys/techlibs, verbatim set -e HERE=$(cd "$(dirname "$0")" && pwd) mkdir -p /app/estimator cp "$HERE/estimate.py" "$HERE/premap.py" "$HERE/memlibs.json" /app/estimator/ cp /app/ramgen/gen11.py /app/estimator/gen11.py python3 -c " import sys; sys.path.insert(0, '/app/estimator'); import estimate print(estimate.estimate({'flow': 'xc7', 'W': 16, 'D': 1024, 'decl': 'up', 'wstyle': 'none', 'rstyle': 'sync', 'dwidth': 'exact', 'awidth': 'exact', 'edge': 'pos', 'rd2': 'none', 'rslice': 'full', 'init': 'file', 'hexform': 'seq', 'hexargs': 'none'}))"