

def check_compile(model):
    model.elaborate()
    with tempfile.NamedTemporaryFile(suffix='.v') as output:
        translate(model, output)
        output.flush()
        cmd = '{} {}'.format(compiler, output.name)
        try:
            result = check_output(cmd.split(), stderr=STDOUT)
            output.seek(0)
            verilog_src = output.read()
            print()
            print(verilog_src)
        except CalledProcessError as e:
            output.seek(0)
            verilog_src = output.read()
            raise IVerilogCompileError('Module did not compile!\n\nCommand:\n {}\n\nError:\n {}Source:\n {}'.format(' '.join(e.cmd), e.output, verilog_src))

dataset/ETHPy150Open cornell-brg/pymtl/pymtl/tools/translation/verilog.py check_compile/original