infra: update makefile for cocotb
This commit is contained in:
@ -1,52 +1,40 @@
|
|||||||
# SPDX-License-Identifier: MIT
|
TOPLEVEL_LANG = verilog
|
||||||
#
|
SIM ?= verilator
|
||||||
# Copyright (c) 2025 FPGA Ninja, LLC
|
|
||||||
#
|
|
||||||
# Authors:
|
|
||||||
# - Alex Forencich
|
|
||||||
#
|
|
||||||
|
|
||||||
# FPGA settings
|
PWD := $(shell pwd)
|
||||||
FPGA_PART = xc7a35tfgg484-1
|
|
||||||
FPGA_TOP = control
|
|
||||||
FPGA_ARCH = artix7
|
|
||||||
|
|
||||||
RTL_DIR = ../src
|
RTL_DIR = $(PWD)/../src
|
||||||
|
LIBS_DIR = $(PWD)/../../../external/rtl_libs
|
||||||
|
|
||||||
|
VERILOG_SOURCES += $(LIBS_DIR)/axi/rtl/axi_pkg.sv
|
||||||
|
VERILOG_SOURCES += $(LIBS_DIR)/axi/rtl/axi_if.sv
|
||||||
|
VERILOG_SOURCES += $(LIBS_DIR)/axi/rtl/axi4l_flat_to_if.sv
|
||||||
|
VERILOG_SOURCES += $(LIBS_DIR)/axi/rtl/axi4l_if_to_flat.sv
|
||||||
|
VERILOG_SOURCES += $(LIBS_DIR)/axi/axi_reg/axi4l_reg_map.sv
|
||||||
|
VERILOG_SOURCES += $(RTL_DIR)/controller.sv
|
||||||
|
VERILOG_SOURCES += $(RTL_DIR)/dma_controller.sv
|
||||||
|
VERILOG_SOURCES += $(RTL_DIR)/shaper_axis_desc.sv
|
||||||
|
VERILOG_SOURCES += $(RTL_DIR)/shaper_axis_status.sv
|
||||||
|
VERILOG_SOURCES += $(RTL_DIR)/controller_wrapper_axil.sv
|
||||||
|
VERILOG_SOURCES += $(RTL_DIR)/axi4l_reg_map_controller_pkg.sv
|
||||||
|
VERILOG_SOURCES += $(RTL_DIR)/axi4l_reg_map_controller.sv
|
||||||
|
VERILOG_SOURCES += $(PWD)/tb_controller_wrapper_axil.sv
|
||||||
|
|
||||||
|
TOPLEVEL = tb_controller_wrapper_axil
|
||||||
|
MODULE = test_controller
|
||||||
|
|
||||||
|
|
||||||
include ../../../scripts/vivado.mk
|
ifeq ($(SIM),verilator)
|
||||||
|
EXTRA_ARGS += --trace --trace-structs
|
||||||
SYN_FILES += $(sort $(shell find ../src -type f \( -name '*.v' -o -name '*.sv' \)))
|
EXTRA_ARGS += -I$(LIBS_DIR)/axi/rtl/
|
||||||
|
COMPILE_ARGS += -Wno-fatal
|
||||||
XCI_FILES = $(sort $(shell find ../src -type f -name '*.xci'))
|
COMPILE_ARGS += -I$(LIBS_DIR)/axi/rtl/
|
||||||
|
EXTRA_ARGS += --trace
|
||||||
XDC_FILES += ../../../constraints/ax7a035b.xdc
|
EXTRA_ARGS += --trace-structs
|
||||||
XDC_FILES += test_timing.xdc
|
EXTRA_ARGS += --public-flat-rw
|
||||||
|
EXTRA_ARGS += -Wno-fatal
|
||||||
SYN_FILES += controller_tb.sv
|
EXTRA_ARGS += --timing
|
||||||
SIM_TOP = control_tb
|
endif
|
||||||
|
|
||||||
|
|
||||||
program: $(PROJECT).bit
|
include $(shell cocotb-config --makefiles)/Makefile.sim
|
||||||
echo "open_hw_manager" > program.tcl
|
|
||||||
echo "connect_hw_server" >> program.tcl
|
|
||||||
echo "open_hw_target" >> program.tcl
|
|
||||||
echo "current_hw_device [lindex [get_hw_devices] 0]" >> program.tcl
|
|
||||||
echo "refresh_hw_device -update_hw_probes false [current_hw_device]" >> program.tcl
|
|
||||||
echo "set_property PROGRAM.FILE {$(PROJECT).bit} [current_hw_device]" >> program.tcl
|
|
||||||
echo "program_hw_devices [current_hw_device]" >> program.tcl
|
|
||||||
echo "exit" >> program.tcl
|
|
||||||
vivado -nojournal -nolog -mode batch -source program.tcl
|
|
||||||
|
|
||||||
$(PROJECT).mcs $(PROJECT).prm: $(PROJECT).bit
|
|
||||||
echo "write_cfgmem -force -format mcs -size 16 -interface SPIx4 -loadbit {up 0x0000000 $*.bit} -checksum -file $*.mcs" > generate_mcs.tcl
|
|
||||||
echo "exit" >> generate_mcs.tcl
|
|
||||||
vivado -nojournal -nolog -mode batch -source generate_mcs.tcl
|
|
||||||
mkdir -p rev
|
|
||||||
COUNT=100; \
|
|
||||||
while [ -e rev/$*_rev$$COUNT.bit ]; \
|
|
||||||
do COUNT=$$((COUNT+1)); done; \
|
|
||||||
COUNT=$$((COUNT-1)); \
|
|
||||||
for x in .mcs .prm; \
|
|
||||||
do cp $*$$x rev/$*_rev$$COUNT$$x; \
|
|
||||||
echo "Output: rev/$*_rev$$COUNT$$x"; done;
|
|
||||||
|
|||||||
Reference in New Issue
Block a user