Beispiel #1
0
def run_iverilog(run_path, libname='work', vvp='vvp', stdout=None, stderr=None):
    if not os.path.isdir(run_path):
        raise RuntimeError('Invalid simulation path')
    cwd = os.getcwd()
    os.chdir(run_path)
    if not os.access(libname, os.X_OK):
        raise RuntimeError('Invalid simulation module "%s"'%libname)
    try:
        if sys_utils.run_command('%s %s'%(vvp, libname),
                                 stdout=stdout, stderr=stderr):
            raise RuntimeError('Icarus Verilog simulation is not successful')
    finally:
        os.chdir(cwd)
Beispiel #2
0
def compile_vsim_lib(compile_script, run_path, vsim='vsim',
                     stdout=None, stderr=None):
    cs = os.path.abspath(compile_script)
    if not os.access(cs, os.R_OK):
        raise RuntimeError('Invalid compilation script "%s"'%compile_script)
    cwd = os.getcwd()
    sys_utils.mkdir_p(run_path)
    os.chdir(run_path)
    try:
        if sys_utils.run_command('%s -c -do %s'%(vsim, cs),
                                 stdout=stdout, stderr=stderr):
            raise RuntimeError('Cannot compile Modelsim library')
    finally:
        os.chdir(cwd)
Beispiel #3
0
def compile_iverilog_lib(filelist, run_path, inc_path, libname='work',
                         ivlog='iverilog',stdout=None, stderr=None):
    fl = os.path.abspath(filelist)
    if not os.access(fl, os.R_OK):
        raise RuntimeError('Invalid file list "%s"'%filelist)

    
    cmd = ivlog + ' -c %s -o %s'%(fl, libname)
    for p in inc_path: cmd += ' -I%s'%os.path.abspath(p)
    cwd = os.getcwd()
    sys_utils.mkdir_p(run_path)
    os.chdir(run_path)
    try:
        if sys_utils.run_command(cmd, stdout=stdout, stderr=stderr):
            raise RuntimeError('Cannot compile Icarus Verilog library')
    finally:
        os.chdir(cwd)
Beispiel #4
0
def run_iverilog(run_path,
                 libname='work',
                 vvp='vvp',
                 stdout=None,
                 stderr=None):
    if not os.path.isdir(run_path):
        raise RuntimeError('Invalid simulation path')
    cwd = os.getcwd()
    os.chdir(run_path)
    if not os.access(libname, os.X_OK):
        raise RuntimeError('Invalid simulation module "%s"' % libname)
    try:
        if sys_utils.run_command('%s %s' % (vvp, libname),
                                 stdout=stdout,
                                 stderr=stderr):
            raise RuntimeError('Icarus Verilog simulation is not successful')
    finally:
        os.chdir(cwd)
Beispiel #5
0
def compile_vsim_lib(compile_script,
                     run_path,
                     vsim='vsim',
                     stdout=None,
                     stderr=None):
    cs = os.path.abspath(compile_script)
    if not os.access(cs, os.R_OK):
        raise RuntimeError('Invalid compilation script "%s"' % compile_script)
    cwd = os.getcwd()
    sys_utils.mkdir_p(run_path)
    os.chdir(run_path)
    try:
        if sys_utils.run_command('%s -c -do %s' % (vsim, cs),
                                 stdout=stdout,
                                 stderr=stderr):
            raise RuntimeError('Cannot compile Modelsim library')
    finally:
        os.chdir(cwd)
Beispiel #6
0
def run_vsim(run_script, run_path, vsim='vsim',
             stdout=None, stderr=None, gui=False):
    if not os.path.isdir(run_path):
        raise RuntimeError('Invalid simulation path')
    rs = os.path.abspath(run_script)
    if not os.access(rs, os.R_OK):
        raise RuntimeError('Invalid simulation script "%s"'%run_script)
    cwd = os.getcwd()
    os.chdir(run_path)
    try:
        if gui:
            visible=""
        else:
            visible="-c"
        if sys_utils.run_command('%s %s -do %s'%(vsim, visible, rs),
                                 stdout=stdout, stderr=stderr):
            raise RuntimeError('Modelsim simulation is not successful')
    finally:
        os.chdir(cwd)
Beispiel #7
0
def compile_iverilog_lib(filelist,
                         run_path,
                         inc_path,
                         libname='work',
                         ivlog='iverilog',
                         stdout=None,
                         stderr=None):
    fl = os.path.abspath(filelist)
    if not os.access(fl, os.R_OK):
        raise RuntimeError('Invalid file list "%s"' % filelist)

    cmd = ivlog + ' -c %s -o %s' % (fl, libname)
    for p in inc_path:
        cmd += ' -I%s' % os.path.abspath(p)
    cwd = os.getcwd()
    sys_utils.mkdir_p(run_path)
    os.chdir(run_path)
    try:
        if sys_utils.run_command(cmd, stdout=stdout, stderr=stderr):
            raise RuntimeError('Cannot compile Icarus Verilog library')
    finally:
        os.chdir(cwd)
Beispiel #8
0
def run_vsim(run_script,
             run_path,
             vsim='vsim',
             stdout=None,
             stderr=None,
             gui=False):
    if not os.path.isdir(run_path):
        raise RuntimeError('Invalid simulation path')
    rs = os.path.abspath(run_script)
    if not os.access(rs, os.R_OK):
        raise RuntimeError('Invalid simulation script "%s"' % run_script)
    cwd = os.getcwd()
    os.chdir(run_path)
    try:
        if gui:
            visible = ""
        else:
            visible = "-c"
        if sys_utils.run_command('%s %s -do %s' % (vsim, visible, rs),
                                 stdout=stdout,
                                 stderr=stderr):
            raise RuntimeError('Modelsim simulation is not successful')
    finally:
        os.chdir(cwd)