mirror of
https://github.com/lowRISC/ibex.git
synced 2025-06-27 17:00:41 -04:00
Instead of using copies of primitives from OpenTitan, vendor the files in directly from OpenTitan, and use them. Benefits: - Less potential for diverging code between OpenTitan and Ibex, causing problems when importing Ibex into OT. - Use of the abstract primitives instead of the generic ones. The abstract primitives are replaced during synthesis time with target-dependent implementations. For simulation, nothing changes. For synthesis for a given target technology (e.g. a specific ASIC or FPGA technology), the primitives system can be instructed to choose optimized versions (if available). This is most relevant for the icache, which hard-coded the generic SRAM primitive before. This primitive is always implemented as registers. By using the abstract primitive (prim_ram_1p) instead, the RAMs can be replaced with memory-compiler-generated ones if necessary. There are no real draw-backs, but a couple points to be aware of: - Our ram_1p and ram_2p implementations are kept as wrapper around the primitives, since their interface deviates slightly from the one in prim_ram*. This also includes a rather unfortunate naming confusion around rvalid, which means "read data valid" in the OpenTitan advanced RAM primitives (prim_ram_1p_adv for example), but means "ack" in PULP-derived IP and in our bus implementation. - The core_ibex UVM DV doesn't use FuseSoC to generate its file list, but uses a hard-coded list in `ibex_files.f` instead. Since the dynamic primitives system requires the use of FuseSoC we need to provide a stop-gap until this file is removed. Issue #893 tracks progress on that. - Dynamic primitives depend no a not-yet-merged feature of FuseSoC (https://github.com/olofk/fusesoc/pull/391). We depend on the same functionality in OpenTitan and have instructed users to use a patched branch of FuseSoC for a long time through `python-requirements.txt`, so no action is needed for users which are either successfully interacting with the OpenTitan source code, or have followed our instructions. All other users will see a reasonably descriptive error message during a FuseSoC run. - This commit is massive, but there are no good ways to split it into bisectable, yet small, chunks. I'm sorry. Reviewers can safely ignore all code in `vendor/lowrisc_ip`, it's an import from OpenTitan. - The check_tool_requirements tooling isn't easily vendor-able from OpenTitan at the moment. I've filed https://github.com/lowRISC/opentitan/issues/2309 to get that sorted. - The LFSR primitive doesn't have a own core file, forcing us to include the catch-all `lowrisc:prim:all` core. I've filed https://github.com/lowRISC/opentitan/issues/2310 to get that sorted.
133 lines
4.1 KiB
Makefile
133 lines
4.1 KiB
Makefile
# Copyright lowRISC contributors.
|
|
# Licensed under the Apache License, Version 2.0, see LICENSE for details.
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
# Makefile with ascentlint, verilator-lint and verible style lint
|
|
# targets for OpenTitan
|
|
#
|
|
# TODO: currently we cannot support parallel builds since some fusesoc cores
|
|
# define filesets with files outside the current folder (e.g. using relative
|
|
# path prefixes such as "../../"). this can cause collisions between parallel
|
|
# builds since they are not nicely contained within the same folder. This should
|
|
# be solved by reworking the fusesoc core files (especially the top-level one).
|
|
|
|
CORE_ROOT ?= ../../
|
|
REPORT_DIR ?= reports
|
|
|
|
IPS ?= ip-aes \
|
|
ip-alert_handler \
|
|
ip-clkmgr \
|
|
ip-flash_ctrl \
|
|
ip-gpio \
|
|
ip-hmac \
|
|
ip-i2c \
|
|
ip-otp_ctrl \
|
|
ip-nmi_gen \
|
|
ip-padctrl \
|
|
ip-pinmux \
|
|
ip-pwrmgr \
|
|
ip-rv_core_ibex \
|
|
ip-rv_dm \
|
|
ip-rv_plic_example \
|
|
ip-rv_timer \
|
|
ip-spi_device \
|
|
ip-uart \
|
|
ip-usbdev \
|
|
ip-usb_fs_nb_pe \
|
|
ip-usbuart \
|
|
ip-rstmgr \
|
|
tlul-socket_1n \
|
|
tlul-socket_m1 \
|
|
tlul-adapter_reg \
|
|
tlul-adapter_sram \
|
|
tlul-sram2tlul \
|
|
systems-top_earlgrey
|
|
|
|
ips_lint = $(addsuffix _lint, $(IPS))
|
|
ips_vlint = $(addsuffix _vlint, $(IPS))
|
|
ips_slint = $(addsuffix _slint, $(IPS))
|
|
|
|
######################
|
|
# ascentlint targets #
|
|
######################
|
|
|
|
# lint all discovered targets and make a report
|
|
all: lint
|
|
$(MAKE) report
|
|
|
|
lint: clean
|
|
@echo Discovered lint targets:
|
|
@echo -e "\n $(patsubst %,%\\n,$(strip $(ips_lint)))"
|
|
$(MAKE) $(ips_lint)
|
|
|
|
$(ips_lint):
|
|
rm -rf build
|
|
mkdir -p ${REPORT_DIR}
|
|
-fusesoc --cores-root ${CORE_ROOT} run --target=lint --tool=ascentlint lowrisc:$(subst -,:,$(patsubst %_lint,%,$@))
|
|
cp build/lowrisc_*$(subst -,_,$(patsubst %_lint,%,$@))*/lint-ascentlint/ascentlint.log ${REPORT_DIR}/$(patsubst %_lint,%,$@).log
|
|
cp build/lowrisc_*$(subst -,_,$(patsubst %_lint,%,$@))*/lint-ascentlint/ascentlint.rpt ${REPORT_DIR}/$(patsubst %_lint,%,$@).rpt
|
|
|
|
# creates a (filtered) summary report from all available ascentlint logs/rpts
|
|
# note that lint reports have to be filtered using this script before publishing
|
|
# any information from these reports publicly
|
|
# note, the filtering script is simplistic ATM and just looks for *.rpt files
|
|
# hence we have to temporarily write the output to a file with a different extension
|
|
# since otherwise the gen_report script will try to process the summary report as well.
|
|
report:
|
|
$(eval TMPFILE=$(shell mktemp))
|
|
rm -f ${REPORT_DIR}/lint_summary.rpt
|
|
./util/gen-report.sh | tee $(TMPFILE)
|
|
cp $(TMPFILE) ${REPORT_DIR}/lint_summary.rpt
|
|
rm -f $(TMPFILE)
|
|
|
|
#####################
|
|
# verilator targets #
|
|
#####################
|
|
|
|
vall: vlint
|
|
$(MAKE) vreport
|
|
|
|
vlint: clean
|
|
@echo Discovered vlint targets:
|
|
@echo -e "\n $(patsubst %,%\\n,$(strip $(ips_vlint)))"
|
|
$(MAKE) $(ips_vlint)
|
|
|
|
$(ips_vlint):
|
|
rm -rf build
|
|
mkdir -p ${REPORT_DIR}
|
|
-fusesoc --cores-root ${CORE_ROOT} run --target=lint lowrisc:$(subst -,:,$(patsubst %_vlint,%,$@))
|
|
|
|
# TODO: add summary reporting
|
|
vreport:
|
|
|
|
##############################
|
|
# verible style lint targets #
|
|
##############################
|
|
|
|
sall: slint
|
|
$(MAKE) sreport
|
|
|
|
slint: clean
|
|
@echo Discovered vlint targets:
|
|
@echo -e "\n $(patsubst %,%\\n,$(strip $(ips_vlint)))"
|
|
$(MAKE) $(ips_vlint)
|
|
|
|
# TODO(#1727): pass Verible config file to FuseSoC, once supported by Verible
|
|
$(ips_slint):
|
|
rm -rf build
|
|
mkdir -p ${REPORT_DIR}
|
|
-fusesoc --cores-root ${CORE_ROOT} run --target=lint --tool=veriblelint lowrisc:$(subst -,:,$(patsubst %_slint,%,$@))
|
|
|
|
# TODO: add summary reporting
|
|
sreport:
|
|
|
|
##################
|
|
# common targets #
|
|
##################
|
|
|
|
clean:
|
|
rm -rf build
|
|
rm -rf ${REPORT_DIR}/*
|
|
|
|
.PHONY: all lint $(ips_lint) report vall vlint $(ips_vlint) \
|
|
vreport sall slint $(ips_slint) clean sreport
|