Vproc_n1/test/makefile.ica
David Rodriguez c2f821f6da Merge remote-tracking branch 'Documents/master'
I am includding a document folder to send the repo to Forgejo
2026-04-06 19:31:14 +01:00

127 lines
3.8 KiB
Text

###################################################################
# Makefile for Virtual Processor testcode in Icarus Verilog
#
# Copyright (c) 2005-2024 Simon Southwell.
#
# This file is part of VProc.
#
# VProc is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# VProc is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with VProc. If not, see <http://www.gnu.org/licenses/>.
#
###################################################################
#
# Assumes Ubuntu Linux (22.04 LTS 64-bit) installation and mingw64
# on Windows. ARCHFLAG and ICADIR need updating for other
# configurations.
#
# Requirements: iverilog
# on RHEL 7 "yum install iverilog" to install Icarus
# To run: vvp -m ./VProc.so sim
#------------------------------------------------------
# User overridable definitions
MAX_NUM_VPROC = 64
USRFLAGS =
SRCDIR = ../code
USRCDIR = usercode
TESTDIR = .
VOBJDIR = ${TESTDIR}/obj
# User test source code file list
USER_C = VUserMain0.c VUserMain1.cpp
#------------------------------------------------------
# Settings specific to target simulator
# Simulator/Language specific C/C++ compile and link flags
ARCHFLAG = -m64
OPTFLAG = -g
HDLLANGUAGE =
SIMULATOR = -DICARUS
SIMFLAGSSO = -lvpi
# Get OS type
OSTYPE:=$(shell uname)
# Set OS specific variables between Linux and Windows (MinGW)
ifeq (${OSTYPE}, Linux)
SIMINCLUDEFLAG = -I/usr/include/iverilog
else
SIMINCLUDEFLAG = -I/mingw64/include/iverilog
endif
# Optional Memory model definitions
MEM_C =
MEMMODELDIR = .
# Common logic simulator flags
VLOGFLAGS = -DVPROC_BURST_IF -DVPROC_BYTE_ENABLE -I../ -Ptest.VCD_DUMP=1
VLOGDEBUGFLAGS = -Ptest.DEBUG_STOP=1
VLOGFILES = test.v ../f_VProc.v
#------------------------------------------------------
# BUILD RULES
#------------------------------------------------------
all: verilog
# Include common build rules
include makefile.common
verilog: $(VPROC_PLI) $(VLOGFILES)
@iverilog $(VLOGFLAGS) $(PLIFLAG) -o sim $(VLOGFILES)
verilog_debug: $(VPROC_PLI) $(VLOGFILES)
@iverilog $(VLOGDEBUGFLAGS) $(VLOGFLAGS) $(PLIFLAG) -o sim $(VLOGFILES)
#------------------------------------------------------
# EXECUTION RULES
#------------------------------------------------------
sim: all
@vvp -s -m $(VPROC_PLI) sim
debug: clean $(VPROC_PLI) verilog_debug
@vvp -m $(VPROC_PLI) sim
run: all
@vvp -n -m $(VPROC_PLI) sim
rungui: all
@vvp -n -m $(VPROC_PLI) sim
@if [ -e waves.gtkw ]; then \
gtkwave -A waves.vcd; \
else \
gtkwave waves.vcd; \
fi
gui : rungui
help:
@$(info make help Display this message)
@$(info make Build C/C++ and HDL code without running simulation)
@$(info make sim Build and run command line interactive (sim not started))
@$(info make debug Build and run and stop at time 0 for debug attachment)
@$(info make run Build and run batch simulation)
@$(info make rungui/gui Build and run GUI simulation)
@$(info make clean clean previous build artefacts)
#------------------------------------------------------
# CLEAN RULES
#------------------------------------------------------
clean:
@rm -rf $(VPROC_PLI) $(VLIB) obj sim *.vcd