mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	Merge branch 'master' of github.com:cliffordwolf/yosys
This commit is contained in:
		
						commit
						4f35a81ad9
					
				
					 2 changed files with 100 additions and 63 deletions
				
			
		|  | @ -1329,32 +1329,32 @@ DEF_METHOD(Pmux,     "$pmux",       1) | ||||||
| #undef DEF_METHOD | #undef DEF_METHOD | ||||||
| 
 | 
 | ||||||
| #define DEF_METHOD_2(_func, _type, _P1, _P2) \ | #define DEF_METHOD_2(_func, _type, _P1, _P2) \ | ||||||
| 	RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, RTLIL::SigSpec sig1, RTLIL::SigSpec sig2) { \ | 	RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, RTLIL::SigBit sig1, RTLIL::SigBit sig2) { \ | ||||||
| 		RTLIL::Cell *cell = addCell(name, _type);         \ | 		RTLIL::Cell *cell = addCell(name, _type);         \ | ||||||
| 		cell->setPort("\\" #_P1, sig1);                   \ | 		cell->setPort("\\" #_P1, sig1);                   \ | ||||||
| 		cell->setPort("\\" #_P2, sig2);                   \ | 		cell->setPort("\\" #_P2, sig2);                   \ | ||||||
| 		return cell;                                      \ | 		return cell;                                      \ | ||||||
| 	} \ | 	} \ | ||||||
| 	RTLIL::SigSpec RTLIL::Module::_func(RTLIL::IdString name, RTLIL::SigSpec sig1) { \ | 	RTLIL::SigBit RTLIL::Module::_func(RTLIL::IdString name, RTLIL::SigBit sig1) { \ | ||||||
| 		RTLIL::SigSpec sig2 = addWire(NEW_ID);      \ | 		RTLIL::SigBit sig2 = addWire(NEW_ID);            \ | ||||||
| 		add ## _func(name, sig1, sig2);                   \ | 		add ## _func(name, sig1, sig2);                   \ | ||||||
| 		return sig2;                                      \ | 		return sig2;                                      \ | ||||||
| 	} | 	} | ||||||
| #define DEF_METHOD_3(_func, _type, _P1, _P2, _P3) \ | #define DEF_METHOD_3(_func, _type, _P1, _P2, _P3) \ | ||||||
| 	RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, RTLIL::SigSpec sig1, RTLIL::SigSpec sig2, RTLIL::SigSpec sig3) { \ | 	RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, RTLIL::SigBit sig1, RTLIL::SigBit sig2, RTLIL::SigBit sig3) { \ | ||||||
| 		RTLIL::Cell *cell = addCell(name, _type);         \ | 		RTLIL::Cell *cell = addCell(name, _type);         \ | ||||||
| 		cell->setPort("\\" #_P1, sig1);                   \ | 		cell->setPort("\\" #_P1, sig1);                   \ | ||||||
| 		cell->setPort("\\" #_P2, sig2);                   \ | 		cell->setPort("\\" #_P2, sig2);                   \ | ||||||
| 		cell->setPort("\\" #_P3, sig3);                   \ | 		cell->setPort("\\" #_P3, sig3);                   \ | ||||||
| 		return cell;                                      \ | 		return cell;                                      \ | ||||||
| 	} \ | 	} \ | ||||||
| 	RTLIL::SigSpec RTLIL::Module::_func(RTLIL::IdString name, RTLIL::SigSpec sig1, RTLIL::SigSpec sig2) { \ | 	RTLIL::SigBit RTLIL::Module::_func(RTLIL::IdString name, RTLIL::SigBit sig1, RTLIL::SigBit sig2) { \ | ||||||
| 		RTLIL::SigSpec sig3 = addWire(NEW_ID);      \ | 		RTLIL::SigBit sig3 = addWire(NEW_ID);            \ | ||||||
| 		add ## _func(name, sig1, sig2, sig3);             \ | 		add ## _func(name, sig1, sig2, sig3);             \ | ||||||
| 		return sig3;                                      \ | 		return sig3;                                      \ | ||||||
| 	} | 	} | ||||||
| #define DEF_METHOD_4(_func, _type, _P1, _P2, _P3, _P4) \ | #define DEF_METHOD_4(_func, _type, _P1, _P2, _P3, _P4) \ | ||||||
| 	RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, RTLIL::SigSpec sig1, RTLIL::SigSpec sig2, RTLIL::SigSpec sig3, RTLIL::SigSpec sig4) { \ | 	RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, RTLIL::SigBit sig1, RTLIL::SigBit sig2, RTLIL::SigBit sig3, RTLIL::SigBit sig4) { \ | ||||||
| 		RTLIL::Cell *cell = addCell(name, _type);         \ | 		RTLIL::Cell *cell = addCell(name, _type);         \ | ||||||
| 		cell->setPort("\\" #_P1, sig1);                   \ | 		cell->setPort("\\" #_P1, sig1);                   \ | ||||||
| 		cell->setPort("\\" #_P2, sig2);                   \ | 		cell->setPort("\\" #_P2, sig2);                   \ | ||||||
|  | @ -1362,19 +1362,42 @@ DEF_METHOD(Pmux,     "$pmux",       1) | ||||||
| 		cell->setPort("\\" #_P4, sig4);                   \ | 		cell->setPort("\\" #_P4, sig4);                   \ | ||||||
| 		return cell;                                      \ | 		return cell;                                      \ | ||||||
| 	} \ | 	} \ | ||||||
| 	RTLIL::SigSpec RTLIL::Module::_func(RTLIL::IdString name, RTLIL::SigSpec sig1, RTLIL::SigSpec sig2, RTLIL::SigSpec sig3) { \ | 	RTLIL::SigBit RTLIL::Module::_func(RTLIL::IdString name, RTLIL::SigBit sig1, RTLIL::SigBit sig2, RTLIL::SigBit sig3) { \ | ||||||
| 		RTLIL::SigSpec sig4 = addWire(NEW_ID);      \ | 		RTLIL::SigBit sig4 = addWire(NEW_ID);            \ | ||||||
| 		add ## _func(name, sig1, sig2, sig3, sig4);       \ | 		add ## _func(name, sig1, sig2, sig3, sig4);       \ | ||||||
| 		return sig4;                                      \ | 		return sig4;                                      \ | ||||||
| 	} | 	} | ||||||
|  | #define DEF_METHOD_5(_func, _type, _P1, _P2, _P3, _P4, _P5) \ | ||||||
|  | 	RTLIL::Cell* RTLIL::Module::add ## _func(RTLIL::IdString name, RTLIL::SigBit sig1, RTLIL::SigBit sig2, RTLIL::SigBit sig3, RTLIL::SigBit sig4, RTLIL::SigBit sig5) { \ | ||||||
|  | 		RTLIL::Cell *cell = addCell(name, _type);         \ | ||||||
|  | 		cell->setPort("\\" #_P1, sig1);                   \ | ||||||
|  | 		cell->setPort("\\" #_P2, sig2);                   \ | ||||||
|  | 		cell->setPort("\\" #_P3, sig3);                   \ | ||||||
|  | 		cell->setPort("\\" #_P4, sig4);                   \ | ||||||
|  | 		cell->setPort("\\" #_P5, sig5);                   \ | ||||||
|  | 		return cell;                                      \ | ||||||
|  | 	} \ | ||||||
|  | 	RTLIL::SigBit RTLIL::Module::_func(RTLIL::IdString name, RTLIL::SigBit sig1, RTLIL::SigBit sig2, RTLIL::SigBit sig3, RTLIL::SigBit sig4) { \ | ||||||
|  | 		RTLIL::SigBit sig5 = addWire(NEW_ID);            \ | ||||||
|  | 		add ## _func(name, sig1, sig2, sig3, sig4, sig5); \ | ||||||
|  | 		return sig5;                                      \ | ||||||
|  | 	} | ||||||
| DEF_METHOD_2(NotGate,  "$_NOT_",  A, Y) | DEF_METHOD_2(NotGate,  "$_NOT_",  A, Y) | ||||||
| DEF_METHOD_3(AndGate,  "$_AND_",  A, B, Y) | DEF_METHOD_3(AndGate,  "$_AND_",  A, B, Y) | ||||||
|  | DEF_METHOD_3(NandGate, "$_NAND_", A, B, Y) | ||||||
| DEF_METHOD_3(OrGate,   "$_OR_",   A, B, Y) | DEF_METHOD_3(OrGate,   "$_OR_",   A, B, Y) | ||||||
|  | DEF_METHOD_3(NorGate,  "$_NOR_",  A, B, Y) | ||||||
| DEF_METHOD_3(XorGate,  "$_XOR_",  A, B, Y) | DEF_METHOD_3(XorGate,  "$_XOR_",  A, B, Y) | ||||||
|  | DEF_METHOD_3(XnorGate, "$_XNOR_", A, B, Y) | ||||||
| DEF_METHOD_4(MuxGate,  "$_MUX_",  A, B, S, Y) | DEF_METHOD_4(MuxGate,  "$_MUX_",  A, B, S, Y) | ||||||
|  | DEF_METHOD_4(Aoi3Gate, "$_AOI3_", A, B, C, Y) | ||||||
|  | DEF_METHOD_4(Oai3Gate, "$_OAI3_", A, B, C, Y) | ||||||
|  | DEF_METHOD_5(Aoi4Gate, "$_AOI4_", A, B, C, D, Y) | ||||||
|  | DEF_METHOD_5(Oai4Gate, "$_OAI4_", A, B, C, D, Y) | ||||||
| #undef DEF_METHOD_2 | #undef DEF_METHOD_2 | ||||||
| #undef DEF_METHOD_3 | #undef DEF_METHOD_3 | ||||||
| #undef DEF_METHOD_4 | #undef DEF_METHOD_4 | ||||||
|  | #undef DEF_METHOD_5 | ||||||
| 
 | 
 | ||||||
| RTLIL::Cell* RTLIL::Module::addPow(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool a_signed, bool b_signed) | RTLIL::Cell* RTLIL::Module::addPow(RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y, bool a_signed, bool b_signed) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -697,11 +697,18 @@ public: | ||||||
| 	RTLIL::Cell* addDlatchsr (RTLIL::IdString name, RTLIL::SigSpec sig_en, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, | 	RTLIL::Cell* addDlatchsr (RTLIL::IdString name, RTLIL::SigSpec sig_en, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, | ||||||
| 			RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool en_polarity = true, bool set_polarity = true, bool clr_polarity = true); | 			RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool en_polarity = true, bool set_polarity = true, bool clr_polarity = true); | ||||||
| 
 | 
 | ||||||
| 	RTLIL::Cell* addNotGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_y); | 	RTLIL::Cell* addNotGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_y); | ||||||
| 	RTLIL::Cell* addAndGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y); | 	RTLIL::Cell* addAndGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y); | ||||||
| 	RTLIL::Cell* addOrGate   (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y); | 	RTLIL::Cell* addNandGate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y); | ||||||
| 	RTLIL::Cell* addXorGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_y); | 	RTLIL::Cell* addOrGate   (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y); | ||||||
| 	RTLIL::Cell* addMuxGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_s, RTLIL::SigSpec sig_y); | 	RTLIL::Cell* addNorGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y); | ||||||
|  | 	RTLIL::Cell* addXorGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y); | ||||||
|  | 	RTLIL::Cell* addXnorGate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_y); | ||||||
|  | 	RTLIL::Cell* addMuxGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_s, RTLIL::SigBit sig_y); | ||||||
|  | 	RTLIL::Cell* addAoi3Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_y); | ||||||
|  | 	RTLIL::Cell* addOai3Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_y); | ||||||
|  | 	RTLIL::Cell* addAoi4Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_d, RTLIL::SigBit sig_y); | ||||||
|  | 	RTLIL::Cell* addOai4Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_d, RTLIL::SigBit sig_y); | ||||||
| 
 | 
 | ||||||
| 	RTLIL::Cell* addDffGate    (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity = true); | 	RTLIL::Cell* addDffGate    (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_d, RTLIL::SigSpec sig_q, bool clk_polarity = true); | ||||||
| 	RTLIL::Cell* addDffsrGate  (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, | 	RTLIL::Cell* addDffsrGate  (RTLIL::IdString name, RTLIL::SigSpec sig_clk, RTLIL::SigSpec sig_set, RTLIL::SigSpec sig_clr, | ||||||
|  | @ -760,11 +767,18 @@ public: | ||||||
| 	RTLIL::SigSpec Mux      (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_s); | 	RTLIL::SigSpec Mux      (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_s); | ||||||
| 	RTLIL::SigSpec Pmux     (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_s); | 	RTLIL::SigSpec Pmux     (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_s); | ||||||
| 
 | 
 | ||||||
| 	RTLIL::SigSpec NotGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a); | 	RTLIL::SigBit NotGate  (RTLIL::IdString name, RTLIL::SigBit sig_a); | ||||||
| 	RTLIL::SigSpec AndGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b); | 	RTLIL::SigBit AndGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b); | ||||||
| 	RTLIL::SigSpec OrGate   (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b); | 	RTLIL::SigBit NandGate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b); | ||||||
| 	RTLIL::SigSpec XorGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b); | 	RTLIL::SigBit OrGate   (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b); | ||||||
| 	RTLIL::SigSpec MuxGate  (RTLIL::IdString name, RTLIL::SigSpec sig_a, RTLIL::SigSpec sig_b, RTLIL::SigSpec sig_s); | 	RTLIL::SigBit NorGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b); | ||||||
|  | 	RTLIL::SigBit XorGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b); | ||||||
|  | 	RTLIL::SigBit XnorGate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b); | ||||||
|  | 	RTLIL::SigBit MuxGate  (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_s); | ||||||
|  | 	RTLIL::SigBit Aoi3Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c); | ||||||
|  | 	RTLIL::SigBit Oai3Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c); | ||||||
|  | 	RTLIL::SigBit Aoi4Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_d); | ||||||
|  | 	RTLIL::SigBit Oai4Gate (RTLIL::IdString name, RTLIL::SigBit sig_a, RTLIL::SigBit sig_b, RTLIL::SigBit sig_c, RTLIL::SigBit sig_d); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| struct RTLIL::Wire | struct RTLIL::Wire | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue