From 271a0756c8d3aa45910c43462be79d4a62422721 Mon Sep 17 00:00:00 2001 From: Lucian Petrica Date: Wed, 21 Feb 2024 17:51:19 +0000 Subject: [PATCH] Increased sim mem capacity --- kernels/cclo/Makefile | 4 +- kernels/cclo/hdl/sim_mem.v | 102 ++++++++++++++++++++++++++++ kernels/cclo/tcl/generate_sim.tcl | 24 ++++--- test/model/simulator/CMakeLists.txt | 2 +- 4 files changed, 121 insertions(+), 11 deletions(-) create mode 100644 kernels/cclo/hdl/sim_mem.v diff --git a/kernels/cclo/Makefile b/kernels/cclo/Makefile index 15df252b..abb77bd3 100644 --- a/kernels/cclo/Makefile +++ b/kernels/cclo/Makefile @@ -24,7 +24,7 @@ EN_ARITH ?= 1 EN_COMPRESS ?= 1 EN_EXT_KRNL ?= 1 MB_DEBUG_LEVEL ?= 0 -SIM_MEM_SIZE ?= 16M +SIM_MEM_SIZE_LOG ?= 28 SIM_MEM_LATENCY ?= 50 CCLO_ELF=vitis_ws/ccl_offload_control/Debug/ccl_offload_control.elf CCLO_SIMDLL=ccl_offload_ex/ccl_offload_ex.sim/sim_1/behav/xsim/xsim.dir/ccl_offload_behav/xsimk.so @@ -88,7 +88,7 @@ simdll: $(CCLO_SIMDLL) $(CCLO_SIMDLL): tcl/generate_sim.tcl elf $(MAKE) -C ../plugins PLATFORM=$(PLATFORM) - vivado -mode batch -source $< -tclargs $(STACK_TYPE) $(EN_DMA) $(EN_ARITH) $(EN_COMPRESS) $(EN_EXT_KRNL) $(SIM_MEM_SIZE) $(SIM_MEM_LATENCY) + vivado -mode batch -source $< -tclargs $(STACK_TYPE) $(EN_DMA) $(EN_ARITH) $(EN_COMPRESS) $(EN_EXT_KRNL) $(SIM_MEM_SIZE_LOG) $(SIM_MEM_LATENCY) cd ccl_offload_ex/ccl_offload_ex.sim/sim_1/behav/xsim/ && ./compile.sh && ./elaborate.sh dcp: $(CCLO_DCP) diff --git a/kernels/cclo/hdl/sim_mem.v b/kernels/cclo/hdl/sim_mem.v new file mode 100644 index 00000000..9775e6c7 --- /dev/null +++ b/kernels/cclo/hdl/sim_mem.v @@ -0,0 +1,102 @@ +/******************************************************************************* +# Copyright (C) 2024 Advanced Micro Devices, Inc +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# *******************************************************************************/ + +`timescale 1ns / 1ps + +module sim_mem +#( + parameter MEM_WIDTH = 512, + parameter MEM_DEPTH_LOG = 22, + parameter READ_LATENCY = 50 +)( + +(* X_INTERFACE_PARAMETER = "MODE Slave, MASTER_TYPE BRAM_CTRL, MEM_ECC NONE, READ_WRITE_MODE READ_WRITE" *) +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_A CLK" *) + input clk_a, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_A RST" *) + input rst_a, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_A EN" *) + input en_a, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_A ADDR" *) + input [MEM_DEPTH_LOG-1:0] addr_a, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_A WE" *) + input [MEM_WIDTH/8-1:0] we_a, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_A DIN" *) + input [MEM_WIDTH-1:0] din_a, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_A DOUT" *) + output [MEM_WIDTH-1:0] dout_a, + +(* X_INTERFACE_PARAMETER = "MODE Slave, MASTER_TYPE BRAM_CTRL, MEM_ECC NONE, READ_WRITE_MODE READ_WRITE" *) +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_B CLK" *) + input clk_b, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_B RST" *) + input rst_b, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_B EN" *) + input en_b, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_B ADDR" *) + input [MEM_DEPTH_LOG-1:0] addr_b, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_B WE" *) + input [MEM_WIDTH/8-1:0] we_b, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_B DIN" *) + input [MEM_WIDTH-1:0] din_b, +(* X_INTERFACE_INFO = "xilinx.com:interface:bram_rtl:1.0 MEM_PORT_B DOUT" *) + output [MEM_WIDTH-1:0] dout_b +); + + +reg [MEM_WIDTH-1:0] mem[2**MEM_DEPTH_LOG-1:0]; + + +genvar byte_idx; +generate for(byte_idx=0; byte_idx