|
| 1 | +MAX_BITBYTES=16384 |
| 2 | +FAB_PROJ_ROOT=.. |
| 3 | +BUILD_DIR=build |
| 4 | +DESIGN=sequential_16bit_en |
| 5 | +TESTBENCH=${DESIGN}_tb |
| 6 | +TOP_WRAPPER=top_wrapper |
| 7 | + |
| 8 | +USER_DESIGN_DIR=${FAB_PROJ_ROOT}/user_design |
| 9 | +USER_DESIGN_VHDL=${USER_DESIGN_DIR}/${DESIGN}.vhdl |
| 10 | +TOP_WRAPPER_VERILOG=${USER_DESIGN_DIR}/${TOP_WRAPPER}.v # Still needs to be verilog, since it is more like a constraint file for yosys |
| 11 | +FAB_TILE_FOLDER=${FAB_PROJ_ROOT}/Tile |
| 12 | +FAB_FABRIC_FOLDER=${FAB_PROJ_ROOT}/Fabric |
| 13 | + |
| 14 | +GHDL=ghdl |
| 15 | +GHDL_FLAGS=--std=08 -O2 --workdir=${BUILD_DIR} |
| 16 | + |
| 17 | +.PHONY: all run_FABulous_demo full build_test_design run_simulation mkdir_build clean |
| 18 | + |
| 19 | +sim: build_test_design run_simulation clean |
| 20 | + |
| 21 | +full_sim: run_FABulous_demo build_test_design run_simulation clean |
| 22 | + |
| 23 | +build_test_design: run_yosys run_nextpnr run_bitgen |
| 24 | + |
| 25 | +run_FABulous_demo: |
| 26 | + # Runs FABulous, generates the default fabric. |
| 27 | + FABulous ${FAB_PROJ_ROOT} -fs ${FAB_PROJ_ROOT}/FABulous.tcl |
| 28 | + |
| 29 | +run_yosys: mkdir_build |
| 30 | + yosys -m ghdl -p "ghdl ${USER_DESIGN_VHDL} -e ${DESIGN}; read_verilog ${TOP_WRAPPER_VERILOG}; synth_fabulous -top ${TOP_WRAPPER} -json ${BUILD_DIR}/${DESIGN}.json;" |
| 31 | + |
| 32 | +run_nextpnr: mkdir_build |
| 33 | + FAB_ROOT=${FAB_PROJ_ROOT} nextpnr-generic --uarch fabulous --json ${BUILD_DIR}/${DESIGN}.json -o fasm=${BUILD_DIR}/${DESIGN}.fasm |
| 34 | + |
| 35 | +run_bitgen: mkdir_build |
| 36 | + bit_gen -genBitstream ${BUILD_DIR}/${DESIGN}.fasm ${FAB_PROJ_ROOT}/.FABulous/bitStreamSpec.bin ${BUILD_DIR}/${DESIGN}.bin |
| 37 | + python3 makehex.py ${BUILD_DIR}/${DESIGN}.bin ${MAX_BITBYTES} ${BUILD_DIR}/${DESIGN}.hex |
| 38 | + |
| 39 | +mkdir_build: |
| 40 | + mkdir -p ${BUILD_DIR} |
| 41 | + |
| 42 | +run_GTKWave: |
| 43 | + gtkwave ${BUILD_DIR}/${DESIGN}.fst |
| 44 | + |
| 45 | +clean: |
| 46 | + rm -rf ${BUILD_DIR} |
| 47 | + |
| 48 | +run_simulation: mkdir_build |
| 49 | + ulimit -s unlimited && \ |
| 50 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/my_lib.vhdl && \ |
| 51 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/LUT4AB/LUT4AB_switch_matrix.vhdl \ |
| 52 | + ${FAB_TILE_FOLDER}/LUT4AB/LUT4AB_ConfigMem.vhdl \ |
| 53 | + ${FAB_TILE_FOLDER}/LUT4AB/LUT4c_frame_config.vhdl \ |
| 54 | + ${FAB_TILE_FOLDER}/LUT4AB/MUX8LUT_frame_config.vhdl \ |
| 55 | + ${FAB_TILE_FOLDER}/LUT4AB/LUT4AB.vhdl && \ |
| 56 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/RAM_IO/RAM_IO_switch_matrix.vhdl \ |
| 57 | + ${FAB_TILE_FOLDER}/RAM_IO/RAM_IO_ConfigMem.vhdl \ |
| 58 | + ${FAB_TILE_FOLDER}/RAM_IO/InPass4_frame_config.vhdl \ |
| 59 | + ${FAB_TILE_FOLDER}/RAM_IO/OutPass4_frame_config.vhdl \ |
| 60 | + ${FAB_TILE_FOLDER}/RAM_IO/RAM_IO.vhdl && \ |
| 61 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/RegFile/RegFile_switch_matrix.vhdl \ |
| 62 | + ${FAB_TILE_FOLDER}/RegFile/RegFile_ConfigMem.vhdl \ |
| 63 | + ${FAB_TILE_FOLDER}/RegFile/RegFile_32x4.vhdl \ |
| 64 | + ${FAB_TILE_FOLDER}/RegFile/RegFile.vhdl && \ |
| 65 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/W_IO/W_IO_switch_matrix.vhdl \ |
| 66 | + ${FAB_TILE_FOLDER}/W_IO/W_IO_ConfigMem.vhdl \ |
| 67 | + ${FAB_TILE_FOLDER}/W_IO/IO_1_bidirectional_frame_config_pass.vhdl \ |
| 68 | + ${FAB_TILE_FOLDER}/W_IO/Config_access.vhdl \ |
| 69 | + ${FAB_TILE_FOLDER}/W_IO/W_IO.vhdl && \ |
| 70 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/DSP/DSP_top/DSP_top_switch_matrix.vhdl \ |
| 71 | + ${FAB_TILE_FOLDER}/DSP/DSP_top/DSP_top_ConfigMem.vhdl \ |
| 72 | + ${FAB_TILE_FOLDER}/DSP/DSP_top/DSP_top.vhdl && \ |
| 73 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/DSP/DSP_bot/DSP_bot_switch_matrix.vhdl \ |
| 74 | + ${FAB_TILE_FOLDER}/DSP/DSP_bot/DSP_bot_ConfigMem.vhdl \ |
| 75 | + ${FAB_TILE_FOLDER}/DSP/DSP_bot/MULADD.vhdl \ |
| 76 | + ${FAB_TILE_FOLDER}/DSP/DSP_bot/DSP_bot.vhdl && \ |
| 77 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/DSP/DSP_top/DSP_top.vhdl \ |
| 78 | + ${FAB_TILE_FOLDER}/DSP/DSP_bot/DSP_bot.vhdl \ |
| 79 | + ${FAB_TILE_FOLDER}/DSP/DSP.vhdl && \ |
| 80 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/N_term_DSP/N_term_DSP_switch_matrix.vhdl \ |
| 81 | + ${FAB_TILE_FOLDER}/N_term_DSP/N_term_DSP.vhdl && \ |
| 82 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/S_term_DSP/S_term_DSP_switch_matrix.vhdl \ |
| 83 | + ${FAB_TILE_FOLDER}/S_term_DSP/S_term_DSP.vhdl && \ |
| 84 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/N_term_RAM_IO/N_term_RAM_IO_switch_matrix.vhdl \ |
| 85 | + ${FAB_TILE_FOLDER}/N_term_RAM_IO/N_term_RAM_IO.vhdl && \ |
| 86 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/S_term_RAM_IO/S_term_RAM_IO_switch_matrix.vhdl \ |
| 87 | + ${FAB_TILE_FOLDER}/S_term_RAM_IO/S_term_RAM_IO.vhdl && \ |
| 88 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/N_term_single/N_term_single_switch_matrix.vhdl \ |
| 89 | + ${FAB_TILE_FOLDER}/N_term_single/N_term_single.vhdl && \ |
| 90 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/S_term_single/S_term_single_switch_matrix.vhdl \ |
| 91 | + ${FAB_TILE_FOLDER}/S_term_single/S_term_single.vhdl && \ |
| 92 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/N_term_single2/N_term_single2_switch_matrix.vhdl \ |
| 93 | + ${FAB_TILE_FOLDER}/N_term_single2/N_term_single2.vhdl && \ |
| 94 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_TILE_FOLDER}/S_term_single2/S_term_single2_switch_matrix.vhdl \ |
| 95 | + ${FAB_TILE_FOLDER}/S_term_single2/S_term_single2.vhdl && \ |
| 96 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/config_UART.vhdl && \ |
| 97 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/bitbang.vhdl && \ |
| 98 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/ConfigFSM.vhdl && \ |
| 99 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/eFPGA_Config.vhdl && \ |
| 100 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/Frame_Data_Reg.vhdl && \ |
| 101 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/Frame_Select.vhdl && \ |
| 102 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/BlockRAM_1KB.vhdl && \ |
| 103 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/eFPGA.vhdl && \ |
| 104 | + ${GHDL} -a ${GHDL_FLAGS} ${FAB_FABRIC_FOLDER}/eFPGA_top.vhdl && \ |
| 105 | + ${GHDL} -a ${GHDL_FLAGS} ${USER_DESIGN_DIR}/${DESIGN}.vhdl && \ |
| 106 | + ${GHDL} -a ${GHDL_FLAGS} ${TESTBENCH}.vhdl && \ |
| 107 | + ${GHDL} -e ${GHDL_FLAGS} -fexplicit ${TESTBENCH} && \ |
| 108 | + ${GHDL} -r ${GHDL_FLAGS} ${TESTBENCH} --stats --ieee-asserts=disable --fst=${BUILD_DIR}/${TESTBENCH}.fst |
0 commit comments