Пример #1
0
    def build(self):
        super(Verilator, self).build()
        args = ['-c']
        args += ['-I'+s for s in self.include_dirs]
        for src_file in self.src_files:
            print("Compiling " + src_file)
            utils.launch('gcc',
                         args + [src_file],
                         cwd=self.sim_root)

        object_files = [os.path.splitext(os.path.basename(s))[0]+'.o' for s in self.src_files]
        
        try:
            cmd = os.path.join(self.verilator_root,'bin','verilator')
            subprocess.check_call(['bash', cmd,
                                   '--cc',
                                   '-f', self.verilator_file,
                                   '--top-module', 'orpsoc_top',
                                   '--exe'] + 
                                  [os.path.join(self.sim_root, s) for s in object_files] + [self.tb_toplevel] + self.verilator_options,
                                  stderr = open(os.path.join(self.sim_root,'verilator.log'),'w'),
                                  cwd = os.path.join(self.sim_root))
        except OSError:
            print("Error: Command verilator not found. Make sure it is in $PATH")
            exit(1)
        except subprocess.CalledProcessError:
            print("Error: Failed to compile. See " + os.path.join(self.sim_root,'verilator.log') + " for details")
            exit(1)
        utils.launch('make -f Vorpsoc_top.mk Vorpsoc_top',
                     cwd=os.path.join(self.sim_root, 'obj_dir'),
                     shell=True)
Пример #2
0
 def pgm(self, remaining):
     logger.debug('pgm() *Entered*')
     args = ['--mode=jtag']
     args += remaining
     args += ['-o']
     args += ['p;' + self.system.name + '.sof']
     utils.launch('quartus_pgm', args, cwd=self.work_root)
     logger.debug('pgm() -Done-')
Пример #3
0
    def build_SysC(self):

	object_files = [os.path.splitext(os.path.basename(s))[0]+'.o' for s in self.src_files]

	#verilogue
	try:
	    cmd = os.path.join(self.verilator_root,'bin','verilator') 
	    subprocess.check_call(['bash',cmd,'--sc','--top-module', 'orpsoc_top','-f',self.verilator_file,'--exe']+
				    [os.path.join(self.sim_root, s) for s in object_files]+[self.tb_toplevel]+self.verilator_options,
            			    cwd = os.path.join(self.sim_root),
	    			    stderr = open(os.path.join(self.sim_root,'verilator.log'),'w'))
        except OSError:
            print("Error: Command verilator not found. Make sure it is in $PATH")
            exit(1)
        except subprocess.CalledProcessError:
            print("Error: Failed to compile. See " + os.path.join(self.sim_root,'verilator.log') + " for details")
            exit(1)

	 #src_files	
	args = ['-I.']
	args += ['-MMD']
	args += ['-I'+s for s in self.include_dirs]
	args += ['-Iobj_dir']
	args += ['-I'+os.path.join(self.verilator_root,'include')]
	args += ['-I'+os.path.join(self.verilator_root,'include', 'vltstd')]  
	args += ['-DVL_PRINTF=printf']
	args += ['-DVM_TRACE=1']
	args += ['-DVM_COVERAGE=0']
	args += [os.getenv('SYSTEMC_CXX_FLAGS')]
	args += ['-I'+os.getenv('SYSTEMC_INCLUDE')]
	args += ['-Wno-deprecated']
	args += [os.getenv('SYSTEMC_CXX_FLAGS')]
	args += ['-c']
	args += ['-g']

	for src_file in self.src_files:
	    print("Compiling " + src_file)
	    utils.launch('g++',args + ['-o' + os.path.splitext(os.path.basename(src_file))[0]+'.o']+ [src_file],
				cwd=self.sim_root)

	#tb_toplevel
        utils.launch('make -f Vorpsoc_top.mk Vorpsoc_top',
                     cwd=os.path.join(self.sim_root, 'obj_dir'),
                     shell=True)
Пример #4
0
 def run(self, args):
     #TODO: Handle arguments parsing
     utils.launch('./Vorpsoc_top',
                  args,
                  cwd=os.path.join(self.sim_root, 'obj_dir'))
Пример #5
0
 def pgm(self, remaining):
     args = ['--mode=jtag']
     args += remaining
     args += ['-o']
     args += ['p;' + self.system.name + '.sof']
     utils.launch('quartus_pgm', args, cwd=self.work_root)