mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-11-04 13:29:12 +00:00 
			
		
		
		
	Get rid of sigAset
This commit is contained in:
		
							parent
							
								
									42548d9790
								
							
						
					
					
						commit
						91ef4457b0
					
				
					 1 changed files with 14 additions and 10 deletions
				
			
		| 
						 | 
					@ -1,18 +1,21 @@
 | 
				
			||||||
pattern xilinx_dsp
 | 
					pattern xilinx_dsp
 | 
				
			||||||
 | 
					
 | 
				
			||||||
state <SigBit> clock
 | 
					state <SigBit> clock
 | 
				
			||||||
state <std::set<SigBit>> sigAset sigBset
 | 
					state <std::set<SigBit>> sigBset
 | 
				
			||||||
state <SigSpec> sigC sigM sigP sigPused
 | 
					state <SigSpec> sigA sigC sigM sigP sigPused
 | 
				
			||||||
state <IdString> ffMmuxAB postAddAB postAddMuxAB
 | 
					state <IdString> ffMmuxAB postAddAB postAddMuxAB
 | 
				
			||||||
 | 
					
 | 
				
			||||||
match dsp
 | 
					match dsp
 | 
				
			||||||
	select dsp->type.in(\DSP48E1)
 | 
						select dsp->type.in(\DSP48E1)
 | 
				
			||||||
endmatch
 | 
					endmatch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
code sigAset sigBset
 | 
					code sigA sigBset
 | 
				
			||||||
	SigSpec A = port(dsp, \A);
 | 
						sigA = port(dsp, \A);
 | 
				
			||||||
	A.remove_const();
 | 
						int i;
 | 
				
			||||||
	sigAset = A.to_sigbit_set();
 | 
						for (i = GetSize(sigA)-1; i > 0; i--)
 | 
				
			||||||
 | 
							if (sigA[i] != sigA[i-1])
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
 | 
						sigA.remove(i, GetSize(sigA)-i);
 | 
				
			||||||
	SigSpec B = port(dsp, \B);
 | 
						SigSpec B = port(dsp, \B);
 | 
				
			||||||
	B.remove_const();
 | 
						B.remove_const();
 | 
				
			||||||
	sigBset = B.to_sigbit_set();
 | 
						sigBset = B.to_sigbit_set();
 | 
				
			||||||
| 
						 | 
					@ -34,21 +37,22 @@ endcode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
match ffA
 | 
					match ffA
 | 
				
			||||||
	if param(dsp, \AREG).as_int() == 0
 | 
						if param(dsp, \AREG).as_int() == 0
 | 
				
			||||||
	if !sigAset.empty()
 | 
					 | 
				
			||||||
	select ffA->type.in($dff)
 | 
						select ffA->type.in($dff)
 | 
				
			||||||
	// DSP48E1 does not support clock inversion
 | 
						// DSP48E1 does not support clock inversion
 | 
				
			||||||
	select param(ffA, \CLK_POLARITY).as_bool()
 | 
						select param(ffA, \CLK_POLARITY).as_bool()
 | 
				
			||||||
	filter includes(port(ffA, \Q).to_sigbit_set(), sigAset)
 | 
						filter GetSize(port(ffA, \Q)) >= GetSize(sigA)
 | 
				
			||||||
 | 
						slice offset GetSize(port(ffA, \Q))
 | 
				
			||||||
 | 
						filter offset+GetSize(sigA) <= GetSize(port(ffA, \Q)) && port(ffA, \Q).extract(offset, GetSize(sigA)) == sigA
 | 
				
			||||||
	optional
 | 
						optional
 | 
				
			||||||
endmatch
 | 
					endmatch
 | 
				
			||||||
 | 
					
 | 
				
			||||||
code clock
 | 
					code clock
 | 
				
			||||||
	if (ffA) {
 | 
						if (ffA) {
 | 
				
			||||||
		clock = port(ffA, \CLK).as_bit();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
		for (auto b : port(ffA, \Q))
 | 
							for (auto b : port(ffA, \Q))
 | 
				
			||||||
			if (b.wire->get_bool_attribute(\keep))
 | 
								if (b.wire->get_bool_attribute(\keep))
 | 
				
			||||||
				reject;
 | 
									reject;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							clock = port(ffA, \CLK).as_bit();
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
endcode
 | 
					endcode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue