├── README.md ├── board ├── DigilentS3 │ ├── impact.cmd │ ├── top.ucf │ ├── top.ut │ └── top.xst └── xula2 │ ├── impact.cmd │ ├── top.ucf │ ├── top.ut │ └── top.xst ├── ise └── Makefile └── src ├── top.prj └── top.v /README.md: -------------------------------------------------------------------------------- 1 | A minimal makefile for Xilinx projects using ISE 2 | 3 | See article at: http://www.fpgarelated.com/showarticle/786.php 4 | 5 | Now works with both Spartan3 and Spartan6... 6 | -------------------------------------------------------------------------------- /board/DigilentS3/impact.cmd: -------------------------------------------------------------------------------- 1 | setMode -bscan 2 | setCable -p auto 3 | identify -inferir 4 | assignFile -p 1 -file top.bit 5 | #addDevice -p 1 -file top.bit 6 | program -p 1 -onlyFpga 7 | exit 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /board/DigilentS3/top.ucf: -------------------------------------------------------------------------------- 1 | # 2 | # XC3S200 - Digilent S3 board 3 | # 4 | NET "led" LOC = K12 | IOSTANDARD = LVCMOS33 ; 5 | NET "clk" LOC = T9 | IOSTANDARD = LVCMOS33 ; #50MHz 6 | 7 | NET "clk" PERIOD = 50 MHz; 8 | -------------------------------------------------------------------------------- /board/DigilentS3/top.ut: -------------------------------------------------------------------------------- 1 | -w 2 | -g DebugBitstream:No 3 | -g Binary:no 4 | -g CRC:Enable 5 | -g ConfigRate:6 6 | -g CclkPin:PullUp 7 | -g M0Pin:PullUp 8 | -g M1Pin:PullUp 9 | -g M2Pin:PullUp 10 | -g ProgPin:PullUp 11 | -g DonePin:PullUp 12 | -g HswapenPin:PullUp 13 | -g TckPin:PullUp 14 | -g TdiPin:PullUp 15 | -g TdoPin:PullUp 16 | -g TmsPin:PullUp 17 | -g UnusedPin:PullDown 18 | -g UserID:0xFFFFFFFF 19 | -g DCMShutdown:Disable 20 | -g DCIUpdateMode:AsRequired 21 | -g StartUpClk:CClk 22 | -g DONE_cycle:4 23 | -g GTS_cycle:5 24 | -g GWE_cycle:6 25 | -g LCK_cycle:NoWait 26 | -g Match_cycle:Auto 27 | -g Security:None 28 | -g DonePipe:No 29 | -g DriveDone:No 30 | -------------------------------------------------------------------------------- /board/DigilentS3/top.xst: -------------------------------------------------------------------------------- 1 | set -tmpdir "xst/projnav.tmp" 2 | set -xsthdpdir "xst" 3 | run 4 | -p xc3s200-FT256-4 5 | -ifn ../src/top.prj 6 | -top top 7 | -ifmt mixed 8 | -ofn top 9 | -ofmt NGC 10 | -opt_mode Speed 11 | -opt_level 1 12 | -iuc NO 13 | -keep_hierarchy No 14 | -netlist_hierarchy As_Optimized 15 | -rtlview Yes 16 | -glob_opt AllClockNets 17 | -read_cores YES 18 | -write_timing_constraints NO 19 | -cross_clock_analysis NO 20 | -hierarchy_separator / 21 | -bus_delimiter <> 22 | -case Maintain 23 | -slice_utilization_ratio 100 24 | -bram_utilization_ratio 100 25 | -verilog2001 YES 26 | -fsm_extract YES -fsm_encoding Auto 27 | -safe_implementation No 28 | -fsm_style LUT 29 | -ram_extract Yes 30 | -ram_style Auto 31 | -rom_extract Yes 32 | -mux_style Auto 33 | -decoder_extract YES 34 | -priority_extract Yes 35 | -shreg_extract YES 36 | -shift_extract YES 37 | -xor_collapse YES 38 | -rom_style Auto 39 | -auto_bram_packing NO 40 | -mux_extract Yes 41 | -resource_sharing YES 42 | -async_to_sync NO 43 | -mult_style Auto 44 | -iobuf YES 45 | -max_fanout 500 46 | -bufg 24 47 | -register_duplication YES 48 | -register_balancing No 49 | -slice_packing YES 50 | -optimize_primitives NO 51 | -use_clock_enable Yes 52 | -use_sync_set Yes 53 | -use_sync_reset Yes 54 | -iob Auto 55 | -equivalent_register_removal YES 56 | -slice_utilization_ratio_maxmargin 5 57 | -------------------------------------------------------------------------------- /board/xula2/impact.cmd: -------------------------------------------------------------------------------- 1 | setMode -bscan 2 | setCable -p auto 3 | identify -inferir 4 | assignFile -p 1 -file top.bit 5 | program -p 1 -onlyFpga 6 | exit 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /board/xula2/top.ucf: -------------------------------------------------------------------------------- 1 | # 2 | # xula2 3 | # 4 | NET "clk" LOC=A9 ; # 12 MHz clock input. 5 | NET "led" LOC=T7 | IOSTANDARD=LVTTL | DRIVE=24 | SLEW=SLOW ; # Blinker output to LED. 6 | 7 | NET "CLK" PERIOD = 12 MHz; 8 | -------------------------------------------------------------------------------- /board/xula2/top.ut: -------------------------------------------------------------------------------- 1 | -w 2 | -g DebugBitstream:No 3 | -g Binary:no 4 | -g CRC:Enable 5 | -g Reset_on_err:No 6 | -g ConfigRate:2 7 | -g ProgPin:PullUp 8 | -g TckPin:PullDown 9 | -g TdiPin:PullUp 10 | -g TdoPin:PullUp 11 | -g TmsPin:PullUp 12 | -g UnusedPin:PullDown 13 | -g UserID:0xFFFFFFFF 14 | -g ExtMasterCclk_en:No 15 | -g SPI_buswidth:1 16 | -g TIMER_CFG:0xFFFF 17 | -g multipin_wakeup:No 18 | -g StartUpClk:JtagClk 19 | -g DONE_cycle:4 20 | -g GTS_cycle:5 21 | -g GWE_cycle:6 22 | -g LCK_cycle:NoWait 23 | -g Security:None 24 | -g DonePipe:Yes 25 | -g DriveDone:No 26 | -g en_sw_gsr:No 27 | -g drive_awake:No 28 | -g sw_clk:Startupclk 29 | -g sw_gwe_cycle:5 30 | -g sw_gts_cycle:4 31 | 32 | -------------------------------------------------------------------------------- /board/xula2/top.xst: -------------------------------------------------------------------------------- 1 | set -tmpdir "xst/projnav.tmp" 2 | set -xsthdpdir "xst" 3 | run 4 | -p xc3s200-FT256-4 5 | -ifn ../src/top.prj 6 | -top top 7 | -ifmt mixed 8 | -ofn top 9 | -ofmt NGC 10 | -opt_mode Speed 11 | -opt_level 1 12 | -iuc NO 13 | -keep_hierarchy No 14 | -netlist_hierarchy As_Optimized 15 | -rtlview Yes 16 | -glob_opt AllClockNets 17 | -read_cores YES 18 | -write_timing_constraints NO 19 | -cross_clock_analysis NO 20 | -hierarchy_separator / 21 | -bus_delimiter <> 22 | -case Maintain 23 | -slice_utilization_ratio 100 24 | -bram_utilization_ratio 100 25 | -verilog2001 YES 26 | -fsm_extract YES -fsm_encoding Auto 27 | -safe_implementation No 28 | -fsm_style LUT 29 | -ram_extract Yes 30 | -ram_style Auto 31 | -rom_extract Yes 32 | -mux_style Auto 33 | -decoder_extract YES 34 | -priority_extract Yes 35 | -shreg_extract YES 36 | -shift_extract YES 37 | -xor_collapse YES 38 | -rom_style Auto 39 | -auto_bram_packing NO 40 | -mux_extract Yes 41 | -resource_sharing YES 42 | -async_to_sync NO 43 | -mult_style Auto 44 | -iobuf YES 45 | -max_fanout 500 46 | -bufg 24 47 | -register_duplication YES 48 | -register_balancing No 49 | -slice_packing YES 50 | -optimize_primitives NO 51 | -use_clock_enable Yes 52 | -use_sync_set Yes 53 | -use_sync_reset Yes 54 | -iob Auto 55 | -equivalent_register_removal YES 56 | -slice_utilization_ratio_maxmargin 5 57 | -------------------------------------------------------------------------------- /ise/Makefile: -------------------------------------------------------------------------------- 1 | #DEVICE = xc6slx9-2-ftg256 #XuLA2 lx9 2 | #BOARD = xula2 3 | DEVICE = xc3s200-FT256-4 4 | BOARD = DigilentS3 5 | 6 | IMPACT_CMD_FILE := ../board/$(BOARD)/impact.cmd 7 | UCF_FILE := ../board/$(BOARD)/top.ucf 8 | UT_FILE := ../board/$(BOARD)/top.ut 9 | PRJ_FILE := ../src/top.prj 10 | XST_FILE := ../board/$(BOARD)/top.xst 11 | TOP_FILE := ../src/top.v 12 | 13 | SOURCES := $(strip $(shell \ 14 | cat $(PRJ_FILE) | grep -oE '[^[:blank:]]+[[:blank:]]*$$' | tr -d '"' )) 15 | 16 | TOP := $(strip $(shell \ 17 | cat $(XST_FILE) | grep "[-]top" | sed s/-top//g )) 18 | 19 | ifneq "$(basename $(notdir $(TOP_FILE)))" "$(TOP)" 20 | $(error Design top must have the same name as top-level source file) 21 | endif 22 | 23 | default: burn 24 | 25 | synth: $(TOP).ngc $(TOP).srp 26 | ngdbuild: $(TOP).ngd $(TOP).bld 27 | map: $(TOP)_map.ncd $(TOP).pcf 28 | par: $(TOP).ncd $(TOP).unroutes $(TOP).par $(TOP).twr 29 | bitgen: $(TOP).bit 30 | 31 | .SECONDARY: $(TOP).ngc $(TOP).srp $(TOP).ngd $(TOP).bld $(TOP)_map.ncd 32 | .SECONDARY: $(TOP).pcf $(TOP).ncd $(TOP).unroutes $(TOP).par $(TOP).twr 33 | 34 | #----------------------------------------------------------------------------- 35 | 36 | %.ngc %.srp: $(subst $(TOP),%,$(TOP_FILE)) $(SOURCES) $(PRJ_FILE) $(XST_FILE) 37 | @rm -f $*.ngc $*.srp 38 | mkdir -p xst/projnav.tmp 39 | xst -intstyle silent -ifn $(filter %.xst,$^) 40 | 41 | #----------------------------------------------------------------------------- 42 | 43 | %.ngd %.bld: %.ngc $(UCF_FILE) 44 | @rm -f $*.ngd $*.bld 45 | ngdbuild -intstyle silent -dd _ngo -nt off -uc \ 46 | $(filter %.ucf,$^) -p $(DEVICE) $< $(TOP) 47 | 48 | #----------------------------------------------------------------------------- 49 | 50 | %_map.ncd %.pcf: %.ngd 51 | @rm -f $*_map.ncd $*.pcf 52 | map -w -p $(DEVICE) -ir off -pr b -detail \ 53 | -ol std -logic_opt off -c 100 -o $*_map.ncd $*.ngd $*.pcf 54 | 55 | #----------------------------------------------------------------------------- 56 | 57 | %.ncd %.unroutes %.par %.twr: %_map.ncd $(TOP).pcf 58 | @rm -f $*.ncd $*.unroutes $*.par $*.twr 59 | par -w -ol high $< $@ $(filter %.pcf,$^) 60 | trce -e $*.ncd $*.pcf 61 | 62 | #----------------------------------------------------------------------------- 63 | 64 | %.bit: %.ncd $(TOP).unroutes $(TOP).twr $(UT_FILE) 65 | @rm -f $@ 66 | @echo "---------------------------------------------------------" 67 | @echo "Checking design for timing errors and unroutes..." 68 | @grep -i "all signals are completely routed" $(filter %.unroutes,$^) 69 | @grep -iq "timing errors:" $(filter %.twr,$^); \ 70 | if [ $$? -eq 0 ]; then \ 71 | grep -i "timing errors: 0" $(filter %.twr,$^); \ 72 | exit $$?; \ 73 | fi 74 | @echo "Design looks good. Generating bitfile." 75 | @echo "---------------------------------------------------------" 76 | bitgen -f $(UT_FILE) $*.ncd $@ 77 | 78 | #----------------------------------------------------------------------------- 79 | 80 | burn: $(TOP).bit $(IMPACT_CMD_FILE) 81 | impact -batch $(IMPACT_CMD_FILE) 82 | 83 | #----------------------------------------------------------------------------- 84 | 85 | CLEAN_EXTS := .bgn .bit _bitgen.xwbt .bld .drc .lso _map.map _map.mrp _map.ncd 86 | CLEAN_EXTS += _map.ngm _map.xrpt .ncd .ngc .ngd _ngdbuild.xrpt .ngr .pad 87 | CLEAN_EXTS += _pad.csv _pad.txt .par _par.xrpt .pcf .ptwx .srp _summary.xml 88 | CLEAN_EXTS += .twr .twr_pad.txt .twx .unroutes _usage.xml .xpi _xst.xrpt 89 | 90 | clean: 91 | rm -f $(foreach x,$(CLEAN_EXTS),$(TOP)$(x)) 92 | rm -f par_usage_statistics.html webtalk.log 93 | rm -f usage_statistics_webtalk.html 94 | rm -f '#Makefile#' '.#Makefile' 95 | rm -f _impactbatch.log 96 | rm -rf _ngo xlnx_auto_0_xdb _xmsgs xst 97 | -------------------------------------------------------------------------------- /src/top.prj: -------------------------------------------------------------------------------- 1 | verilog work "../src/top.v" 2 | -------------------------------------------------------------------------------- /src/top.v: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | LED blinker 3 | 4 | ******************************************************************************/ 5 | 6 | module top( 7 | input clk 8 | , output led 9 | ); 10 | 11 | assign clken = 1; 12 | 13 | reg[24:0] PC; 14 | always @(posedge clk) 15 | PC <= PC+1; 16 | 17 | assign led= PC[24]; 18 | 19 | endmodule 20 | --------------------------------------------------------------------------------