mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Fixed pyosys commands returning RTLIL::SigSig
This commit is contained in:
		
							parent
							
								
									96ade54993
								
							
						
					
					
						commit
						60eaaf6e0f
					
				
					 1 changed files with 10 additions and 16 deletions
				
			
		|  | @ -508,23 +508,17 @@ class TupleTranslator(PythonDictTranslator): | ||||||
| 	#Generate c++ code to translate to a boost::python::tuple | 	#Generate c++ code to translate to a boost::python::tuple | ||||||
| 	@classmethod | 	@classmethod | ||||||
| 	def translate_cpp(c, varname, types, prefix, ref): | 	def translate_cpp(c, varname, types, prefix, ref): | ||||||
| 		text  = prefix + TupleTranslator.typename + " " + varname + "___tmp = boost::python::make_tuple(" + varname + ".first, " + varname + ".second);" | 		# if the tuple is a pair of SigSpecs (aka SigSig), then we need | ||||||
| 		return text | 		# to call get_py_obj() on each item in the tuple | ||||||
| 		tmp_name = "tmp_" + str(Translator.tmp_cntr) | 		if types[0].name in classnames: | ||||||
| 		Translator.tmp_cntr = Translator.tmp_cntr + 1 | 			first_var = types[0].name + "::get_py_obj(" + varname + ".first)" | ||||||
| 		if ref: |  | ||||||
| 			text += prefix + "for(auto " + tmp_name + " : *" + varname + ")" |  | ||||||
| 		else: | 		else: | ||||||
| 			text += prefix + "for(auto " + tmp_name + " : " + varname + ")" | 			first_var = varname + ".first" | ||||||
| 		text += prefix + "{" | 		if types[1].name in classnames: | ||||||
| 		if types[0].name.split(" ")[-1] in primitive_types or types[0].name in enum_names: | 			second_var = types[1].name + "::get_py_obj(" + varname + ".second)" | ||||||
| 			text += prefix + "\t" + varname + "___tmp.append(" + tmp_name + ");" | 		else: | ||||||
| 		elif types[0].name in known_containers: | 			second_var = varname + ".second" | ||||||
| 			text += known_containers[types[0].name].translate_cpp(tmp_name, types[0].cont.args, prefix + "\t", types[1].attr_type == attr_types.star) | 		text  = prefix + TupleTranslator.typename + " " + varname + "___tmp = boost::python::make_tuple(" + first_var + ", " + second_var + ");" | ||||||
| 			text += prefix + "\t" + varname + "___tmp.append(" + types[0].name + "::get_py_obj(" + tmp_name + "___tmp);" |  | ||||||
| 		elif types[0].name in classnames: |  | ||||||
| 			text += prefix + "\t" + varname + "___tmp.append(" + types[0].name + "::get_py_obj(" + tmp_name + "));" |  | ||||||
| 		text += prefix + "}" |  | ||||||
| 		return text | 		return text | ||||||
| 
 | 
 | ||||||
| #Associate the Translators with their c++ type | #Associate the Translators with their c++ type | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue