include relpath.mk XILNXD_LICENSE_FILE:=${PWD}/xilinx_ise_vivado_license.lic export XILINXD_LICENSE_FILE PART=xc6slx9-2-tqg144 TOP=hp_lcd_driver BUILD=build_spartan6 VSRCS=synchronizer.vhdl debounce.vhdl edge_det.vhdl input_formatter.vhdl input_stage.vhdl output_formatter.vhdl output_analog.vhdl serdes_n_to_1_spartan6.vhdl tmds_encoder.vhdl tmds_phy_spartan6.vhdl tmds_encode.vhdl tmds_output_spartan6.vhdl vram_spartan6.vhdl output_stage.vhdl clkgen_spartan6.vhdl hp_lcd_driver.vhdl UCF=hp_lcd_driver.ucf UT=hp_lcd_driver.ut IPSRCS=vram_spartan6_impl.xco DESIGN_NAME=${TOP} DS_HOME=/software/apps/xilinx/ISE/14.7/ISE_DS ISE_HOME=${DS_HOME}/ISE ISE_BINDIR_32=${ISE_HOME}/bin/lin ISE_BINDIR_64=${ISE_HOME}/bin/lin64 INTSTYLE= XST_FLAGS=${INTSTYLE} NGDBUILD_FLAGS=${INTSTYLE} -p ${PART} -dd _ngo -nt timestamp MAP_FLAGS=${INTSTYLE} -p ${PART} -w -logic_opt off -ol high -t 1 -xt 0 -register_duplication off -r 4 -global_opt off -mt off -ir off -pr off -lc off -power off PAR_FLAGS=${INTSTYLE} -w -ol high -mt off TRCE_FLAGS=${INTSTYLE} -v 3 -s 2 -n 3 -fastpaths BITGEN_FLAGS=${INTSTYLE} GEN_VSRCS=${IPSRCS:%.xco=${BUILD}/%.vhd} BASE=${BUILD}/${DESIGN_NAME} XST=${BASE}.xst PRJ=${BASE}.prj SYR=${BASE}.syr NGC=${BASE}.ngc NGD=${BASE}.ngd MAP_NCD=${BASE}_map.ncd NCD=${BASE}.ncd PCF=${BASE}.pcf TWR=${BASE}.twr TWX=${BASE}.twx BIT=${BASE}.bit SVF=${BASE}.svf PA=${BUILD}/pa PAT=${PA}/script.tcl XST_TMPDIR=xst/projnav.tmp XST_DIR=xst default: ${NCD} ${TWR} ${TWX} ${BIT} ${SVF} clean: /bin/rm -rf ${BUILD} *.orig *~ ${PRJ}: ${VSRCS} ${GEN_VSRCS} mkdir -p ${BUILD} rm -f $@ for file in $(GEN_VSRCS) ${VSRCS}; do \ echo "vhdl work $$(realpath -m --relative-to=${BUILD} $${file})" >> $@ ; \ done ; ${NGC}:${XST} (cd ${BUILD} && mkdir -p ${XST_DIR} ${XST_TMPDIR} && ${ISE_BINDIR_64}/xst ${XST_FLAGS} -ifn $(call relpath,$<,${BUILD}) -ofn $(call relpath,${SYR},${BUILD})) ${XST}: ${PRJ} ${DESIGN_NAME}.xst_template rm -f $@ echo 'set -tmpdir "${XST_TMPDIR}"' >> $@ echo 'set -xsthdpdir "${XST_DIR}"' >> $@ cat ${DESIGN_NAME}.xst_template >> $@ echo "-ifn $(call relpath,${PRJ},${BUILD})" >> $@ echo "-ofn $(call relpath,${BASE},${BUILD})" >> $@ echo "-p ${PART}" >> $@ echo "-top ${TOP}" >> $@ ${NGD}:${NGC} ${UCF} (cd ${BUILD} && ${ISE_BINDIR_64}/ngdbuild $(NGDBUILD_FLAGS) -uc $(call relpath,${UCF},${BUILD}) $(call relpath,${NGC},${BUILD}) $(call relpath,$@,${BUILD})) ${MAP_NCD} ${PCF}:${NGD} (cd ${BUILD} && ${ISE_BINDIR_64}/map $(MAP_FLAGS) -o $(call relpath,${MAP_NCD},${BUILD}) $(call relpath,${NGD},${BUILD}) $(call relpath,${PCF},${BUILD})) ${NCD}: ${MAP_NCD} ${PCF} (cd ${BUILD} && ${ISE_BINDIR_64}/par $(PAR_FLAGS) $(call relpath,${MAP_NCD},${BUILD}) $(call relpath,${NCD},${BUILD}) $(call relpath,${PCF},${BUILD})) ${TWR} ${TWX}: ${NCD} ${PCF} (cd ${BUILD} && ${ISE_BINDIR_64}/trce ${TRCE_FLAGS} -xml $(call relpath,${TWX},${BUILD}) $(call relpath,${NCD},${BUILD}) -o $(call relpath,${TWR},${BUILD}) $(call relpath,${PCF},${BUILD})) ${BIT}:${NCD} ${UT} (cd ${BUILD} && ${ISE_BINDIR_64}/bitgen ${BITGEN_FLAGS} -f $(call relpath,${UT},${BUILD}) $(call relpath,${NCD},${BUILD})) ${SVF}:${BIT} ( cd ${BUILD} && \ echo "setMode -bs" > impact.run && \ echo "setCable -p svf -file \"$(call relpath,${SVF},${BUILD})\"" >> impact.run && \ echo "addDevice -p 1 -file \"$(call relpath,${BIT},${BUILD})\"" >> impact.run && \ echo "program -p 1" >> impact.run && \ echo "quit" >> impact.run && \ ${ISE_BINDIR_64}/impact -batch impact.run) ${BUILD}/%.vhd:%.xco mkdir -p ${BUILD} (cd ${BUILD} && touch empty.prj && ${ISE_BINDIR_32}/coregen -b $(call relpath,$<,${BUILD}) -p empty.prj) planahead: ${NGC} ${TWX} rm -rf ${PA} mkdir -p ${PA} echo 'create_project -name ${TOP} -dir "$(abspath ${PA})" -part ${PART}' >> ${PAT} echo 'set srcset [get_property srcset [current_run -impl]]' >> ${PAT} echo 'set_property design_mode GateLvl $$srcset' >> ${PAT} echo 'set_property top ${TOP} [current_fileset]' >> ${PAT} echo 'set_property edif_top_file "$(abspasth ${NGC})" [ get_property srcset [ current_run ] ]' >> ${PAT} echo 'add_files -norecurse { {$(abspath ${BUILD})} }' >> ${PAT} echo 'set_property target_constrs_file "$(abspath ${UCF})" [current_fileset -constrset]' >> ${PAT} echo 'add_files [list {$(abspath ${UCF})}] -fileset [get_property constrset [current_run]]' >> ${PAT} echo 'link_design' >> ${PAT} echo 'read_xdl -file "$(abspath ${NCD})"' >> ${PAT} echo 'if {[catch {read_twx -name results_1 -file "$(abspath ${TWX})"} eInfo]} {' >> ${PAT} echo 'puts "WARNING: there was a problem importing \"$(abspath ${TWX})\": $$eInfo"' >> ${PAT} echo '}' >> ${PAT} (cd ${PA} && ${DS_HOME}/PlanAhead/bin/planAhead -log $(abspath ${PA}/pa.log) -journal $(abspath ${PA}/pa.jou) -source $(abspath ${PAT})) tidy: git diff --exit-code -s ${VSRCS} for i in ${VSRCS}; do /bin/cp -f $$i $$i.orig && scripts/vhdl-pretty < $$i.orig > $$i; done