mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	Merge pull request #1603 from whitequark/ice40-ram_style
ice40/ecp5: add support for both 1364.1 and Synplify/LSE RAM/ROM attributes
This commit is contained in:
		
						commit
						93ef516d91
					
				
					 12 changed files with 837 additions and 51 deletions
				
			
		|  | @ -37,7 +37,17 @@ bram $__ECP5_DP16KD | |||
|   clkpol 2 3 | ||||
| endbram | ||||
| 
 | ||||
| # The syn_* attributes are described in: | ||||
| # https://www.latticesemi.com/-/media/LatticeSemi/Documents/Tutorials/AK/LatticeDiamondTutorial311.ashx | ||||
| attr_icase 1 | ||||
| 
 | ||||
| match $__ECP5_PDPW16KD | ||||
|   # implicitly requested RAM or ROM | ||||
|   attribute !syn_ramstyle syn_ramstyle=auto | ||||
|   attribute !syn_romstyle syn_romstyle=auto | ||||
|   attribute !ram_block | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min bits 2048 | ||||
|   min efficiency 5 | ||||
|   shuffle_enable A | ||||
|  | @ -45,8 +55,60 @@ match $__ECP5_PDPW16KD | |||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ECP5_PDPW16KD | ||||
|   # explicitly requested RAM | ||||
|   attribute syn_ramstyle=block_ram ram_block | ||||
|   attribute !syn_romstyle | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min wports 1 | ||||
|   shuffle_enable A | ||||
|   make_transp | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ECP5_PDPW16KD | ||||
|   # explicitly requested ROM | ||||
|   attribute syn_romstyle=ebr rom_block | ||||
|   attribute !syn_ramstyle | ||||
|   attribute !ram_block | ||||
|   attribute !logic_block | ||||
|   max wports 0 | ||||
|   shuffle_enable A | ||||
|   make_transp | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ECP5_DP16KD | ||||
|   # implicitly requested RAM or ROM | ||||
|   attribute !syn_ramstyle syn_ramstyle=auto | ||||
|   attribute !syn_romstyle syn_romstyle=auto | ||||
|   attribute !ram_block | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min bits 2048 | ||||
|   min efficiency 5 | ||||
|   shuffle_enable A | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ECP5_DP16KD | ||||
|   # explicitly requested RAM | ||||
|   attribute syn_ramstyle=block_ram ram_block | ||||
|   attribute !syn_romstyle | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min wports 1 | ||||
|   shuffle_enable A | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ECP5_DP16KD | ||||
|   # explicitly requested ROM | ||||
|   attribute syn_romstyle=ebr rom_block | ||||
|   attribute !syn_ramstyle | ||||
|   attribute !ram_block | ||||
|   attribute !logic_block | ||||
|   max wports 0 | ||||
|   shuffle_enable A | ||||
| endmatch | ||||
|  |  | |||
|  | @ -11,7 +11,16 @@ bram $__TRELLIS_DPR16X4 | |||
|   clkpol 0 2 | ||||
| endbram | ||||
| 
 | ||||
| # The syn_* attributes are described in: | ||||
| # https://www.latticesemi.com/-/media/LatticeSemi/Documents/Tutorials/AK/LatticeDiamondTutorial311.ashx | ||||
| attr_icase 1 | ||||
| 
 | ||||
| match $__TRELLIS_DPR16X4 | ||||
| 	attribute !syn_ramstyle syn_ramstyle=auto syn_ramstyle=distributed | ||||
| 	attribute !syn_romstyle syn_romstyle=auto | ||||
| 	attribute !ram_block | ||||
| 	attribute !rom_block | ||||
| 	attribute !logic_block | ||||
|   make_outreg | ||||
|   min wports 1 | ||||
| endmatch | ||||
|  |  | |||
|  | @ -279,7 +279,9 @@ struct SynthEcp5Pass : public ScriptPass | |||
| 		if (check_label("map_ffram")) | ||||
| 		{ | ||||
| 			run("opt -fast -mux_undef -undriven -fine"); | ||||
| 			run("memory_map"); | ||||
| 			run("memory_map -iattr -attr !ram_block -attr !rom_block -attr logic_block " | ||||
| 			    "-attr syn_ramstyle=auto -attr syn_ramstyle=registers " | ||||
| 			    "-attr syn_romstyle=auto -attr syn_romstyle=logic"); | ||||
| 			run("opt -undriven -fine"); | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
|  | @ -28,13 +28,73 @@ bram $__ICE40_RAM4K_M123 | |||
|   clkpol 2 3 | ||||
| endbram | ||||
| 
 | ||||
| # The syn_* attributes are described in: | ||||
| # https://www.latticesemi.com/-/media/LatticeSemi/Documents/Tutorials/AK/LatticeDiamondTutorial311.ashx | ||||
| attr_icase 1 | ||||
| 
 | ||||
| match $__ICE40_RAM4K_M0 | ||||
|   # implicitly requested RAM or ROM | ||||
|   attribute !syn_ramstyle syn_ramstyle=auto | ||||
|   attribute !syn_romstyle syn_romstyle=auto | ||||
|   attribute !ram_block | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min efficiency 2 | ||||
|   make_transp | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ICE40_RAM4K_M0 | ||||
|   # explicitly requested RAM | ||||
|   attribute syn_ramstyle=block_ram ram_block | ||||
|   attribute !syn_romstyle | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min wports 1 | ||||
|   make_transp | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ICE40_RAM4K_M0 | ||||
|   # explicitly requested ROM | ||||
|   attribute syn_romstyle=ebr rom_block | ||||
|   attribute !syn_ramstyle | ||||
|   attribute !ram_block | ||||
|   attribute !logic_block | ||||
|   max wports 0 | ||||
|   make_transp | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ICE40_RAM4K_M123 | ||||
|   # implicitly requested RAM or ROM | ||||
|   attribute !syn_ramstyle syn_ramstyle=auto | ||||
|   attribute !syn_romstyle syn_romstyle=auto | ||||
|   attribute !ram_block | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min efficiency 2 | ||||
|   make_transp | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ICE40_RAM4K_M123 | ||||
|   min efficiency 2 | ||||
|   # explicitly requested RAM | ||||
|   attribute syn_ramstyle=block_ram ram_block | ||||
|   attribute !syn_romstyle | ||||
|   attribute !rom_block | ||||
|   attribute !logic_block | ||||
|   min wports 1 | ||||
|   make_transp | ||||
|   or_next_if_better | ||||
| endmatch | ||||
| 
 | ||||
| match $__ICE40_RAM4K_M123 | ||||
|   # explicitly requested ROM | ||||
|   attribute syn_romstyle=ebr rom_block | ||||
|   attribute !syn_ramstyle | ||||
|   attribute !ram_block | ||||
|   attribute !logic_block | ||||
|   max wports 0 | ||||
|   make_transp | ||||
| endmatch | ||||
|  |  | |||
|  | @ -319,7 +319,9 @@ struct SynthIce40Pass : public ScriptPass | |||
| 		if (check_label("map_ffram")) | ||||
| 		{ | ||||
| 			run("opt -fast -mux_undef -undriven -fine"); | ||||
| 			run("memory_map"); | ||||
| 			run("memory_map -iattr -attr !ram_block -attr !rom_block -attr logic_block " | ||||
| 			    "-attr syn_ramstyle=auto -attr syn_ramstyle=registers " | ||||
| 			    "-attr syn_romstyle=auto -attr syn_romstyle=logic"); | ||||
| 			run("opt -undriven -fine"); | ||||
| 		} | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue