diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..d389aacb247d17b512b9b840433ad0018fb4f6cc --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +simulate/ + +verif/cocotb/*.ini +verif/cocotb/*.xml +verif/cocotb/transcript +verif/cocotb/sim_build +verif/cocotb/__pycache__ diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000000000000000000000000000000000..e6aff217e25576164d89d5260160b2216e40ddd4 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "soctools_flow"] + path = soctools_flow + url = https://git.soton.ac.uk/soclabs/soctools_flow.git diff --git a/flist/Top/ahb_QSPI.flist b/flist/Top/ahb_QSPI.flist new file mode 100644 index 0000000000000000000000000000000000000000..d074bdd80180da80554021956c1f1b10d37fceb6 --- /dev/null +++ b/flist/Top/ahb_QSPI.flist @@ -0,0 +1,3 @@ + + +$(SOCLABS_AHB_QSPI_DIR)/logical/top_ahb_qspi/logical/top_ahb_qspi.v \ No newline at end of file diff --git a/flows/makefile.simulate b/flows/makefile.simulate new file mode 100644 index 0000000000000000000000000000000000000000..e33807974be0331827cfc3d0f0acf7138bc2e571 --- /dev/null +++ b/flows/makefile.simulate @@ -0,0 +1,54 @@ +#----------------------------------------------------------------------------- +# AHB QSPI Simulation Makefile +# A joint work commissioned on behalf of SoC Labs, under Arm Academic Access license. +# +# Contributors +# +# David Mapstone (d.a.mapstone@soton.ac.uk) +# Daniel Newbrook (d.newbrook@soton.ac.uk) +# +# Copyright (C) 2021-3, SoC Labs (www.soclabs.org) +#----------------------------------------------------------------------------- + +# ------- Cocotb Variables ----------- +# Convert Simulator Name for Cocotb +COCOTB_SIMULATOR ?= questa + +ifeq ($(SIMULATOR),mti) + COCOTB_SIMULATOR := questa +else ifeq ($(SIMULATOR),xm) + COCOTB_SIMULATOR := xcelium +else ifeq ($(SIMULATOR),vcs) + COCOTB_SIMULATOR := vcs +endif + +# Cocotb GUI Variable +GUI ?= 0 + +# Cocotb Test Location +COCOTB_TEST_DIR := $(SOCLABS_AHB_QSPI_DIR)/verif/cocotb + + +# Cocotb Scratch Directory +COCOTB_DIR := $(SIM_TOP_DIR)/cocotb +COCOTB_SCRATCH_DIR := $(COCOTB_DIR)/scratch + +# Filelist for Cocotb +MAKEFILE_FILELIST := $(COCOTB_DIR)/makefile.flist + + +# Generate Make filelist from flists +flist_makefile_nanosoc: + @mkdir -p $(COCOTB_DIR) + @(cd $(COCOTB_DIR); \ + $(SOCLABS_SOCTOOLS_FLOW_DIR)/bin/filelist_compile.py -m -f $(DESIGN_VC) -o $(MAKEFILE_FILELIST);) + +run_cocotb: flist_makefile_nanosoc + @mkdir -p $(SIM_DIR) + @cd $(SIM_DIR); $(MAKE) -C $(SOCLABS_AHB_QSPI_DIR)/verif/cocotb clean SIM_BUILD=$(COCOTB_SCRATCH_DIR) + @cd $(SIM_DIR); $(MAKE) -C $(SOCLABS_AHB_QSPI_DIR)/verif/cocotb sim SIM=$(COCOTB_SIMULATOR) GUI=$(GUI) SIM_BUILD=$(COCOTB_SCRATCH_DIR) TESTCASE=$(TESTCASE) + +sim_cocotb: GUI=1 +sim_cocotb: run_cocotb + + diff --git a/makefile b/makefile index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..2ad6e3b7354b3be145465c9ae65a985be6a2a302 100644 --- a/makefile +++ b/makefile @@ -0,0 +1,22 @@ +#------------------------------------- +# - Commonly Overloaded Variables +#------------------------------------- +# Simulator type (mti/vcs/xm) +SIMULATOR = mti + +#------------------------------------- +# - Directory Setups +#------------------------------------- +# Directory to put simulation files +SIM_TOP_DIR ?= $(SOCLABS_AHB_QSPI_DIR)/simulate/sim +SIM_DIR ?= $(SIM_TOP_DIR) + + +ifeq ($(ASIC),yes) + DESIGN_VC ?= $(SOCLABS_AHB_QSPI_DIR)/flist/Top/ahb_QSPI_ASIC.flist +else + DESIGN_VC ?= $(SOCLABS_AHB_QSPI_DIR)/flist/Top/ahb_QSPI.flist +endif + +#Include flows +include ./flows/makefile.simulate diff --git a/set_env.sh b/set_env.sh new file mode 100644 index 0000000000000000000000000000000000000000..0341095e8f1b57285992258e1b187d4a14aa18ce --- /dev/null +++ b/set_env.sh @@ -0,0 +1,2 @@ +export SOCLABS_AHB_QSPI_DIR=$(pwd) +export SOCLABS_SOCTOOLS_FLOW_DIR=$SOCLABS_AHB_QSPI_DIR/soctools_flow \ No newline at end of file diff --git a/soctools_flow b/soctools_flow new file mode 160000 index 0000000000000000000000000000000000000000..3e339941d8b4536f4bd096fc4191a4e36e38978a --- /dev/null +++ b/soctools_flow @@ -0,0 +1 @@ +Subproject commit 3e339941d8b4536f4bd096fc4191a4e36e38978a diff --git a/verif/cocotb/ahb_qspi_cocotb.v b/verif/cocotb/ahb_qspi_cocotb.v index 1d4d98ab6bb316df0180722b4ab6bd7fab69ba81..2ee7bb2f9dc559554e6e1cc4f5987606a8a1dda3 100644 --- a/verif/cocotb/ahb_qspi_cocotb.v +++ b/verif/cocotb/ahb_qspi_cocotb.v @@ -23,6 +23,7 @@ module ahb_qspi_cocotb( top_ahb_qspi u_top_ahb_qspi( .HCLK(HCLK), .HRESETn(HRESETn), + .HADDR(cocotb_HADDR), .HTRANS(cocotb_HTRANS), .HWRITE(cocotb_HWRITE), @@ -35,12 +36,15 @@ top_ahb_qspi u_top_ahb_qspi( .HREADY(cocotb_HREADY), .HREADYOUT(cocotb_HREADYOUT), .HRESP(cocotb_HRESP), + .QSPI_SCLK(), .QSPI_nCS(), .QSPI_IO_o(), .QSPI_IO_i(), .QSPI_IO_e() -) +); + + endmodule \ No newline at end of file diff --git a/verif/cocotb/makefile b/verif/cocotb/makefile index 2c21faadd7031287d7ab37ea3dc7b712027ccca1..3a60efe8d224398ac83cb49ce630a885a9b30b5d 100644 --- a/verif/cocotb/makefile +++ b/verif/cocotb/makefile @@ -53,7 +53,7 @@ else ifeq ($(SIM), verilator) else ifeq ($(SIM), questa) COMPILE_ARGS += +acc endif -#include $(SOCLABS_SRAM_CHIPLET_DIR)/simulate/sim/cocotb/makefile.flist +include $(SOCLABS_AHB_QSPI_DIR)/simulate/sim/cocotb/makefile.flist include $(shell cocotb-config --makefiles)/Makefile.sim iverilog_dump.v: