init commit

This commit is contained in:
2026-09-17 16:52:07 -04:00
commit b71bc6a777
79 changed files with 3978 additions and 0 deletions
+19
View File
@@ -0,0 +1,19 @@
../../src/verilog/CF_SRAM_1024x32.tt_180V_25C.v
../../src/verilog/cpu/cpu_pkg.sv
../../src/verilog/memory_controller.sv
../../src/verilog/sram_wrapper.sv
../../src/verilog/cpu/reg_file.sv
../../src/verilog/cpu/fetch.sv
../../src/verilog/cpu/cpu_top.sv
../../src/verilog/chip_top.sv
../../src/verilog/tb_processor.sv
// you MUST add any new files you make to this include file, follow the path naming above
// aka '../../src/verilog/cpu/(your module here).sv'
// Add additional testbench(es) using this format
// ../../src/verilog/tb_name_of_test.sv
// Warning: If your added testbench create a text file,
// please make sure it is commented out when you run verify_onboarding
// as 2 testbench cannot write to text files at the same time
+2
View File
@@ -0,0 +1,2 @@
../../src/verilog/cpu/fetch.sv
../../src/verilog/tb_fetch.sv
+2
View File
@@ -0,0 +1,2 @@
../../tests/mock/chip_top_mock.sv
../../src/verilog/tb_processor.sv
+101
View File
@@ -0,0 +1,101 @@
#--------------------------------------------------------------------
# Cadence‑only Makefile (Xcelium / SimVision / IMC)
#--------------------------------------------------------------------
#--------------------------------------------------------------------
# Add the following to the testbench
# initial begin
# $shm_open("waves.shm");
# $shm_probe("AC");
# end
#--------------------------------------------------------------------
# ===== User‑configurable variables =================================
INCLUDE_FILE_NAME ?= cpu.include #this is a placeholder
TOP ?= tb_processor
# ===== Paths =======================================================
CURRENT_DIR := $(shell pwd)
WORKSPACE := $(CURRENT_DIR)/WORKSPACE
SCRIPT_DIR := ../../scripts
PYTHON ?= python3
# ===== Dynamic macro definitions ===================================
VERILOG_DEFINES := SIM=1 INST_FILE=\"$(INST_FILE)\"
ifeq ($(INIT_DATA),1)
VERILOG_DEFINES += INIT_DATA=1
VERILOG_DEFINES += DATA_FILE=\"$(DATA_FILE)\"
endif
DEFINE_FLAGS := $(foreach def,$(VERILOG_DEFINES),+define+$(def))
# ===== Help Message ================================================
.PHONY: help
help:
@echo "----------------------------------------------------------------"
@echo "Administrative targets:"
@echo " help - this message"
@echo " clean - remove WORKSPACE directory"
@echo
@echo "Compilation targets:"
@echo " link - generate WORKSPACE/sym_links/"
@echo " xrun - compile & simulate using Cadence Xcelium"
@echo " simvision - view waveform database"
@echo " run_and_view - xrun + simvision"
@echo " coverage - open coverage in IMC"
@echo
@echo " verify_onboarding - (DIGITAL DESIGN ONBOARDING ONLY) check your project for correctness"
@echo "----------------------------------------------------------------"
# ===== Administrative Targets ======================================
.PHONY: clean link
clean:
@rm -rf $(WORKSPACE)
link:
@mkdir -p $(WORKSPACE)/sym_links
@rm -rf $(WORKSPACE)/sym_links/*
@$(PYTHON) link_files.py $(INCLUDE_FILE_NAME)
# ===== Simulation Targets ==========================================
.PHONY: xrun simvision run_and_view coverage
XRUN_FLAGS = -64bit -sv -linedebug -access +rwc \
-timescale 1ns/10ps \
$(DEFINE_FLAGS) \
+testname=$(TESTNAME) \
+incdir+sym_links \
-coverage all \
-licqueue \
-covoverwrite
SIM_PLUSARGS ?=
xrun: link
cd $(WORKSPACE) && \
xrun $(XRUN_FLAGS) -f sym_links/sim_no_path.include \
-top $(TOP) -logfile simulation.log $(SIM_PLUSARGS)
simvision:
cd $(WORKSPACE) && simvision waves.shm &
run_and_view: xrun simvision
# Need to change IMC path...
coverage:
cd $(WORKSPACE) && /tools/software/cadence/vmanager/latest/tools.lnx86/vmgr/bin/imc -load cov_work/scope/test &
# Generate memory pre and post state files but do not verify correctness
gen_mem:
$(MAKE) clean
$(PYTHON) $(SCRIPT_DIR)/init_mem.py $(WORKSPACE)
$(MAKE) xrun
verify_onboarding:
$(MAKE) clean
$(PYTHON) $(SCRIPT_DIR)/init_mem.py $(WORKSPACE)
$(MAKE) xrun
$(PYTHON) $(SCRIPT_DIR)/check_onboarding.py $(WORKSPACE)/memory_post_state_lower.txt $(WORKSPACE)/sim_memory_post_state_lower.txt
$(PYTHON) $(SCRIPT_DIR)/check_onboarding.py $(WORKSPACE)/memory_post_state_upper.txt $(WORKSPACE)/sim_memory_post_state_upper.txt
# ===== Default Target ==============================================
.DEFAULT_GOAL := run_and_view
+57
View File
@@ -0,0 +1,57 @@
import os
import re
import sys
if len(sys.argv) != 2:
print("Usage: python3 link_files.py <include_file_location>")
sys.exit(1)
# Input and output file names
input_file = "Include/" + sys.argv[1]
print("looking in file " + input_file)
# Ensure WORKSPACE and sym_links directories exist
workspace_dir = "WORKSPACE"
sym_links_dir = os.path.join(workspace_dir, "sym_links")
os.makedirs(sym_links_dir, exist_ok=True)
# Output file path in WORKSPACE
output_file = os.path.join(sym_links_dir, "sim_no_path.include")
# Open input file for reading
with open(input_file, 'r') as input_fp:
# Open output file for writing
with open(output_file, 'w') as output_fp:
# Iterate through each line in the input file
for line in input_fp:
# Remove leading and trailing whitespaces
line = line.strip()
# Check if the line is a comment or empty
if not line or line.startswith('//'):
# If it's a comment or empty line, write it directly to the output file
output_fp.write(line + '\n')
else:
# Extract the file path using regex
match = re.match(r'^\s*(\S+)\s*$', line)
if match:
file_path = match.group(1)
# Check if the file exists
if os.path.exists(file_path):
# Create symbolic link in WORKSPACE
link_path = os.path.join(sym_links_dir, os.path.basename(file_path))
try:
os.symlink(os.path.abspath(file_path), link_path)
except FileExistsError as e:
print("Tried to symlink an already existing file: \n", e)
print("Continuing")
# Write only the filename to the output file
output_fp.write(f"sym_links/{os.path.basename(file_path)}\n")
else:
print(f"Error: File '{file_path}' does not exist. Aborting process.")
break
else:
print(f"Error: Invalid file path format in line '{line}'. Aborting process.")
break