blob: 1684a0d745efebf409efa7c03d1649137495236a [file] [log] [blame]
dineshannayya00438892022-03-12 22:36:37 +05301# SPDX-FileCopyrightText: 2020 Efabless Corporation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14#
15# SPDX-License-Identifier: Apache-2.0
16
dineshannayya00438892022-03-12 22:36:37 +053017
dineshannayyad8a093b2022-03-26 08:32:19 +053018# ---- Include Partitioned Makefiles ----
dineshannayya00438892022-03-12 22:36:37 +053019
dineshannayyad8a093b2022-03-26 08:32:19 +053020CONFIG = caravel_user_project
21
22#######################################################################
23## Caravel Verilog for Integration Tests
24#######################################################################
dineshannayya00438892022-03-12 22:36:37 +053025
dineshannayyad8a093b2022-03-26 08:32:19 +053026DESIGNS?=../../..
27
28export USER_PROJECT_VERILOG ?= $(DESIGNS)/verilog
dineshannayya00438892022-03-12 22:36:37 +053029## YIFIVE FIRMWARE
dineshannayyad8a093b2022-03-26 08:32:19 +053030YIFIVE_FIRMWARE_PATH = $(USER_PROJECT_VERILOG)/dv/firmware
dineshannayya00438892022-03-12 22:36:37 +053031GCC64_PREFIX?=riscv64-unknown-elf
32
dineshannayya00438892022-03-12 22:36:37 +053033
34## Simulation mode: RTL/GL
35SIM?=RTL
36DUMP?=OFF
37RISC_CORE?=0
38
dineshannayyad8a093b2022-03-26 08:32:19 +053039### To Enable IVERILOG FST DUMP
40export IVERILOG_DUMPER = fst
41
42
dineshannayya00438892022-03-12 22:36:37 +053043.SUFFIXES:
44
45PATTERN = user_usb
46
47all: ${PATTERN:=.vcd}
48
49
50vvp: ${PATTERN:=.vvp}
51
52%.vvp: %_tb.v
53ifeq ($(SIM),RTL)
54 ifeq ($(DUMP),OFF)
dineshannayyad8a093b2022-03-26 08:32:19 +053055 iverilog -g2012 -DFUNCTIONAL -DSIM -I $(PDK_PATH) \
56 -f$(USER_PROJECT_VERILOG)/includes/includes.rtl.$(CONFIG) \
dineshannayya00438892022-03-12 22:36:37 +053057 $< -o $@
58 else
dineshannayyad8a093b2022-03-26 08:32:19 +053059 iverilog -g2012 -DWFDUMP -DFUNCTIONAL -DSIM -I $(PDK_PATH) \
60 -f$(USER_PROJECT_VERILOG)/includes/includes.rtl.$(CONFIG) \
dineshannayya00438892022-03-12 22:36:37 +053061 $< -o $@
62 endif
63else
dineshannayya93c82cc2022-04-10 12:40:06 +053064 ifeq ($(DUMP),OFF)
65 iverilog -g2012 -DFUNCTIONAL -DUSE_POWER_PINS -DGL -I $(PDK_PATH) \
66 -f$(USER_PROJECT_VERILOG)/includes/includes.gl.$(CONFIG) \
dineshannayya00438892022-03-12 22:36:37 +053067 $< -o $@
dineshannayya93c82cc2022-04-10 12:40:06 +053068 else
69 iverilog -g2012 -DWFDUMP -DFUNCTIONAL -DGL -I $(PDK_PATH) \
70 -f$(USER_PROJECT_VERILOG)/includes/includes.gl.$(CONFIG) \
71 $< -o $@
72 endif
dineshannayya00438892022-03-12 22:36:37 +053073endif
74
75%.vcd: %.vvp
dineshannayya93c82cc2022-04-10 12:40:06 +053076 vvp $< +risc_core_id=$(RISC_CORE)
dineshannayya00438892022-03-12 22:36:37 +053077
dineshannayya00438892022-03-12 22:36:37 +053078
79# ---- Clean ----
80
81clean:
dineshannayya93c82cc2022-04-10 12:40:06 +053082 rm -f *.elf *.hex *.bin *.vvp *.vcd *.log *.dump
dineshannayya00438892022-03-12 22:36:37 +053083
84.PHONY: clean hex all