mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 05:19:11 +00:00 
			
		
		
		
	Add generation of logic cells to EDIF back-end runtest.py
This commit is contained in:
		
							parent
							
								
									850f8299a9
								
							
						
					
					
						commit
						0ac72e759d
					
				
					 1 changed files with 6 additions and 2 deletions
				
			
		| 
						 | 
					@ -6,6 +6,7 @@ import numpy as np
 | 
				
			||||||
enable_upto = True
 | 
					enable_upto = True
 | 
				
			||||||
enable_offset = True
 | 
					enable_offset = True
 | 
				
			||||||
enable_hierarchy = True
 | 
					enable_hierarchy = True
 | 
				
			||||||
 | 
					enable_logic = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def make_module(f, modname, width, subs):
 | 
					def make_module(f, modname, width, subs):
 | 
				
			||||||
    print("module %s (A, B, C, X, Y, Z);" % modname, file=f)
 | 
					    print("module %s (A, B, C, X, Y, Z);" % modname, file=f)
 | 
				
			||||||
| 
						 | 
					@ -41,7 +42,10 @@ def make_module(f, modname, width, subs):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if submod is None or 3*subs[submod] >= len(outbits):
 | 
					        if submod is None or 3*subs[submod] >= len(outbits):
 | 
				
			||||||
            for bit in outbits:
 | 
					            for bit in outbits:
 | 
				
			||||||
                print("  assign %s = %s;" % (bit,  np.random.choice(inbits)), file=f)
 | 
					                if enable_logic:
 | 
				
			||||||
 | 
					                    print("  assign %s = %s & ~%s;" % (bit,  np.random.choice(inbits), np.random.choice(inbits)), file=f)
 | 
				
			||||||
 | 
					                else:
 | 
				
			||||||
 | 
					                    print("  assign %s = %s;" % (bit,  np.random.choice(inbits)), file=f)
 | 
				
			||||||
            break
 | 
					            break
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        instidx += 1
 | 
					        instidx += 1
 | 
				
			||||||
| 
						 | 
					@ -72,7 +76,7 @@ with open("test_top.v", "w") as f:
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        make_module(f, "top", 32, {})
 | 
					        make_module(f, "top", 32, {})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
os.system("set -x; ../../yosys -p 'prep -top top; write_edif -pvector par test_syn.edif' test_top.v")
 | 
					os.system("set -x; ../../yosys -p 'synth_xilinx -top top; write_edif -pvector par test_syn.edif' test_top.v")
 | 
				
			||||||
 | 
					
 | 
				
			||||||
with open("test_syn.tcl", "w") as f:
 | 
					with open("test_syn.tcl", "w") as f:
 | 
				
			||||||
    print("read_edif test_syn.edif", file=f)
 | 
					    print("read_edif test_syn.edif", file=f)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue