├── README.md ├── cmod ├── Systolic │ ├── Control │ │ ├── Control.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── InputAxi │ │ ├── InputAxi.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── InputSetup │ │ ├── InputSetup.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── Memory │ │ ├── Makefile │ │ ├── Memory.h │ │ └── testbench.cpp │ ├── MemoryCore │ │ ├── ArbitratedScratchpad.h │ │ ├── ArbitratedScratchpad_bk.h │ │ ├── Makefile │ │ ├── MemoryCore.h │ │ └── testbench.cpp │ ├── SysArray │ │ ├── Makefile │ │ ├── SysArray.h │ │ └── testbench.cpp │ ├── SysBias │ │ ├── Makefile │ │ ├── SysBias.h │ │ └── testbench.cpp │ ├── SysPE │ │ ├── Makefile │ │ ├── SysPE.h │ │ └── testbench.cpp │ ├── SysTop │ │ ├── Makefile │ │ ├── SysTop.h │ │ ├── testbench.cpp │ │ └── testbench │ │ │ ├── Master.h │ │ │ ├── MasterFromFile.h │ │ │ └── Slave.h │ ├── WeightAxi │ │ ├── Makefile │ │ ├── WeightAxi.h │ │ └── testbench.cpp │ └── include │ │ ├── AxiSpec.h │ │ ├── SysSpec.h │ │ └── utils.h └── cmod_Makefile ├── hls ├── Systolic │ ├── Control │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ ├── InputAxi │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ ├── InputSetup │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ ├── MemoryCore │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ ├── SysBias │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ ├── SysPE │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ ├── SysPE_Saif │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ ├── SysTop │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl │ └── WeightAxi │ │ ├── Makefile │ │ ├── go_hls.tcl │ │ └── go_vcs.tcl ├── design_checker_summary.py ├── hls_Makefile ├── nvhls_exec.tcl └── run_hls_global_setup.tcl └── matchlib ├── LICENSE ├── README.md ├── cmod ├── .clang-format ├── MemModel │ ├── .gitignore │ ├── .p4ignore │ ├── Makefile │ ├── MemModel.cpp │ ├── MemModel.h │ ├── mem_config.h │ └── testbench.cpp ├── cmod_Makefile ├── examples │ ├── .gitignore │ ├── .p4ignore │ ├── ConnectionsRecipes │ │ ├── Adder │ │ │ ├── Adder.h │ │ │ ├── Makefile │ │ │ └── testbench.cpp │ │ ├── Adder2 │ │ │ ├── Adder2.h │ │ │ ├── Makefile │ │ │ └── testbench.cpp │ │ ├── Adder3 │ │ │ ├── Makefile │ │ │ ├── my_testbench.input.json │ │ │ └── testbench.cpp │ │ └── Adder4 │ │ │ ├── Adder4.h │ │ │ ├── Makefile │ │ │ └── testbench.cpp │ └── Counter │ │ ├── Counter.cpp │ │ ├── Counter.h │ │ ├── Makefile │ │ └── testbench.cpp ├── include │ ├── .ArbitratedScratchpad.h.swp │ ├── Arbiter.h │ ├── ArbitratedScratchpad.h │ ├── ArbitratedScratchpad │ │ └── ArbitratedScratchpadTypes.h │ ├── ArbitratedScratchpadDP.h │ ├── CombinationalBufferedPorts.h │ ├── ReorderBuf.h │ ├── Scratchpad.h │ ├── Scratchpad │ │ └── ScratchpadTypes.h │ ├── TypeToBits.h │ ├── UIntOrEmpty.h │ ├── WHVCRouter.h │ ├── arbitrated_crossbar.h │ ├── axi │ │ ├── AxiAddWriteResponse.h │ │ ├── AxiArbiter.h │ │ ├── AxiLiteSlaveToMem.h │ │ ├── AxiMasterGate.h │ │ ├── AxiMasterGate │ │ │ ├── AxiMasterGateIf.h │ │ │ ├── ReorderBufWBeats.h │ │ │ └── testbench │ │ │ │ └── Host.h │ │ ├── AxiRemoveWriteResponse.h │ │ ├── AxiSlaveToMem.h │ │ ├── AxiSlaveToReadyValid.h │ │ ├── AxiSlaveToReadyValid │ │ │ └── testbench │ │ │ │ ├── .RVSink.h.swp │ │ │ │ └── RVSink.h │ │ ├── AxiSlaveToReg.h │ │ ├── AxiSplitter.h │ │ ├── axi4.h │ │ ├── axi4_configs.h │ │ ├── axi4_encoding.h │ │ └── testbench │ │ │ ├── CSVFileReader.h │ │ │ ├── Master.h │ │ │ ├── MasterFromFile.h │ │ │ ├── Slave.h │ │ │ └── SlaveFromFile.h │ ├── comptrees.h │ ├── crossbar.h │ ├── fifo.h │ ├── hls_globals.h │ ├── match_scverify.h │ ├── mem_array.h │ ├── nvhls_annotate.h │ ├── nvhls_array.h │ ├── nvhls_assert.h │ ├── nvhls_connections.h │ ├── nvhls_connections_buffered_ports.h │ ├── nvhls_connections_network.h │ ├── nvhls_connections_utils.h │ ├── nvhls_int.h │ ├── nvhls_marshaller.h │ ├── nvhls_message.h │ ├── nvhls_module.h │ ├── nvhls_packet.h │ ├── nvhls_serdes.h │ ├── nvhls_trace.h │ ├── nvhls_types.h │ ├── nvhls_vector.h │ ├── nvhls_verify.h │ ├── one_hot_to_bin.h │ └── testbench │ │ ├── Pacer.h │ │ └── nvhls_rand.h ├── regress_Makefile └── unittests │ ├── .gitignore │ ├── .p4ignore │ ├── ArbiterModule │ ├── ArbiterModule.h │ ├── Makefile │ └── testbench.cpp │ ├── ArbiterTop │ ├── ArbiterTop.cpp │ ├── ArbiterTop.h │ ├── Makefile │ └── testbench.cpp │ ├── ArbitratedCrossbarTop │ ├── ArbitratedCrossbarTop.cpp │ ├── ArbitratedCrossbarTop.h │ ├── Makefile │ └── testbench.cpp │ ├── ArbitratedScratchpadDPTop │ ├── ArbitratedScratchpadDPTop.cpp │ ├── ArbitratedScratchpadDPTop.h │ ├── Makefile │ └── testbench.cpp │ ├── ArbitratedScratchpadTop │ ├── ArbitratedScratchpadConfig.h │ ├── ArbitratedScratchpadTop.cpp │ ├── ArbitratedScratchpadTop.h │ ├── Makefile │ └── testbench.cpp │ ├── ConnectionsTop │ ├── .gitignore │ ├── .p4ignore │ ├── Makefile │ ├── MultChain.h │ ├── MultChainTop.h │ ├── TestBuffer.cpp │ ├── TestBypass.cpp │ ├── TestCombinational.cpp │ ├── TestCombinationalBufferedEnds.cpp │ ├── TestCombinationalIntoChan.cpp │ ├── TestMultChain.cpp │ ├── TestNetwork.cpp │ ├── TestNetworkCredit.cpp │ ├── TestPipeline.cpp │ ├── TestSerdesNetwork.cpp │ ├── TestSink.h │ └── TestSource.h │ ├── CrossbarTop │ ├── CrossbarTop.cpp │ ├── CrossbarTop.h │ ├── Makefile │ └── testbench.cpp │ ├── FifoTop │ ├── FifoTop.cpp │ ├── FifoTop.h │ ├── Makefile │ └── testbench.cpp │ ├── LzdTop │ ├── LzdTop.cpp │ ├── LzdTop.h │ ├── Makefile │ └── testbench.cpp │ ├── NVRC_MOD_LIB │ ├── NVRC_MOD_LIB_IGNORE │ ├── README │ ├── ReorderBufTop │ ├── Makefile │ ├── ReorderBufTop.cpp │ ├── ReorderBufTop.h │ └── testbench.cpp │ ├── ScratchpadTop │ ├── Makefile │ ├── ScratchpadConfig.h │ ├── ScratchpadTop.h │ └── testbench.cpp │ ├── VectorUnit │ ├── Makefile │ ├── VectorUnit.cpp │ ├── VectorUnit.h │ └── testbench.cpp │ ├── WHVCRouterTop │ ├── Makefile │ ├── README │ ├── WHVCRouterTop.h │ └── testbench.cpp │ ├── axi │ ├── AxiAddRemoveWRespTop │ │ ├── AxiAddRemoveWRespTop.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiAddWriteResp │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiArbSplitTop │ │ ├── AxiArbSplitTop.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiArbiter │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiExampleTB │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiExampleTBFromFile │ │ ├── Makefile │ │ ├── mem.csv │ │ ├── requests.csv │ │ ├── requests_q.csv │ │ ├── testbench.cpp │ │ └── testbench_interrupts.cpp │ ├── AxiLiteSlaveToMemTop │ │ ├── AxiLiteSlaveToMemTop.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiMasterGateTop │ │ ├── AxiMasterGateTop.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiRemoveWriteResp │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiSlaveToMemTop │ │ ├── AxiSlaveToMemTop.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiSlaveToReadyValidTop │ │ ├── AxiSlaveToReadyValidTop.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── AxiSlaveToRegTop │ │ ├── AxiSlaveToRegTop.h │ │ ├── Makefile │ │ └── testbench.cpp │ └── AxiSplitter │ │ ├── Makefile │ │ └── testbench.cpp │ └── unittests_Makefile ├── connections ├── LICENSE ├── README.md ├── doc │ ├── Doxyfile │ ├── Makefile │ ├── extra_stylesheet.css │ ├── layout.xml │ └── mainpage.dox ├── examples │ ├── Adder │ │ ├── Adder.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── Adder2 │ │ ├── Adder2.h │ │ ├── Makefile │ │ └── testbench.cpp │ ├── Adder3 │ │ ├── Makefile │ │ ├── my_testbench.input.json │ │ └── testbench.cpp │ └── cmod_Makefile └── include │ └── connections │ ├── Pacer.h │ ├── annotate.h │ ├── connections.h │ ├── connections_utils.h │ ├── marshaller.h │ └── message.h ├── doc ├── .gitignore ├── .p4ignore ├── Doxyfile ├── Makefile ├── connections-guide.pdf ├── extra_stylesheet.css ├── layout.xml └── mainpage.dox └── hls ├── .gitignore ├── .p4ignore ├── ConnectionsRecipes ├── Adder │ ├── Makefile │ └── go_hls.tcl ├── Adder2 │ ├── Makefile │ └── go_hls.tcl ├── Adder3 │ ├── Makefile │ ├── go_hls.tcl │ └── my_testbench.input.json └── Adder4 │ ├── Makefile │ └── go_hls.tcl ├── Counter ├── Makefile └── go_hls.tcl ├── MemModel ├── Makefile └── go_hls.tcl ├── design_checker_summary.py ├── hls_Makefile ├── nvhls_exec.tcl ├── regress_Makefile ├── run_hls_global_setup.tcl └── unittests ├── ArbiterModule ├── Makefile └── go_hls.tcl ├── ArbiterTop ├── Makefile └── go_hls.tcl ├── ArbitratedCrossbarTop ├── Makefile └── go_hls.tcl ├── ArbitratedScratchpadDPTop ├── Makefile └── go_hls.tcl ├── ArbitratedScratchpadTop ├── .Makefile.swp ├── Makefile └── go_hls.tcl ├── CrossbarTop ├── Makefile └── go_hls.tcl ├── FifoTop ├── Makefile └── go_hls.tcl ├── LzdTop ├── Makefile └── go_hls.tcl ├── ReorderBufTop ├── Makefile └── go_hls.tcl ├── ScratchpadTop ├── Makefile └── go_hls.tcl ├── VectorUnit ├── Makefile └── go_hls.tcl ├── WHVCRouterTop ├── Makefile └── go_hls.tcl └── axi ├── AxiAddRemoveWRespTop ├── Makefile └── go_hls.tcl ├── AxiArbSplitTop ├── Makefile └── go_hls.tcl ├── AxiLiteSlaveToMemTop ├── Makefile └── go_hls.tcl ├── AxiMasterGateTop ├── Makefile └── go_hls.tcl ├── AxiSlaveToMemTop ├── Makefile └── go_hls.tcl ├── AxiSlaveToReadyValidTop ├── Makefile └── go_hls.tcl └── AxiSlaveToRegTop ├── Makefile └── go_hls.tcl /README.md: -------------------------------------------------------------------------------- 1 | # A HLS based Systolic Array Accelerator 2 | 3 | * 8-bit integer weight stationary systolic array 4 | * Designed with Catapult HLS flow and SystemC coding 5 | * Reconfigurable array size N = 8, 16, or 32 (/ESP_Systolic_Array_Accelerator/cmod/Systolic/include/SysSpec.h) 6 | 7 | ## Folder Structure 8 | * cmod: SystemC coding 9 | * Top Module (/ESP_Systolic_Array_Accelerator/cmod/Systolic/SysTop) 10 | 11 | * hls: HLS folders with HLS scripts, directories to process files need to be added 12 | * matchlib: SystemC Matchlib library (older version) from Nvidia (https://github.com/NVlabs/matchlib) 13 | 14 | ## SystemC and RTL Simulation Tools 15 | * SystemC 2.3.1 16 | * Catapult 10.5b 17 | * Verdi O-2018.09-SP2-7 18 | * VCS O-2018.09-SP2-11 19 | 20 | ## AXI Configuration 21 | * 0--0x00: dummy 22 | * 1--0x04: start signal (write only), fire interrupt upon completion 23 | * ----data=1 -> master weight read 24 | * ----data=2 -> master input read 25 | * ----data=3 -> master input write 26 | * ----data=4 -> start systolic array 27 | * 2--0x08: computation config 28 | * ----data[00-07]= "M-1" (8-bit, M: 1~256) 29 | * ----data[08-15]= use relu (1 bit) 30 | * ----data[16-19]= Bias left shift (4 bit) 31 | * ----data[20-23]= Accum right shift (4-bit), quantization 32 | * ----data[24-31]= Accum multiplier (8-bit), quantization 33 | * 3--0x0C: weight_read_base address 34 | * 4--0x10: input_read_base address 35 | * 5--0x14: input_write_base address 36 | * 6--0x18: flip memory buffer (no IRQ, write only) 37 | * 7--0x1C: dummy 38 | -------------------------------------------------------------------------------- /cmod/Systolic/Control/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | CFLAGS = -DHLS_ALGORITHMICC 19 | 20 | include ../../cmod_Makefile 21 | 22 | all: sim_test 23 | 24 | run: 25 | ./sim_test 26 | 27 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 28 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 29 | 30 | sim_clean: 31 | rm -rf *.o sim_* 32 | -------------------------------------------------------------------------------- /cmod/Systolic/Control/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "Control.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (Control) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/InputAxi/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | CFLAGS = -DHLS_ALGORITHMICC 19 | 20 | include ../../cmod_Makefile 21 | 22 | all: sim_test 23 | 24 | run: 25 | ./sim_test 26 | 27 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 28 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 29 | 30 | sim_clean: 31 | rm -rf *.o sim_* 32 | -------------------------------------------------------------------------------- /cmod/Systolic/InputAxi/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "InputAxi.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (InputAxi) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/InputSetup/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | CFLAGS = -DHLS_ALGORITHMICC 19 | 20 | include ../../cmod_Makefile 21 | 22 | all: sim_test 23 | 24 | run: 25 | ./sim_test 26 | 27 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 28 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 29 | 30 | sim_clean: 31 | rm -rf *.o sim_* 32 | -------------------------------------------------------------------------------- /cmod/Systolic/InputSetup/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "InputSetup.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (InputSetup) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/Memory/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | CFLAGS = -DHLS_ALGORITHMICC 19 | 20 | include ../../cmod_Makefile 21 | 22 | all: sim_test 23 | 24 | run: 25 | ./sim_test 26 | 27 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 28 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 29 | 30 | sim_clean: 31 | rm -rf *.o sim_* 32 | -------------------------------------------------------------------------------- /cmod/Systolic/Memory/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "Memory.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (Memory) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/MemoryCore/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | CFLAGS = -DHLS_ALGORITHMICC 19 | 20 | include ../../cmod_Makefile 21 | 22 | all: sim_test 23 | 24 | run: 25 | ./sim_test 26 | 27 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 28 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 29 | 30 | sim_clean: 31 | rm -rf *.o sim_* 32 | -------------------------------------------------------------------------------- /cmod/Systolic/MemoryCore/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "MemoryCore.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (MemoryCore) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/SysArray/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | include ../../cmod_Makefile 19 | 20 | all: sim_test 21 | 22 | run: 23 | ./sim_test 24 | 25 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 26 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | sim_clean: 29 | rm -rf *.o sim_* 30 | -------------------------------------------------------------------------------- /cmod/Systolic/SysArray/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "SysArray.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (SysArray) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/SysBias/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | include ../../cmod_Makefile 19 | 20 | all: sim_test 21 | 22 | run: 23 | ./sim_test 24 | 25 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 26 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | sim_clean: 29 | rm -rf *.o sim_* 30 | -------------------------------------------------------------------------------- /cmod/Systolic/SysBias/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "SysBias.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (SysBias) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/SysPE/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | include ../../cmod_Makefile 19 | 20 | all: sim_test 21 | 22 | run: 23 | ./sim_test 24 | 25 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 26 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | sim_clean: 29 | rm -rf *.o sim_* 30 | -------------------------------------------------------------------------------- /cmod/Systolic/SysTop/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | CFLAGS = -DHLS_ALGORITHMICC 19 | 20 | include ../../cmod_Makefile 21 | 22 | all: sim_test 23 | 24 | run: 25 | ./sim_test 26 | 27 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 28 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 29 | 30 | sim_clean: 31 | rm -rf *.o sim_* 32 | -------------------------------------------------------------------------------- /cmod/Systolic/WeightAxi/Makefile: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | # 17 | 18 | include ../../cmod_Makefile 19 | 20 | all: sim_test 21 | 22 | run: 23 | ./sim_test 24 | 25 | sim_test: $(wildcard *.h) $(wildcard *.cpp) 26 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | sim_clean: 29 | rm -rf *.o sim_* 30 | -------------------------------------------------------------------------------- /cmod/Systolic/WeightAxi/testbench.cpp: -------------------------------------------------------------------------------- 1 | #include "WeightAxi.h" 2 | #include "../include/SysSpec.h" 3 | #include "../include/utils.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define NVHLS_VERIFY_BLOCKS (WeightAxi) 11 | #include 12 | using namespace::std; 13 | 14 | SC_MODULE (testbench) { 15 | sc_clock clk; 16 | sc_signal rst; 17 | 18 | SC_HAS_PROCESS(testbench); 19 | testbench(sc_module_name name) 20 | : sc_module(name), 21 | clk("clk", 1, SC_NS, 0.5,0,SC_NS,true), 22 | rst("rst") 23 | { 24 | SC_THREAD(Run); 25 | } 26 | 27 | void Run() { 28 | rst = 1; 29 | wait(10.5, SC_NS); 30 | rst = 0; 31 | cout << "@" << sc_time_stamp() << " Asserting Reset " << endl ; 32 | wait(1, SC_NS); 33 | cout << "@" << sc_time_stamp() << " Deasserting Reset " << endl ; 34 | rst = 1; 35 | 36 | wait(1000, SC_NS); 37 | cout << "@" << sc_time_stamp() << " Stop " << endl ; 38 | sc_stop(); 39 | } 40 | }; 41 | 42 | 43 | 44 | int sc_main(int argc, char *argv[]) 45 | { 46 | nvhls::set_random_seed(); 47 | testbench my_testbench("my_testbench"); 48 | 49 | 50 | sc_start(); 51 | cout << "CMODEL PASS" << endl; 52 | return 0; 53 | }; 54 | 55 | -------------------------------------------------------------------------------- /cmod/Systolic/include/SysSpec.h: -------------------------------------------------------------------------------- 1 | #ifndef __SYSSPEC__ 2 | #define __SYSSPEC__ 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | namespace spec { 9 | const int N = 32; // array size N*N 10 | const int Entries = N*8; // number of entries per bank 11 | // Total memory with double buffering: 2*N*Entries bytes 12 | 13 | // Fixed 8-bit for input/weight/bias 14 | // Fixed 24-bit for accumulation 15 | typedef NVINT8 InputType; 16 | typedef NVINT24 AccumType; 17 | 18 | // 8 bit mul for accum 19 | typedef NVUINT8 AccumMulType; 20 | 21 | // 4 bit left shift for bias, 22 | // 4 bit right shift for accum 23 | typedef NVUINT4 ShiftType; 24 | 25 | // Config format 26 | // NOTE: declare here for now, may move to include/SysSpec.h 27 | // * is_relu: use relu activation or not 28 | // * bias_left_shift: 0-15 left shift on bias values before add 29 | // * accum_right_shift: right shift accum before truncation (int quant) 30 | // * accum_multiplier: unsigned multiplier 0-255 (int quant) 31 | class SysConfig: public nvhls_message{ 32 | public: 33 | bool is_relu; 34 | NVUINT4 bias_left_shift; 35 | NVUINT4 accum_right_shift; 36 | NVUINT8 accum_multiplier; 37 | static const unsigned int width = 1+4+4+8; 38 | 39 | template 40 | void Marshall(Marshaller& m) { 41 | m& is_relu; 42 | m& bias_left_shift; 43 | m& accum_right_shift; 44 | m& accum_multiplier; 45 | } 46 | }; 47 | 48 | } 49 | 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /cmod/Systolic/include/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef __UTILS_H__ 2 | #define __UITLS_H__ 3 | 4 | /* Matrix utility functions for testbench*/ 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include 11 | 12 | using namespace::std; 13 | 14 | template 15 | vector> GetMat(int rows, int cols) { 16 | 17 | default_random_engine generator (random_device{}()); 18 | binomial_distribution distribution(255,0.5); //(0-255) 19 | vector> mat(rows, vector(cols)); 20 | for (int i = 0; i < rows; i++) { 21 | for (int j = 0; j < cols; j++) { 22 | int tmp = distribution(generator) - 128; // -128~127 23 | //mat[i][j] = nvhls::get_rand(); 24 | mat[i][j] = tmp; 25 | } 26 | } 27 | return mat; 28 | } 29 | 30 | template 31 | void PrintMat(vector> mat) { 32 | int rows = (int) mat.size(); 33 | int cols = (int) mat[0].size(); 34 | for (int i = 0; i < rows; i++) { 35 | cout << "\t"; 36 | for (int j = 0; j < cols; j++) { 37 | cout << mat[i][j] << "\t"; 38 | } 39 | cout << endl; 40 | } 41 | cout << endl; 42 | } 43 | 44 | template 45 | vector> MatMul(vector> mat_A, vector> mat_B) { 46 | // mat_A _N*_M 47 | // mat_B _M*_P 48 | // mat_C _N*_P 49 | int _N = (int) mat_A.size(); 50 | int _M = (int) mat_A[0].size(); 51 | int _P = (int) mat_B[0].size(); 52 | 53 | assert(_M == (int) mat_B.size()); 54 | vector> mat_C(_N, vector(_P, 0)); 55 | 56 | for (int i = 0; i < _N; i++) { 57 | for (int j = 0; j < _P; j++) { 58 | mat_C[i][j] = 0; 59 | for (int k = 0; k < _M; k++) { 60 | mat_C[i][j] += mat_A[i][k]*mat_B[k][j]; 61 | } 62 | } 63 | } 64 | return mat_C; 65 | } 66 | 67 | 68 | 69 | #endif 70 | 71 | -------------------------------------------------------------------------------- /hls/Systolic/Control/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | 22 | include $(ROOT)/hls/hls_Makefile 23 | -------------------------------------------------------------------------------- /hls/Systolic/Control/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /hls/Systolic/Control/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/Systolic/InputAxi/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | 22 | include $(ROOT)/hls/hls_Makefile 23 | -------------------------------------------------------------------------------- /hls/Systolic/InputAxi/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /hls/Systolic/InputAxi/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/Systolic/InputSetup/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | 22 | include $(ROOT)/hls/hls_Makefile 23 | -------------------------------------------------------------------------------- /hls/Systolic/InputSetup/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /hls/Systolic/InputSetup/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/Systolic/MemoryCore/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | 22 | include $(ROOT)/hls/hls_Makefile 23 | -------------------------------------------------------------------------------- /hls/Systolic/MemoryCore/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | directive set -REGISTER_THRESHOLD 256 18 | directive set -MEM_MAP_THRESHOLD 256 19 | 20 | #/MemoryCore/MemoryRun/mem_inst 21 | nvhls::run 22 | -------------------------------------------------------------------------------- /hls/Systolic/MemoryCore/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/Systolic/SysBias/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | #RUN_SCVERIFY := 1 22 | 23 | include $(ROOT)/hls/hls_Makefile 24 | -------------------------------------------------------------------------------- /hls/Systolic/SysBias/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /hls/Systolic/SysBias/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/Systolic/SysPE/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | RUN_SCVERIFY := 1 22 | 23 | include $(ROOT)/hls/hls_Makefile 24 | -------------------------------------------------------------------------------- /hls/Systolic/SysPE/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /hls/Systolic/SysPE/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/Systolic/SysPE_Saif/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | RUN_SCVERIFY := 1 22 | TOP_NAME := SysPE 23 | CLK_PERIOD := 2 24 | include $(ROOT)/hls/hls_Makefile 25 | -------------------------------------------------------------------------------- /hls/Systolic/SysPE_Saif/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | solution options set /Flows/LowPower/SWITCHING_ACTIVITY_TYPE saif 18 | nvhls::run 19 | -------------------------------------------------------------------------------- /hls/Systolic/SysPE_Saif/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/Systolic/SysTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | RUN_SCVERIFY := 1 22 | 23 | include $(ROOT)/hls/hls_Makefile 24 | -------------------------------------------------------------------------------- /hls/Systolic/SysTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | namespace eval nvhls { 17 | proc set_bup_blocks {BUP_BLOCKS} { 18 | upvar 1 $BUP_BLOCKS MY_BLOCKS 19 | set MY_BLOCKS {"Control" "InputAxi" "InputSetup" "MemoryCore" "SysBias" "SysPE" "WeightAxi"} 20 | } 21 | #proc usercmd_post_assembly {} { 22 | # directive set /NLPTop/ActUnit/ActUnitRun/act_mem.banks.bank.array_impl.data0:rsc -MAP_TO_MODULE {sram_64x128} 23 | # directive set /NLPTop/OutBuffer/Run/output_mem.banks.bank.array_impl.data0:rsc -MAP_TO_MODULE {sram_256x128} 24 | # 25 | # for {set k 0} {$k < 16} {incr k} { 26 | # directive set /NLPTop/PECore/PECoreRun/weight_mem.banks.bank.array_impl.data$k:rsc -MAP_TO_MODULE {sram_2048x128} 27 | # } 28 | # directive set /NLPTop/PECore/PECoreRun/input_mem.banks.bank.array_impl.data0:rsc -MAP_TO_MODULE {sram_1024x128} 29 | #} 30 | } 31 | 32 | nvhls::run 33 | -------------------------------------------------------------------------------- /hls/Systolic/SysTop/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | #flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_SysTop_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 22 | exit 23 | -------------------------------------------------------------------------------- /hls/Systolic/WeightAxi/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/Systolic/ 19 | SYSTEMC_DESIGN := 1 20 | COMPILER_FLAGS := HLS_ALGORITHMICC 21 | 22 | include $(ROOT)/hls/hls_Makefile 23 | -------------------------------------------------------------------------------- /hls/Systolic/WeightAxi/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /hls/Systolic/WeightAxi/go_vcs.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | #source ../nvhls_exec.tcl 16 | 17 | source Catapult.ccs 18 | 19 | echo "***RUN VCS ON CONCAT SIM ONLY***" 20 | flow run /SCVerify/launch_make ./scverify/Verify_concat_sim_rtl_v_vcs.mk SIMTOOL=vcs sim INVOKE_ARGS= CCS_VCD_FILE=./default.fsdb CCS_VCD_TIMES=0,ns,end,ns USE_FSDB=true 21 | exit 22 | -------------------------------------------------------------------------------- /hls/design_checker_summary.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # This script parses the report file generated by Catapult Design Checker 18 | # to prepare a CSV summary. 19 | 20 | # It takes no inputs; it searches the working directory recursively 21 | # for files named design_checks_violated.log. 22 | 23 | import re 24 | from pathlib import Path 25 | import pandas as pd 26 | 27 | file_list =[] 28 | for filename in Path('.').glob('**/design_checks_violated.log'): 29 | file_list.append(filename) 30 | df = pd.DataFrame(columns=['Type','Rule','File','Message','Design']) 31 | type_re = re.compile('^\s*\*\*\*\*\s+([A-Z]*)') 32 | violation_re = re.compile('([A-Z]+)\s+(\w+.(?:h|cpp):[0-9]+,[0-9]+)\s+(.*)') 33 | row = 0 34 | for filename in file_list: 35 | print(filename) 36 | filelines = open(str(filename),'r').readlines() 37 | violation_type='' # Warning, Fatal, Error, Info 38 | for line in filelines: 39 | if (type_re.match(line)): 40 | m = type_re.match(line) 41 | violation_type = m.group(1) 42 | if (violation_re.match(line)): 43 | m = violation_re.match(line) 44 | rule = m.group(1) 45 | source = m.group(2) 46 | message = m.group(3).strip('\n') 47 | if (not re.search('spec_wrapper',source)): 48 | df.loc[row] = violation_type, rule, source, message, filename 49 | row += 1 50 | 51 | df.to_csv('DesignCheckSummary.csv',index=False) 52 | -------------------------------------------------------------------------------- /matchlib/LICENSE: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | -------------------------------------------------------------------------------- /matchlib/cmod/MemModel/.gitignore: -------------------------------------------------------------------------------- 1 | sim_memmodel 2 | -------------------------------------------------------------------------------- /matchlib/cmod/MemModel/.p4ignore: -------------------------------------------------------------------------------- 1 | sim_memmodel 2 | -------------------------------------------------------------------------------- /matchlib/cmod/MemModel/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../cmod_Makefile 18 | 19 | all: sim_memmodel 20 | 21 | sim_memmodel: $(wildcard *.h) $(wildcard *.cpp) $(wildcard ../include/*.h) 22 | $(CC) -o sim_memmodel $(CFLAGS) $(USER_FLAGS) -I../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 23 | 24 | run: 25 | ./sim_memmodel 26 | 27 | sim_clean: 28 | rm -rf *.o sim_* 29 | 30 | -------------------------------------------------------------------------------- /matchlib/cmod/MemModel/MemModel.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "MemModel.h" 21 | #include "mem_config.h" 22 | 23 | // Top-level function used to model mem_array 24 | // data represent the i/o data line 25 | // mem_op is memory operation type (READ/WRITE) 26 | // addr is the memory address 27 | void MemModel(MemWord_t write_data, MemWord_t & read_data, NVUINT1 mem_op, MemAddr_t addr) { 28 | static mem_array_sep banks; 29 | BankSel_t bank_sel; 30 | BankAddr_t bank_addr; 31 | if (NBANKS>1) { 32 | bank_sel = nvhls::get_slc(addr,0); 33 | bank_addr = nvhls::get_slc(addr,NBANKS_LOG2); 34 | } else { 35 | bank_sel = 0; 36 | bank_addr = addr; 37 | } 38 | 39 | 40 | if (mem_op == READ) { 41 | read_data = banks.read(bank_addr,bank_sel); 42 | DCOUT("Memory Op: Read, BankAddress: "<< hex << bank_addr.to_uint64() << " BankSel: " << bank_sel << " Data: " << read_data.to_uint64() << endl); 43 | } 44 | if (mem_op ==WRITE) { 45 | MemWord_t data_local = write_data; 46 | banks.write(bank_addr,bank_sel,data_local); 47 | DCOUT("Memory Op: Write, BankAddress: "<< hex << bank_addr.to_uint64() << " BankSel: " << bank_sel << " Data: " << write_data.to_uint64() << endl); 48 | } 49 | 50 | } 51 | 52 | -------------------------------------------------------------------------------- /matchlib/cmod/MemModel/MemModel.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MEM_MODEL_H 17 | #define MEM_MODEL_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include "mem_config.h" 24 | 25 | // Top-level function used to model mem_array 26 | // data represent the i/o data line 27 | // mem_op is memory operation type (READ/WRITE) 28 | // addr is the memory address 29 | void MemModel(MemWord_t write_data, MemWord_t & read_data, NVUINT1 mem_op, MemAddr_t addr); 30 | 31 | #endif 32 | -------------------------------------------------------------------------------- /matchlib/cmod/MemModel/mem_config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef MEM_CONFIG_H 17 | #define MEM_CONFIG_H 18 | 19 | #include "nvhls_int.h" 20 | #include "nvhls_types.h" 21 | 22 | #ifndef WORDSIZE 23 | #define WORDSIZE 64 24 | #endif 25 | #ifndef NBANKS 26 | #define NBANKS 1 27 | #endif 28 | #ifndef NUM_ENTRIES 29 | #define NUM_ENTRIES 1024 30 | #endif 31 | 32 | enum MemOp_t { 33 | READ, 34 | WRITE 35 | }; 36 | 37 | 38 | #define ADDR_WIDTH ((NUM_ENTRIES==1)?1:nvhls::nbits::val) 39 | #define NBANKS_LOG2 ((NBANKS==1)?1:nvhls::nbits::val) 40 | #define NUM_ENTRIES_PER_BANK (NUM_ENTRIES/NBANKS) 41 | #define BANK_ADDR_WIDTH ((NUM_ENTRIES_PER_BANK==1)?1:nvhls::nbits::val) 42 | 43 | typedef NVUINTC(WORDSIZE) MemWord_t; 44 | typedef NVUINTC(ADDR_WIDTH) MemAddr_t; 45 | typedef NVUINTC(NBANKS_LOG2) BankSel_t; 46 | typedef NVUINTC(BANK_ADDR_WIDTH) BankAddr_t; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/.gitignore: -------------------------------------------------------------------------------- 1 | *sim_* 2 | *output.json 3 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/.p4ignore: -------------------------------------------------------------------------------- 1 | *sim_* 2 | *output.json 3 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/ConnectionsRecipes/Adder/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../../cmod_Makefile 18 | 19 | all: sim_adder1 20 | 21 | run: 22 | ./sim_adder1 23 | 24 | sim_adder1: $(wildcard *.h) $(wildcard *.cpp) 25 | $(CC) -o sim_adder1 $(CFLAGS) $(USER_FLAGS) -I../../../include -I../../../include/connections $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 26 | 27 | sim_clean: 28 | rm -rf *.o sim_* 29 | 30 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/ConnectionsRecipes/Adder2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../../cmod_Makefile 18 | 19 | all: sim_adder2 20 | 21 | USER_FLAGS += -DCONN_RAND_STALL_PRINT_DEBUG 22 | run: 23 | ./sim_adder2 24 | 25 | sim_adder2: $(wildcard *.h) $(wildcard *.cpp) 26 | $(CC) -o sim_adder2 $(CFLAGS) $(USER_FLAGS) -I../../../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | sim_clean: 29 | rm -rf *.o sim_* 30 | 31 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/ConnectionsRecipes/Adder3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Must always use these modes for this test, since it is cycle count 18 | # dependent. 19 | override SIM_MODE=1 20 | override RAND_STALL=0 21 | 22 | include ../../../cmod_Makefile 23 | 24 | all: sim_adder3 25 | 26 | run: 27 | ./sim_adder3 28 | 29 | sim_adder3: $(wildcard *.h) $(wildcard *.cpp) 30 | $(CC) -o sim_adder3 $(CFLAGS) $(USER_FLAGS) -I../Adder2 -I../../../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 31 | 32 | sim_clean: 33 | rm -rf *.o sim_* 34 | 35 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/ConnectionsRecipes/Adder3/my_testbench.input.json: -------------------------------------------------------------------------------- 1 | { 2 | "channels": { 3 | "a_comb_BA": { 4 | "latency": 10, 5 | "capacity": 2, 6 | "src_name": "srca.x_out", 7 | "dest_name": "adder.a_in" 8 | }, 9 | "b_comb_BA": { 10 | "latency": 2, 11 | "capacity": 10, 12 | "src_name": "srcb.x_out", 13 | "dest_name": "adder.b_in" 14 | }, 15 | "sum_comb_BA": { 16 | "latency": 0, 17 | "capacity": 0, 18 | "src_name": "adder.sum_out", 19 | "dest_name": "dest.sum_in" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/ConnectionsRecipes/Adder4/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../../cmod_Makefile 18 | 19 | all: sim_adder4 20 | 21 | run: 22 | ./sim_adder4 23 | 24 | sim_adder4: $(wildcard *.h) $(wildcard *.cpp) 25 | $(CC) -o sim_adder4 $(CFLAGS) $(USER_FLAGS) -I../../../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 26 | 27 | sim_clean: 28 | rm -rf *.o sim_* 29 | 30 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/Counter/Counter.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "Counter.h" 17 | 18 | void Counter::increment() { 19 | // reset: 20 | value = 0; 21 | out.write(value); 22 | 23 | while (1) { 24 | wait(); 25 | if (inc.read() == 1) { 26 | ++value; 27 | out.write(value); 28 | } 29 | } 30 | } 31 | 32 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/Counter/Counter.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef __COUNTER_H__ 17 | #define __COUNTER_H__ 18 | 19 | #include 20 | #include 21 | 22 | SC_MODULE(Counter) { 23 | public: 24 | enum _ { 25 | WIDTH = 4 26 | }; 27 | 28 | typedef sc_uint Data; 29 | 30 | sc_in_clk clk; 31 | sc_in rst; 32 | sc_in inc; 33 | 34 | sc_out out; 35 | Data value; 36 | 37 | SC_CTOR(Counter): 38 | inc("inc") { 39 | SC_THREAD(increment); 40 | sensitive << clk.pos(); 41 | NVHLS_NEG_RESET_SIGNAL_IS(rst); 42 | } 43 | 44 | private: 45 | void increment(); 46 | }; 47 | 48 | #endif 49 | -------------------------------------------------------------------------------- /matchlib/cmod/examples/Counter/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../cmod_Makefile 18 | 19 | all: sim_counter 20 | 21 | run: 22 | ./sim_counter 23 | 24 | sim_counter: $(wildcard *.h) $(wildcard *.cpp) 25 | $(CC) -o sim_counter $(CFLAGS) $(USER_FLAGS) -I../../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 26 | 27 | sim_clean: 28 | rm -rf *.o sim_* 29 | -------------------------------------------------------------------------------- /matchlib/cmod/include/.ArbitratedScratchpad.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-acc/ESP_Systolic_Array_Accelerator/98f061fcfd9625ef97fbfc5e885e5bfb9b0c16b6/matchlib/cmod/include/.ArbitratedScratchpad.h.swp -------------------------------------------------------------------------------- /matchlib/cmod/include/axi/AxiMasterGate/ReorderBufWBeats.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __REORDERBUFWBEATS_H__ 18 | #define __REORDERBUFWBEATS_H__ 19 | 20 | #include 21 | 22 | /** 23 | * \brief An extension of ReorderBuf that allows one entry to contain multiple beats of data. 24 | * \ingroup ReorderBuffer 25 | * 26 | * \tparam Data DataType 27 | * \tparam Depth Depth of queue 28 | * \tparam InFlight Number of inflight entries 29 | */ 30 | template 31 | class ReorderBufWBeats : public ReorderBuf { 32 | 33 | public: 34 | ReorderBufWBeats() : ReorderBuf() {} 35 | 36 | bool canReceiveBeats() 37 | { 38 | // Beats do not have a guaranteed space in storage 39 | // since storage corresponds to vbits fifo, 40 | // we can just check that vfifo is not full 41 | return (!ReorderBuf::vbits.isFull()); 42 | } 43 | 44 | void addBeat(const Data& data) { 45 | typename ReorderBuf::EntryNum entryNum = 46 | ReorderBuf::vbits.get_tail(); 47 | ReorderBuf::storage.write(entryNum, 0, data); 48 | // so that response can be read out later 49 | ReorderBuf::vbits.push(true); 50 | } 51 | }; 52 | 53 | #endif 54 | -------------------------------------------------------------------------------- /matchlib/cmod/include/axi/AxiSlaveToReadyValid/testbench/.RVSink.h.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-acc/ESP_Systolic_Array_Accelerator/98f061fcfd9625ef97fbfc5e885e5bfb9b0c16b6/matchlib/cmod/include/axi/AxiSlaveToReadyValid/testbench/.RVSink.h.swp -------------------------------------------------------------------------------- /matchlib/cmod/include/axi/testbench/CSVFileReader.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __CSV_FILE_READER__ 18 | #define __CSV_FILE_READER__ 19 | 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | /** 33 | * \brief A helper class to read CSV files. 34 | * 35 | * The constructor takes two arguments: a string containing the filename, and an optional string containing the delimiting character (default is ','). 36 | */ 37 | class CSVFileReader { 38 | std::string fileName; 39 | std::string seperator; 40 | 41 | public: 42 | CSVFileReader(std::string filename, std::string sep = ",") 43 | : fileName(filename), seperator(sep) {} 44 | 45 | std::vector > readCSV() { 46 | std::ifstream file(fileName.c_str()); 47 | std::vector > dataList; 48 | std::string line = ""; 49 | while (getline(file, line)) { 50 | std::vector vec; 51 | boost::algorithm::split(vec, line, boost::is_any_of(seperator)); 52 | dataList.push_back(vec); 53 | } 54 | file.close(); 55 | return dataList; 56 | } 57 | }; 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /matchlib/cmod/include/match_scverify.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | 19 | /** 20 | * \file match_scverify.h 21 | * \ingroup NVHLSVerify 22 | * 23 | * When using Catapult's scverify CCS_MAIN macro, include this file instead of #include so that sc_main exists when the design is linked against the systemc library. 24 | * 25 | * \par A Simple Example of a testbench.cpp 26 | * \code 27 | * #include 28 | * 29 | * ... 30 | * 31 | * CCS_MAIN(int argc, char *argv[]) 32 | * { 33 | * CCS_RETURN(0) ; 34 | * } 35 | * \endcode 36 | * \par 37 | */ 38 | 39 | 40 | #if defined(CCS_SYSC) || !defined(CCS_SCVERIFY) 41 | extern "C" int sc_main(int argc, char *argv[]) { 42 | return -1; 43 | } 44 | #endif 45 | -------------------------------------------------------------------------------- /matchlib/cmod/include/nvhls_annotate.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NVHLS_ANNOTATE_H_ 18 | #define NVHLS_ANNOTATE_H_ 19 | 20 | #include 21 | 22 | #include 23 | 24 | namespace nvhls { 25 | void annotate_design(const sc_object &root, std::string base_name = "", std::string input_dir_path = "", std::string output_dir_path = "") { 26 | Connections::annotate_design(root, base_name, input_dir_path, output_dir_path); 27 | } 28 | } 29 | 30 | #endif // NVHLS_ANNOTATE_H_ 31 | -------------------------------------------------------------------------------- /matchlib/cmod/include/nvhls_connections.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NVHLS_CONNECTIONS_H_ 18 | #define NVHLS_CONNECTIONS_H_ 19 | 20 | #include 21 | 22 | // Include connections tree nvhls_connections.h 23 | #include 24 | 25 | // Include dependencies that we no longer include in Connections' nvhls_connections.h 26 | #include 27 | #include 28 | #include 29 | #include 30 | 31 | #include 32 | #include 33 | 34 | #endif // ifndef NVHLS_CONNECTIONS_H_ 35 | -------------------------------------------------------------------------------- /matchlib/cmod/include/nvhls_connections_utils.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NVHLS_CONNECTIONS_UTILS_H_ 18 | #define NVHLS_CONNECTIONS_UTILS_H_ 19 | 20 | #include 21 | 22 | // Map CONNECTIONS_ASSERT_MSG onto NVHLS_ASSERT_MSG to support CTC_SKIP_ASSER 23 | #define CONNECTIONS_ASSERT_MSG(X,MSG) NVHLS_ASSERT_MSG(X,MSG) 24 | #define CONNECTIONS_SIM_ONLY_ASSERT_MSG(X,MSG) CMOD_ASSERT_MSG(X,MSG) 25 | 26 | 27 | #endif // ifndef NVHLS_CONNECTIONS_UTILS_H_ 28 | -------------------------------------------------------------------------------- /matchlib/cmod/include/nvhls_marshaller.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NVHLS_MARSHALLER_H_ 18 | #define NVHLS_MARSHALLER_H_ 19 | 20 | #include 21 | 22 | #include 23 | 24 | #include 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /matchlib/cmod/include/nvhls_message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef NVHLS_MESSAGE_H_ 18 | #define NVHLS_MESSAGE_H_ 19 | 20 | #include 21 | 22 | #include 23 | 24 | class nvhls_message : public Connections::message {}; 25 | 26 | #endif 27 | -------------------------------------------------------------------------------- /matchlib/cmod/include/testbench/Pacer.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef PACER_H_ 18 | #define PACER_H_ 19 | 20 | #include 21 | 22 | #include 23 | 24 | #endif // PACER_H_ 25 | -------------------------------------------------------------------------------- /matchlib/cmod/regress_Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Integration tests with a set of existing units. 17 | 18 | DIRS = ArbiterModule \ 19 | ArbiterTop \ 20 | ArbitratedCrossbarTop \ 21 | ArbitratedScratchpadDPTop \ 22 | ArbitratedScratchpadTop \ 23 | CrossbarTop \ 24 | FifoTop \ 25 | LzdTop \ 26 | ReorderBufTop \ 27 | ScratchpadTop \ 28 | WHVCRouterTop \ 29 | axi/AxiAddWriteResp \ 30 | axi/AxiArbiter \ 31 | axi/AxiExampleTB \ 32 | axi/AxiExampleTBFromFile \ 33 | axi/AxiRemoveWriteResp \ 34 | axi/AxiSlaveToReadyValidTop \ 35 | axi/AxiSlaveToRegTop \ 36 | axi/AxiSplitter \ 37 | axi/AxiArbSplitTop \ 38 | axi/AxiAddRemoveWRespTop \ 39 | axi/AxiLiteSlaveToMemTop \ 40 | ConnectionsTop \ 41 | axi/AxiMasterGateTop \ 42 | axi/AxiSlaveToMemTop \ 43 | 44 | .PHONY: all $(DIRS) 45 | 46 | all: $(DIRS) 47 | 48 | $(DIRS): 49 | $(MAKE) -C unittests/$@ sim_clean 50 | $(MAKE) -C unittests/$@ 51 | $(MAKE) -C unittests/$@ run 52 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/.gitignore: -------------------------------------------------------------------------------- 1 | sim_* 2 | *log 3 | *.output.json 4 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/.p4ignore: -------------------------------------------------------------------------------- 1 | sim_* 2 | *log 3 | *.output.json 4 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbiterModule/ArbiterModule.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef ARBITER_MODULE_H 17 | #define ARBITER_MODULE_H 18 | 19 | #include 20 | 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | 27 | #ifndef NUM_INPUTS 28 | #define NUM_INPUTS 5 29 | #endif 30 | 31 | class ArbiterModule : public sc_module { 32 | public: 33 | typedef Arbiter arbiter_t; 34 | typedef arbiter_t::Mask mask_t; 35 | sc_in_clk clk; 36 | sc_in rst; 37 | 38 | Connections::In valid_in; 39 | Connections::Out select_out; 40 | enum { 41 | width = 0 42 | }; 43 | 44 | arbiter_t arbiter; 45 | 46 | void Process(); 47 | 48 | SC_HAS_PROCESS(ArbiterModule); 49 | ArbiterModule(sc_module_name name) 50 | : sc_module(name), clk("clk"), rst("rst"), valid_in("valid_in"), 51 | select_out("select_out") { 52 | SC_THREAD(Process); 53 | sensitive << clk.pos(); 54 | NVHLS_NEG_RESET_SIGNAL_IS(rst); 55 | }; 56 | }; 57 | 58 | void ArbiterModule::Process() { 59 | valid_in.Reset(); 60 | select_out.Reset(); 61 | wait(); 62 | 63 | #pragma hls_pipeline_init_interval 1 64 | while (1) { 65 | mask_t valid_reg; 66 | mask_t select_reg; 67 | 68 | if (valid_in.PopNB(valid_reg)){ 69 | select_reg = arbiter.pick(valid_reg); 70 | select_out.Push(select_reg); 71 | } 72 | wait(); 73 | } 74 | } 75 | 76 | 77 | #endif 78 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbiterModule/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbiterTop/ArbiterTop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "ArbiterTop.h" 21 | 22 | void ArbiterTop(const mask_t& valid, mask_t& select) { 23 | static arbiter_t arbiter; 24 | select = arbiter.pick(valid); 25 | } 26 | 27 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbiterTop/ArbiterTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef ARBITER_TOP_H 17 | #define ARBITER_TOP_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #ifndef NUM_INPUTS 25 | #define NUM_INPUTS 5 26 | #endif 27 | 28 | #ifndef ARBITER_TYPE 29 | #define ARBITER_TYPE Roundrobin 30 | #endif 31 | 32 | typedef Arbiter arbiter_t; 33 | typedef arbiter_t::Mask mask_t; 34 | 35 | void ArbiterTop(const mask_t& valid, mask_t& select); 36 | 37 | #endif 38 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbiterTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | sim_test1: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 20 | $(CC) -o sim_test1 -DNUM_INPUTS=5 -DARBITER_TYPE=Roundrobin $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 21 | 22 | sim_test2: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 23 | $(CC) -o sim_test2 -DNUM_INPUTS=1 -DARBITER_TYPE=Roundrobin $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 24 | 25 | sim_test3: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 26 | $(CC) -o sim_test3 -DNUM_INPUTS=5 -DARBITER_TYPE=Static $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | run1: 29 | ./sim_test1 30 | run2: 31 | ./sim_test2 32 | run3: 33 | ./sim_test3 34 | 35 | cov1: 36 | make cov COV_XML=coverage1.xml MAKE_TARGET="sim_test1 run1" 37 | cov2: 38 | make cov COV_XML=coverage2.xml MAKE_TARGET="sim_test2 run2" 39 | cov3: 40 | make cov COV_XML=coverage3.xml MAKE_TARGET="sim_test3 run3" 41 | 42 | merge_cov: CC = $(CTC) $(CC_) 43 | merge_cov: cov1 cov2 cov3 44 | ctcxmlmerge \ 45 | coverage1.xml coverage2.xml coverage3.xml \ 46 | -x coverage_merged.xml \ 47 | -p coverage_profile.txt 48 | ctc2html \ 49 | -i coverage_profile.txt \ 50 | -o web-report 51 | 52 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedCrossbarTop/ArbitratedCrossbarTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ARBITRATED_CROSSBAR_TOP_H 18 | #define ARBITRATED_CROSSBAR_TOP_H 19 | 20 | #include 21 | #include 22 | 23 | typedef NVUINT16 Word_t; 24 | #ifndef NUM_INPUTS 25 | #define NUM_INPUTS 4 26 | #endif 27 | 28 | #ifndef NUM_OUTPUTS 29 | #define NUM_OUTPUTS 8 30 | #endif 31 | 32 | #ifndef LEN_INPUT_BUFFER 33 | #define LEN_INPUT_BUFFER 4 34 | #endif 35 | 36 | #ifndef LEN_OUTPUT_BUFFER 37 | #define LEN_OUTPUT_BUFFER 2 38 | #endif 39 | 40 | typedef Word_t DataInArray[NUM_INPUTS]; 41 | typedef Word_t DataOutArray[NUM_OUTPUTS]; 42 | static const int log2_outputs = nvhls::index_width::val; 43 | typedef NVUINTW(log2_outputs) OutputIdx; 44 | typedef OutputIdx OutputIdxArray[NUM_INPUTS]; 45 | typedef bool ReadyArray[NUM_INPUTS]; 46 | typedef bool ValidInArray[NUM_INPUTS]; 47 | typedef bool ValidOutArray[NUM_OUTPUTS]; 48 | typedef bool ReadyArray[NUM_INPUTS]; 49 | 50 | void ArbitratedCrossbarTop(DataInArray data_in, OutputIdxArray dest_in, 51 | ValidInArray valid_in, DataOutArray data_out, 52 | ValidOutArray valid_out, ReadyArray ready); 53 | #endif // end ARBITRATED_CROSSBAR_TOP_H 54 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedCrossbarTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | sim_test1: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 20 | $(CC) -o sim_test1 -DNUM_INPUTS=4 -DNUM_OUTPUTS=4 -DLEN_INPUT_BUFFER=1 -DLEN_OUTPUT_BUFFER=1 $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 21 | 22 | sim_test2: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 23 | $(CC) -o sim_test2 -DSKIP_LV2TYPE -DNUM_INPUTS=4 -DNUM_OUTPUTS=4 -DLEN_INPUT_BUFFER=4 -DLEN_OUTPUT_BUFFER=0 $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 24 | 25 | sim_test3: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 26 | $(CC) -o sim_test3 -DNUM_INPUTS=4 -DNUM_OUTPUTS=4 -DLEN_INPUT_BUFFER=0 -DLEN_OUTPUT_BUFFER=0 $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | run1: 29 | ./sim_test1 30 | run2: 31 | ./sim_test2 32 | run3: 33 | ./sim_test3 34 | 35 | cov1: 36 | make cov COV_XML=coverage1.xml MAKE_TARGET="sim_test1 run1" 37 | cov2: 38 | make cov COV_XML=coverage2.xml MAKE_TARGET="sim_test2 run2" 39 | 40 | merge_cov: CC = $(CTC) $(CC_) 41 | merge_cov: cov1 cov2 42 | ctcxmlmerge \ 43 | coverage1.xml coverage2.xml \ 44 | -x coverage_merged.xml \ 45 | -p coverage_profile.txt 46 | ctc2html \ 47 | -i coverage_profile.txt \ 48 | -o web-report 49 | 50 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedScratchpadDPTop/ArbitratedScratchpadDPTop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #include 18 | #include "ArbitratedScratchpadDPTop.h" 19 | 20 | void ArbitratedScratchpadDPTop(Address read_address[NUM_READ_PORTS], bool read_req_valid[NUM_READ_PORTS], 21 | Address write_address[NUM_WRITE_PORTS], bool write_req_valid[NUM_WRITE_PORTS], 22 | DATA_TYPE write_data[NUM_WRITE_PORTS], 23 | bool read_ack[NUM_READ_PORTS], bool write_ack[NUM_WRITE_PORTS], 24 | DATA_TYPE port_read_out[NUM_READ_PORTS], bool port_read_out_valid[NUM_READ_PORTS]) { 25 | typedef ArbitratedScratchpadDP scratchpad_t; 26 | static scratchpad_t scratchpad_inst; 27 | bool read_ready[NUM_READ_PORTS]; 28 | scratchpad_inst.run(read_address, read_req_valid, 29 | write_address, write_req_valid, write_data, 30 | read_ack, write_ack, read_ready, 31 | port_read_out, port_read_out_valid); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedScratchpadDPTop/ArbitratedScratchpadDPTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __ARBITRATEDSCRATCHPADDP_TOP__ 18 | #define __ARBITRATEDSCRATCHPADDP_TOP__ 19 | 20 | #include 21 | 22 | 23 | #ifndef NUM_READ_PORTS 24 | #define NUM_READ_PORTS 4 25 | #endif 26 | 27 | #ifndef NUM_WRITE_PORTS 28 | #define NUM_WRITE_PORTS 4 29 | #endif 30 | 31 | 32 | #ifndef NUM_BANKS 33 | #define NUM_BANKS 4 34 | #endif 35 | 36 | #ifndef NUM_ENTRIES_PER_BANK 37 | #define NUM_ENTRIES_PER_BANK 64 38 | #endif 39 | 40 | #ifndef DATA_TYPE 41 | #define DATA_TYPE NVUINT32 42 | #endif 43 | 44 | const unsigned int kNumBanks = NUM_BANKS; 45 | const unsigned int kNumReadPorts = NUM_READ_PORTS; 46 | const unsigned int kNumWritePorts = NUM_WRITE_PORTS; 47 | const unsigned int kEntriesPerBank = NUM_ENTRIES_PER_BANK; 48 | const unsigned int kAddressSize = nvhls::index_width::val; 49 | typedef NVUINTW(kAddressSize) Address; 50 | 51 | void ArbitratedScratchpadDPTop(Address read_address[NUM_READ_PORTS], bool read_req_valid[NUM_READ_PORTS], 52 | Address write_address[NUM_WRITE_PORTS], bool write_req_valid[NUM_WRITE_PORTS], 53 | DATA_TYPE write_data[NUM_WRITE_PORTS], 54 | bool read_ack[NUM_READ_PORTS], bool write_ack[NUM_WRITE_PORTS], 55 | DATA_TYPE port_read_out[NUM_READ_PORTS], bool port_read_out_valid[NUM_READ_PORTS]); 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedScratchpadDPTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedScratchpadTop/ArbitratedScratchpadConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ARBITRATED_SCRATCHPAD_TOP_CONFIG_H 18 | #define ARBITRATED_SCRATCHPAD_TOP_CONFIG_H 19 | 20 | #include "nvhls_int.h" 21 | #include "nvhls_types.h" 22 | #include "ArbitratedScratchpad/ArbitratedScratchpadTypes.h" 23 | 24 | #ifndef DATA_TYPE 25 | #define DATA_TYPE NVUINT32 26 | #endif 27 | 28 | #ifndef NUM_BANK_ENTRIES 29 | #define NUM_BANK_ENTRIES 256 30 | #endif 31 | 32 | #ifndef NUM_BANKS 33 | #define NUM_BANKS 4 34 | #endif 35 | 36 | #ifndef NUM_INPUTS 37 | #define NUM_INPUTS NUM_BANKS*2 38 | #endif 39 | 40 | #ifndef LEN_INPUT_BUFFER 41 | #define LEN_INPUT_BUFFER 0 42 | #endif 43 | 44 | const unsigned NumBanks = NUM_BANKS; 45 | const unsigned ScratchpadCapacity = NUM_BANKS * NUM_BANK_ENTRIES; 46 | const unsigned ScratchpadAddrWidth = nvhls::nbits::val; 47 | const unsigned NumInputs = NUM_INPUTS; 48 | const unsigned InputQueueLength = LEN_INPUT_BUFFER; 49 | const unsigned RefMemSizeInBytes = 16 * 1024 * 1024; 50 | 51 | typedef DATA_TYPE DataType; 52 | 53 | // client request and response types with TB parameters 54 | typedef cli_req_t tb_cli_req_t; 55 | typedef cli_rsp_t tb_cli_rsp_t; 56 | 57 | #endif // end ARBITRATED_SCRATCHPAD_TOP_CONFIG_H 58 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedScratchpadTop/ArbitratedScratchpadTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef ARBITRATED_SCRATCHPAD_TOP_H 18 | #define ARBITRATED_SCRATCHPAD_TOP_H 19 | 20 | #include 21 | #include 22 | #include "ArbitratedScratchpadConfig.h" 23 | 24 | void ArbitratedScratchpadTop(tb_cli_req_t& curr_cli_req, 25 | tb_cli_rsp_t& curr_cli_rsp, 26 | bool ready[NumInputs]); 27 | 28 | #endif // end ARBITRATED_SCRATCHPAD_TOP_H 29 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ArbitratedScratchpadTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | CFLAGS = -DHLS_ALGORITHMICC -DDATA_TYPE=NVUINT32 -DNUM_BANK_ENTRIES=256 -DNUM_BANKS=2 -DNUM_INPUTS=4 -DLEN_INPUT_BUFFER=4 18 | include ../unittests_Makefile 19 | 20 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ConnectionsTop/.gitignore: -------------------------------------------------------------------------------- 1 | sim_* 2 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ConnectionsTop/.p4ignore: -------------------------------------------------------------------------------- 1 | sim_* 2 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/CrossbarTop/CrossbarTop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include "CrossbarTop.h" 21 | 22 | void CrossbarTop( 23 | DATA_TYPE data_in[NUM_INPUTS], 24 | #ifndef NO_XBAR_VALID_IN_OUT 25 | bool valid_in[NUM_INPUTS], 26 | #endif 27 | NVUINTC(nvhls::nbits::val) source[NUM_OUTPUTS], 28 | #ifndef NO_XBAR_VALID_SOURCE 29 | bool valid_source[NUM_OUTPUTS], 30 | #endif 31 | DATA_TYPE data_out[NUM_OUTPUTS] 32 | #ifndef NO_XBAR_VALID_IN_OUT 33 | ,bool valid_out[NUM_OUTPUTS] 34 | #endif 35 | ) 36 | { 37 | 38 | crossbar( 39 | data_in, 40 | #ifndef NO_XBAR_VALID_IN_OUT 41 | valid_in, 42 | #endif 43 | source, 44 | #ifndef NO_XBAR_VALID_SOURCE 45 | valid_source, 46 | #endif 47 | data_out 48 | #ifndef NO_XBAR_VALID_IN_OUT 49 | ,valid_out 50 | #endif 51 | ); 52 | } 53 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/CrossbarTop/CrossbarTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef CROSSBAR_TOP_H 17 | #define CROSSBAR_TOP_H 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | 24 | #ifndef NUM_INPUTS 25 | #define NUM_INPUTS 4 26 | #endif 27 | 28 | #ifndef NUM_OUTPUTS 29 | #define NUM_OUTPUTS 8 30 | #endif 31 | 32 | #ifndef DATA_TYPE 33 | #define DATA_TYPE NVINT32 34 | #endif 35 | 36 | void CrossbarTop( 37 | DATA_TYPE data_in[NUM_INPUTS], 38 | #ifndef NO_XBAR_VALID_IN_OUT 39 | bool valid_in[NUM_INPUTS], 40 | #endif 41 | NVUINTC(nvhls::nbits::val) source[NUM_OUTPUTS], 42 | #ifndef NO_XBAR_VALID_SOURCE 43 | bool valid_source[NUM_OUTPUTS], 44 | #endif 45 | DATA_TYPE data_out[NUM_OUTPUTS] 46 | #ifndef NO_XBAR_VALID_IN_OUT 47 | ,bool valid_out[NUM_OUTPUTS] 48 | #endif 49 | ); 50 | 51 | 52 | #endif 53 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/CrossbarTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | sim_test1: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 20 | $(CC) -o sim_test1 $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 21 | 22 | sim_test2: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 23 | $(CC) -o sim_test2 -DNO_XBAR_VALID_SOURCE $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 24 | 25 | sim_test3: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 26 | $(CC) -o sim_test3 -DNO_XBAR_VALID_SOURCE -DNO_XBAR_VALID_IN_OUT $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 27 | 28 | run1: 29 | ./sim_test1 30 | run2: 31 | ./sim_test2 32 | run3: 33 | ./sim_test3 34 | 35 | cov1: 36 | make cov COV_XML=coverage1.xml MAKE_TARGET="sim_test1 run1" 37 | cov2: 38 | make cov COV_XML=coverage2.xml MAKE_TARGET="sim_test2 run2" 39 | cov3: 40 | make cov COV_XML=coverage3.xml MAKE_TARGET="sim_test3 run3" 41 | 42 | merge_cov: CC = $(CTC) $(CC_) 43 | merge_cov: cov1 cov2 cov3 44 | ctcxmlmerge \ 45 | coverage1.xml coverage2.xml coverage3.xml \ 46 | -x coverage_merged.xml \ 47 | -p coverage_profile.txt 48 | ctc2html \ 49 | -i coverage_profile.txt \ 50 | -o web-report 51 | 52 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/FifoTop/FifoTop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include 19 | #include "FifoTop.h" 20 | 21 | void FifoTop( const OpType& op, const DataType& data, const BankIdx& idx, OutType& out) 22 | { 23 | static Fifo_ fifo; 24 | out = 0; 25 | NVHLS_ASSERT_MSG(idx < NUM_BANKS, "Bank_index_is_less_than_number_of_banks"); 26 | switch (op) 27 | { 28 | case push: fifo.push(data, idx); break; 29 | case pop: out = fifo.pop(idx); break; 30 | case incrHead: fifo.incrHead(idx); break; 31 | case peek: out = fifo.peek(idx); break; 32 | case isEmpty: out = fifo.isEmpty(idx); break; 33 | case isFull: out = fifo.isFull(idx); break; 34 | case reset: fifo.reset(); break; 35 | case get_head: out = fifo.get_head(idx); break; 36 | case get_tail: out = fifo.get_tail(idx); break; 37 | default: 38 | NVHLS_ASSERT_MSG(0, "op_not_supported"); 39 | fifo.reset(); break; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/FifoTop/FifoTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef FIFO_TOP_H 17 | #define FIFO_TOP_H 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #ifndef FIFO_LENGTH 24 | #define FIFO_LENGTH 3 25 | #endif 26 | 27 | #ifndef WORD_WIDTH 28 | #define WORD_WIDTH 16 29 | #endif 30 | 31 | #ifndef NUM_BANKS 32 | #define NUM_BANKS 4 33 | #endif 34 | 35 | 36 | typedef NVUINTC(WORD_WIDTH) MemWord_t; 37 | 38 | 39 | enum FifoOp { 40 | push=0, 41 | pop, 42 | incrHead, 43 | peek, 44 | isEmpty, 45 | isFull, 46 | reset, 47 | get_head, 48 | get_tail, 49 | MAXOP 50 | }; 51 | 52 | typedef FIFO Fifo_; 53 | typedef MemWord_t DataType; 54 | typedef Fifo_::FifoIdx FifoIdx; 55 | typedef DataType OutType; 56 | typedef Fifo_::BankIdx BankIdx; 57 | typedef NVUINTC(nvhls::nbits::val) OpType; 58 | 59 | void FifoTop( const OpType& op, const DataType& data, const BankIdx& idx, OutType& out); 60 | 61 | #endif 62 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/FifoTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/LzdTop/LzdTop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include 19 | #include "LzdTop.h" 20 | 21 | void LzdTop(const Data& in, Count& out) { 22 | out = nvhls::lzd(in); 23 | } 24 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/LzdTop/LzdTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef LZD_TOP_H 17 | #define LZD_TOP_H 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #ifndef NUM_BITS 24 | #define NUM_BITS 32 25 | #endif 26 | 27 | typedef NVUINTC(NUM_BITS) Data; 28 | typedef NVUINTC(nvhls::nbits::val) Count; 29 | 30 | 31 | void LzdTop(const Data& in, Count& out); 32 | 33 | 34 | #endif 35 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/LzdTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/LzdTop/testbench.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include 19 | 20 | #include "LzdTop.h" 21 | 22 | #ifndef NUM_ITERS 23 | #define NUM_ITERS 1000 24 | #endif 25 | 26 | Data semi_random() 27 | { 28 | Data data = rand(); 29 | 30 | if (rand()&0x1) { 31 | //return as is 32 | return data; 33 | } 34 | 35 | if (rand()&0x1) { 36 | return data>>(rand()%NUM_BITS); 37 | } else { 38 | return data<<(rand()%NUM_BITS); 39 | } 40 | 41 | } 42 | 43 | Count reference_lzd(const Data& in) 44 | { 45 | for (int i = 0; i < NUM_BITS; ++i) 46 | { 47 | if (in[NUM_BITS-1-i] != 0) return i; 48 | } 49 | return (NUM_BITS-1); 50 | } 51 | 52 | 53 | 54 | CCS_MAIN(int argc, char *argv[]) 55 | { 56 | nvhls::set_random_seed(); 57 | 58 | for (int i =0; i < NUM_ITERS; ++i) 59 | { 60 | 61 | Data data = semi_random(); 62 | Count count, count_ref; 63 | 64 | CCS_DESIGN(LzdTop)(data, count); 65 | count_ref = reference_lzd(data); 66 | assert(count == count_ref); 67 | } 68 | 69 | DCOUT("CMODEL PASS" << endl); 70 | CCS_RETURN(0) ; 71 | } 72 | 73 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/NVRC_MOD_LIB: -------------------------------------------------------------------------------- 1 | This file (NVRC_MOD_LIB) indicates a root of MOD_PATH for nested cmod/. Muiltiple NVRC_MOD_LIBs can exists. -------------------------------------------------------------------------------- /matchlib/cmod/unittests/NVRC_MOD_LIB_IGNORE: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-acc/ESP_Systolic_Array_Accelerator/98f061fcfd9625ef97fbfc5e885e5bfb9b0c16b6/matchlib/cmod/unittests/NVRC_MOD_LIB_IGNORE -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ReorderBufTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ReorderBufTop/ReorderBufTop.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include 17 | #include 18 | #include 19 | #include "ReorderBufTop.h" 20 | 21 | void ReorderBufTop( const OpType& op, 22 | const DataType& in_data, 23 | const Rob::Id& in_id, 24 | Rob::Id& out_id, 25 | DataType& out_data, 26 | bool& out_resp) 27 | { 28 | static Rob rob; 29 | out_id = 0; out_resp = false; out_data =0; 30 | switch (op) 31 | { 32 | case canAccept: out_resp = rob.canAcceptRequest(); break; 33 | case addRequest: out_id = rob.addRequest(); break; 34 | case top: out_resp = rob.topResponseReady(); break; 35 | case addResponse: rob.addResponse(in_id, in_data);break; 36 | case popResponse: out_data = rob.popResponse(); break; 37 | case reset: rob.reset(); break; 38 | case isEmpty: out_resp = rob.isEmpty(); break; 39 | default: 40 | NVHLS_ASSERT_MSG(0, "op_not_supported"); //never get here 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ReorderBufTop/ReorderBufTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef REORDERBUF_TOP_H 18 | #define REORDERBUF_TOP_H 19 | 20 | #include 21 | #include 22 | #include 23 | 24 | #ifndef ROB_DATA 25 | #define ROB_DATA NVUINTC(16) 26 | #endif 27 | 28 | #ifndef ROB_DEPTH 29 | #define ROB_DEPTH 6 30 | #endif 31 | 32 | #ifndef ROB_INFLIGHT 33 | #define ROB_INFLIGHT 3 34 | #endif 35 | 36 | 37 | enum RobOp { 38 | canAccept=0, 39 | addRequest, 40 | top, 41 | addResponse, 42 | popResponse, 43 | reset, 44 | isEmpty, 45 | MAXOP 46 | }; 47 | 48 | typedef ROB_DATA DataType; 49 | typedef ReorderBuf Rob; 50 | typedef NVUINTC(nvhls::nbits::val) OpType; 51 | 52 | void ReorderBufTop( const OpType& op, 53 | const DataType& in_data, 54 | const Rob::Id& in_id, 55 | Rob::Id& out_id, 56 | DataType& out_data, 57 | bool& out_resp); 58 | 59 | #endif 60 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ScratchpadTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | 18 | include ../unittests_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ScratchpadTop/ScratchpadConfig.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef SCRATCHPAD_CONFIG_H 17 | #define SCRATCHPAD_CONFIG_H 18 | 19 | #include 20 | 21 | 22 | #define REF_MEM_SIZE_IN_BYTES 16 * 1024 * 1024 23 | 24 | // These are defines that scripts will over-ride at the command line to test the scratchpad 25 | #ifndef SCRATCHPAD_BANKS 26 | #define SCRATCHPAD_BANKS 4 27 | #endif 28 | #ifndef SCRATCHPAD_CAPACITY 29 | #define SCRATCHPAD_CAPACITY SCRATCHPAD_BANKS * 256 30 | #endif 31 | #define SCRATCHPAD_ADDR_WIDTH nvhls::nbits::val 32 | 33 | 34 | // Some convenience typedefs 35 | typedef NVUINT32 data32_t; // Data returned to the client. 36 | 37 | 38 | #endif 39 | 40 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/ScratchpadTop/ScratchpadTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef SC_SCRATCHPAD_TOP_H 17 | #define SC_SCRATCHPAD_TOP_H 18 | 19 | #include 20 | #include "ScratchpadConfig.h" 21 | 22 | //Wrapper module for scratchpad. Wrapper module is required to get Catapult SCVERIFY working 23 | SC_MODULE (ScratchpadTop) { 24 | public: 25 | sc_in_clk clk ; // Clock input of the design 26 | sc_in rst ; // active high, synchronous Reset input 27 | static const int N = SCRATCHPAD_BANKS; 28 | static const int CAPACITY_IN_BYTES = SCRATCHPAD_CAPACITY ; 29 | static const int ADDR_WIDTH = SCRATCHPAD_ADDR_WIDTH; 30 | Connections::In< cli_req_t > cli_req; 31 | Connections::Out< cli_rsp_t > cli_rsp; 32 | Scratchpad myscratchpad; 33 | 34 | SC_HAS_PROCESS(ScratchpadTop); 35 | ScratchpadTop(sc_module_name name) : sc_module(name), 36 | clk("clk"), 37 | rst("rst"), 38 | cli_req("cli_req"), 39 | cli_rsp("cli_rsp"), 40 | myscratchpad("myscratchpad") 41 | { 42 | // Connect the DUT 43 | myscratchpad.clk(clk); 44 | myscratchpad.rst(rst); 45 | myscratchpad.cli_req(cli_req); 46 | myscratchpad.cli_rsp(cli_rsp); 47 | } 48 | 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/VectorUnit/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../unittests_Makefile 18 | 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/VectorUnit/VectorUnit.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #include "VectorUnit.h" 17 | 18 | void VectorUnit( const OpType& op, 19 | const InVectorType& in1, 20 | const InVectorType& in2, 21 | const InVectorType& in3, 22 | OutVectorType& out) 23 | { 24 | switch (op) 25 | { 26 | case Mul: nvhls::vector_mul (in1, in2, out); break; 27 | case Add: nvhls::vector_add (in1, in2, out); break; 28 | case Sub: nvhls::vector_sub (in1, in2, out); break; 29 | case Reduction: nvhls::reduction(in1,out[0]); break; 30 | case DP: nvhls::dp(in1, in2, out[0]); break; 31 | case MAC: nvhls::vector_mac(in1, in2, in3, out); break; 32 | case DPACC: nvhls::dpacc(in1, in2, in3[0], out[0]); break; 33 | default: 34 | NVHLS_ASSERT_MSG(0, "op_not_supported"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/VectorUnit/VectorUnit.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef VECTOR_UNIT_H 17 | #define VECTOR_UNIT_H 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #ifndef VECTOR_LENGTH 24 | #define VECTOR_LENGTH 8 25 | #endif 26 | 27 | typedef NVUINT8 InScalarType; 28 | typedef NVUINT32 OutScalarType; 29 | typedef nvhls::nv_scvector InVectorType; 30 | typedef nvhls::nv_scvector OutVectorType; 31 | 32 | enum VectorOp { 33 | Mul=0, 34 | Add, 35 | Sub, 36 | Reduction, 37 | DP, 38 | MAC, 39 | DPACC, 40 | MAXOP 41 | }; 42 | 43 | typedef NVUINTC(nvhls::nbits::val) OpType; 44 | 45 | void VectorUnit( const OpType& op, 46 | const InVectorType& in1, 47 | const InVectorType& in2, 48 | const InVectorType& in3, 49 | OutVectorType& out); 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/WHVCRouterTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | USER_FLAGS += -DDISABLE_PACER 18 | include ../unittests_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/WHVCRouterTop/README: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | SystemC Connections interface design of WHVCRouter with support for one or more virtual channels. 18 | (1) To simulate the design with one virtual channel: 19 | - Set NUM_VCHANNELS = 1 20 | - Do not define PACKETIDWIDTH 21 | (2) To simulate the design with two virtual channels: 22 | - Set NUM_VCHANNELS = 2 23 | - Set PACKETIDWIDTH = 1 24 | 25 | The design, by default, supports only unicast routing. Define ENABLE_MULTICAST to enable support for multicast routing. 26 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiAddRemoveWRespTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../unittests_Makefile 18 | 19 | # Without write responses there is no way to prevent a bad seed 20 | # that will stall writes in the TB so that reads overtake them. 21 | USER_FLAGS += -DRAND_SEED=1000 22 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiAddWriteResp/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../unittests_Makefile 18 | 19 | # Without write responses there is no way to prevent a bad seed 20 | # that will stall writes in the TB so that reads overtake them. 21 | USER_FLAGS += -DRAND_SEED=1000 22 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiArbSplitTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../unittests_Makefile 18 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiArbiter/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | 18 | include ../../unittests_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiExampleTB/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../unittests_Makefile 18 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiExampleTBFromFile/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2020, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | USER_FLAGS += -Wno-unused-local-typedefs 18 | 19 | all: sim_test sim_test_interrupts 20 | 21 | include ../../../cmod_Makefile 22 | 23 | sim_test: testbench.cpp $(wildcard *.h) $(wildcard $(CWD)/../include/*.h) 24 | $(CC) -o $@ $(CFLAGS) $(USER_FLAGS) -I../../../include $< $(BOOSTLIBS) $(LIBS) 25 | 26 | sim_test_interrupts: testbench_interrupts.cpp $(wildcard *.h) $(wildcard $(CWD)/../include/*.h) 27 | $(CC) -o $@ $(CFLAGS) $(USER_FLAGS) -I../../../include $< $(BOOSTLIBS) $(LIBS) 28 | 29 | run: 30 | ./sim_test 31 | ./sim_test_interrupts 32 | 33 | sim_clean: 34 | rm -rf *.o sim_* 35 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiExampleTBFromFile/mem.csv: -------------------------------------------------------------------------------- 1 | 0x20000,0xFFFF0000CCCC8888 2 | 0x1234FDEC,0x0000c18c18c18c18 3 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiExampleTBFromFile/requests.csv: -------------------------------------------------------------------------------- 1 | 0,W,0x10000,0xf00dcafe12345678 2 | 100,R,0x10000,0xf00dcafe12345678 3 | 0,R,0x20000,0xFFFF0000CCCC8888 4 | 0,R,0x1234FDEC,0x0000c18c18c18c18 5 | 100,W,0x4008,0x0000000080000000 6 | 500,R,0x4008,0x0000000080000000 7 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiExampleTBFromFile/requests_q.csv: -------------------------------------------------------------------------------- 1 | 0,W,0x10000,0xf00dcafe12345678 2 | 100,R,0x10000,0xf00dcafe12345678 3 | 0,R,0x20000,0xFFFF0000CCCC8888 4 | 0,R,0x1234FDEC,0x0000c18c18c18c18 5 | 100,W,0x4008,0x0000000080000000 6 | 0,Q,0,0 7 | 500,R,0x4008,0x0000000080000000 8 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiLiteSlaveToMemTop/AxiLiteSlaveToMemTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef AXI_LITE_SLAVE_TO_MEM_TOP_H 17 | #define AXI_LITE_SLAVE_TO_MEM_TOP_H 18 | 19 | #include 20 | #include 21 | 22 | #include 23 | 24 | class AxiLiteSlaveToMemTop : public sc_module { 25 | public: 26 | static const int kDebugLevel = 4; 27 | typedef typename axi::axi4 axi_; 28 | 29 | sc_in clk; 30 | sc_in reset_bar; 31 | 32 | typename axi_::read::template slave<> axi_read; 33 | typename axi_::write::template slave<> axi_write; 34 | 35 | AxiLiteSlaveToMem<2 * 1024> slave; 36 | 37 | SC_HAS_PROCESS(AxiLiteSlaveToMemTop); 38 | 39 | AxiLiteSlaveToMemTop(sc_module_name name) 40 | : sc_module(name), 41 | clk("clk"), 42 | reset_bar("reset_bar"), 43 | axi_read("axi_read"), 44 | axi_write("axi_write"), 45 | slave("slave") 46 | { 47 | slave.clk(clk); 48 | slave.reset_bar(reset_bar); 49 | 50 | slave.if_rd(axi_read); 51 | slave.if_wr(axi_write); 52 | } 53 | }; 54 | 55 | #endif 56 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiLiteSlaveToMemTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | 18 | include ../../unittests_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiMasterGateTop/AxiMasterGateTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | #ifndef __AXIMASTERGATETOP_H__ 18 | #define __AXIMASTERGATETOP_H__ 19 | 20 | #include 21 | #include 22 | 23 | SC_MODULE(AxiMasterGateTop) { 24 | 25 | private: 26 | AxiMasterGate gate; 27 | 28 | public: 29 | typedef axi::axi4 axi4_; 30 | 31 | typename axi4_::read::template master<> if_rd; 32 | typename axi4_::write::template master<> if_wr; 33 | 34 | sc_in reset_bar; 35 | sc_in clk; 36 | Connections::In > wrRequestIn; 37 | Connections::Out > wrRespOut; 38 | Connections::In > rdRequestIn; 39 | Connections::Out > rdRespOut; 40 | 41 | SC_CTOR(AxiMasterGateTop) 42 | : gate("gate"), 43 | if_rd("if_rd"), 44 | if_wr("if_wr"), 45 | reset_bar("reset_bar"), 46 | clk("clk") { 47 | gate.clk(clk); 48 | gate.reset_bar(reset_bar); 49 | 50 | gate.if_rd(if_rd); 51 | gate.if_wr(if_wr); 52 | 53 | gate.wrRequestIn(wrRequestIn); 54 | gate.wrRespOut(wrRespOut); 55 | gate.rdRequestIn(rdRequestIn); 56 | gate.rdRespOut(rdRespOut); 57 | } 58 | }; 59 | 60 | #endif 61 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiMasterGateTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../unittests_Makefile 18 | 19 | # The tetstbench is not very sophisticated, so certain random seeds 20 | # will cause reads to overtake writes. 21 | USER_FLAGS += -DRAND_SEED=1000 22 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiRemoveWriteResp/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../../unittests_Makefile 18 | 19 | # Without write responses there is no way to prevent a bad seed 20 | # that will stall writes in the TB so that reads overtake them. 21 | USER_FLAGS += -DRAND_SEED=1000 22 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiSlaveToMemTop/AxiSlaveToMemTop.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | #ifndef AXI_SLAVE_TO_MEM_TOP_H 17 | #define AXI_SLAVE_TO_MEM_TOP_H 18 | 19 | #include 20 | #include 21 | #include 22 | 23 | #include 24 | 25 | class AxiSlaveToMemTop : public sc_module { 26 | public: 27 | static const int kDebugLevel = 4; 28 | typedef typename axi::axi4 axi_; 29 | 30 | sc_in clk; 31 | sc_in reset_bar; 32 | 33 | typename axi_::read::template slave<> axi_read; 34 | typename axi_::write::template slave<> axi_write; 35 | 36 | AxiSlaveToMem slave; 37 | 38 | SC_HAS_PROCESS(AxiSlaveToMemTop); 39 | 40 | AxiSlaveToMemTop(sc_module_name name) 41 | : sc_module(name), 42 | clk("clk"), 43 | reset_bar("reset_bar"), 44 | axi_read("axi_read"), 45 | axi_write("axi_write"), 46 | slave("slave") 47 | { 48 | slave.clk(clk); 49 | slave.reset_bar(reset_bar); 50 | 51 | slave.if_rd(axi_read); 52 | slave.if_wr(axi_write); 53 | } 54 | }; 55 | 56 | #endif 57 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiSlaveToMemTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | 18 | USER_FLAGS += -DDEBUG_LEVEL=1 19 | include ../../unittests_Makefile 20 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiSlaveToReadyValidTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | 18 | include ../../unittests_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiSlaveToRegTop/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | 18 | include ../../unittests_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/axi/AxiSplitter/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2017-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | 18 | include ../../unittests_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/cmod/unittests/unittests_Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | CWD := $(dir $(word $(words $(MAKEFILE_LIST)),$(MAKEFILE_LIST))) 18 | include $(CWD)/../cmod_Makefile 19 | 20 | all: sim_test 21 | 22 | sim_test: $(wildcard *.h) $(wildcard *.cpp) $(wildcard $(CWD)/../include/*.h) 23 | $(CC) -o sim_test $(CFLAGS) $(USER_FLAGS) -I$(CWD)/../include $(wildcard *.cpp) $(BOOSTLIBS) $(LIBS) 24 | 25 | run: 26 | ./sim_test 27 | 28 | sim_clean: 29 | rm -rf *.o sim_* 30 | 31 | -------------------------------------------------------------------------------- /matchlib/connections/LICENSE: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | -------------------------------------------------------------------------------- /matchlib/connections/README.md: -------------------------------------------------------------------------------- 1 | Connections 2 | ======== 3 | Connections is a SystemC library implementing latency-insensitive channels for use by 4 | high-level synthesis tools. 5 | 6 | Doxygen-generated documentation can be found [here](https://NVlabs.github.io/matchlib/). 7 | Additional documentation on the Connections 8 | latency-insensitive channel implementation can be found in the [Connections Guide](doc/connections-guide.pdf). 9 | 10 | Connections has been used as a component of the [MatchLib](https://github.com/NVlabs/matchlib) hardware component library. 11 | For more documentation about compiling and running Connections components, see the MatchLib documentation. 12 | 13 | # Contributors 14 | 15 | Connections was originally part of the MatchLib project of [NVIDIA Research](https://research.nvidia.com). 16 | 17 | Contributors to the initial open-source release (alphabetical): Jason Clemons, Christopher Fletcher, Davide Giri, Ben Keller, Brucek Khailany, Alicia Klinefelter, Evgeni Krimer, Hyoukjun Kwon, Ziyun Li, Michael Pellauer, Nathaniel Pinckney, Antonio Puglielli, Sophia Shao, Shreesha Srinath, Gopalakrishnan Srinivasan, Christopher Torng, Rangharajan Venkatesan, Sam Xi 18 | 19 | Connections's back annotation feature is dependent on RapidJSON released under the MIT License. 20 | 21 | # Attribution 22 | 23 | If used for research, please cite the [DAC paper](https://research.nvidia.com/sites/default/files/pubs/2018-06_A-Modular-Digital//dac2018.submitted.pdf): 24 | 25 | Brucek Khailany, Evgeni Krimer, Rangharajan Venkatesan, Jason Clemons, Joel S. Emer, Matthew Fojtik, Alicia Klinefelter, Michael Pellauer, Nathaniel Pinckney, Yakun Sophia Shao, Shreesha Srinath, Christopher Torng, Sam (Likun) Xi, Yanqing Zhang, and Brian Zimmer, "A modular digital VLSI flow for high-productivity SoC design," in _Proceedings of the ACM/IEEE Design Automation Conference_, June 2018. 26 | -------------------------------------------------------------------------------- /matchlib/connections/doc/Makefile: -------------------------------------------------------------------------------- 1 | DOXYCOMM = Doxyfile 2 | 3 | .PHONY: doxygen 4 | doxygen: $(DOXYCOMM) 5 | doxygen $(DOXYCOMM) 6 | echo 'include : ["_*.html"]' >> html/_config.yml 7 | 8 | .PHONY: clean 9 | clean: 10 | rm -rf html 11 | -------------------------------------------------------------------------------- /matchlib/connections/examples/Adder/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../cmod_Makefile 18 | 19 | all: sim_adder1 20 | 21 | run: 22 | ./sim_adder1 23 | 24 | sim_adder1: $(wildcard *.h) $(wildcard *.cpp) 25 | $(CC) -o sim_adder1 -I../../include $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(LIBS) 26 | 27 | sim_clean: 28 | rm -rf *.o sim_* 29 | 30 | -------------------------------------------------------------------------------- /matchlib/connections/examples/Adder2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | include ../cmod_Makefile 18 | 19 | all: sim_adder2 20 | 21 | USER_FLAGS += -DCONN_RAND_STALL_PRINT_DEBUG 22 | run: 23 | ./sim_adder2 24 | 25 | sim_adder2: $(wildcard *.h) $(wildcard *.cpp) 26 | $(CC) -o sim_adder2 -I../../include $(CFLAGS) $(USER_FLAGS) $(wildcard *.cpp) $(LIBS) 27 | 28 | sim_clean: 29 | rm -rf *.o sim_* 30 | 31 | -------------------------------------------------------------------------------- /matchlib/connections/examples/Adder3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | # Must always use these modes for this test, since it is cycle count 18 | # dependent. 19 | override SIM_MODE=1 20 | override RAND_STALL=0 21 | 22 | include ../cmod_Makefile 23 | 24 | all: sim_adder3 25 | 26 | # Location of rapidjson 27 | RAPIDJSON_HOME ?= ../../../../rapidjson 28 | 29 | run: 30 | ./sim_adder3 31 | 32 | sim_adder3: $(wildcard *.h) $(wildcard *.cpp) 33 | $(CC) -o sim_adder3 -I../../include $(CFLAGS) $(USER_FLAGS) -I../Adder2 -I${RAPIDJSON_HOME}/include $(wildcard *.cpp) $(LIBS) 34 | 35 | sim_clean: 36 | rm -rf *.o sim_* 37 | 38 | -------------------------------------------------------------------------------- /matchlib/connections/examples/Adder3/my_testbench.input.json: -------------------------------------------------------------------------------- 1 | { 2 | "channels": { 3 | "a_comb_BA": { 4 | "latency": 10, 5 | "capacity": 2, 6 | "src_name": "srca.x_out", 7 | "dest_name": "adder.a_in" 8 | }, 9 | "b_comb_BA": { 10 | "latency": 2, 11 | "capacity": 10, 12 | "src_name": "srcb.x_out", 13 | "dest_name": "adder.b_in" 14 | }, 15 | "sum_comb_BA": { 16 | "latency": 0, 17 | "capacity": 0, 18 | "src_name": "adder.sum_out", 19 | "dest_name": "dest.sum_in" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /matchlib/connections/include/connections/message.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License") 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | //======================================================================== 17 | // message.h 18 | //======================================================================== 19 | 20 | #ifndef __CONNECTIONS__MESSAGE_H_ 21 | #define __CONNECTIONS__MESSAGE_H_ 22 | 23 | #include 24 | 25 | /** 26 | * \brief Class to support complex data types to bitvectors. 27 | * \ingroup Marshaller 28 | * 29 | * \par Instantiate this class to provide default functionality for supporting complex data type 30 | * conversion to/from sc_lv without using the Marshaller, for DIRECT_MODE ports only. Example code: 31 | * 32 | * \code 33 | * #include 34 | * #include 35 | * 36 | * class Foo : public message { 37 | * 38 | * ... 39 | * 40 | * }; 41 | * \endcode 42 | * 43 | */ 44 | namespace Connections { 45 | 46 | class message { 47 | public: 48 | friend inline bool operator==(const message& lhs, const message& rhs) { 49 | return false; 50 | } 51 | 52 | inline friend std::ostream& operator<<(ostream& os, const message& rhs) 53 | { 54 | os << ""; 55 | return os; 56 | } 57 | 58 | inline friend void sc_trace(sc_core::sc_trace_file *& tf, const message& rhs, const std::string& NAME) { 59 | } 60 | }; 61 | 62 | } 63 | 64 | #endif // __CONNECTIONS__MESSAGE_H_ 65 | 66 | -------------------------------------------------------------------------------- /matchlib/doc/.gitignore: -------------------------------------------------------------------------------- 1 | latex/* 2 | html/* 3 | *tmp 4 | -------------------------------------------------------------------------------- /matchlib/doc/.p4ignore: -------------------------------------------------------------------------------- 1 | latex/* 2 | html/* 3 | *tmp 4 | -------------------------------------------------------------------------------- /matchlib/doc/Makefile: -------------------------------------------------------------------------------- 1 | DOXYCOMM = Doxyfile 2 | 3 | .PHONY: doxygen 4 | doxygen: $(DOXYCOMM) 5 | doxygen $(DOXYCOMM) 6 | echo 'include : ["_*.html"]' >> html/_config.yml 7 | 8 | .PHONY: clean 9 | clean: 10 | rm -rf html 11 | -------------------------------------------------------------------------------- /matchlib/doc/connections-guide.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-acc/ESP_Systolic_Array_Accelerator/98f061fcfd9625ef97fbfc5e885e5bfb9b0c16b6/matchlib/doc/connections-guide.pdf -------------------------------------------------------------------------------- /matchlib/hls/.gitignore: -------------------------------------------------------------------------------- 1 | *slec* 2 | *.log 3 | *.log-* 4 | *.log_* 5 | *ucli.key 6 | *design_checker*tcl 7 | *vcs* 8 | *Catapult* 9 | *.ccs 10 | *.pinfo 11 | *.output.json 12 | *.csv 13 | -------------------------------------------------------------------------------- /matchlib/hls/.p4ignore: -------------------------------------------------------------------------------- 1 | *slec* 2 | *.log 3 | *.log-* 4 | *.log_* 5 | *ucli.key 6 | *design_checker* 7 | *vcs* 8 | */Catapult* 9 | *.output.json 10 | *.csv 11 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/examples/ConnectionsRecipes 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/run/while -PIPELINE_INIT_INTERVAL 1 20 | directive set /$TOP_NAME/run/while -PIPELINE_STALL_MODE flush 21 | } 22 | 23 | nvhls::run 24 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder2/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/examples/ConnectionsRecipes 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder2/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/run/while -PIPELINE_INIT_INTERVAL 1 20 | directive set /$TOP_NAME/run/while -PIPELINE_STALL_MODE flush 21 | } 22 | 23 | nvhls::run 24 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder3/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | TOP_NAME = Adder2 18 | SRC_PATH = $(ROOT)/cmod/examples/ConnectionsRecipes 19 | SEARCH_PATH = $(ROOT)/cmod \ 20 | $(ROOT)/cmod/include \ 21 | $(ROOT)/cmod/examples/ConnectionsRecipes/$(TOP_NAME) \ 22 | $(CONNECTIONS_HOME)/include \ 23 | $(RAPIDJSON_HOME)/include 24 | 25 | 26 | COMPILER_FLAGS = SC_INCLUDE_DYNAMIC_PROCESSES CONNECTIONS_ACCURATE_SIM 27 | 28 | # Must always use these modes for this test, since it is cycle count 29 | # dependent. 30 | override SIM_MODE=1 31 | override RAND_STALL=0 32 | 33 | include ../../../hls/hls_Makefile 34 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder3/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::set_input_files {SRC_PATH TOP_NAME SYSC} { 18 | solution file add [list $SRC_PATH/$TOP_NAME/$TOP_NAME.h] -type SYSTEMC 19 | solution file add [list $SRC_PATH/Adder3/testbench.cpp] -type SYSTEMC -exclude true 20 | } 21 | 22 | proc nvhls::usercmd_post_assembly {} { 23 | upvar TOP_NAME TOP_NAME 24 | directive set /$TOP_NAME/run/while -PIPELINE_INIT_INTERVAL 1 25 | directive set /$TOP_NAME/run/while -PIPELINE_STALL_MODE flush 26 | } 27 | 28 | nvhls::run 29 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder3/my_testbench.input.json: -------------------------------------------------------------------------------- 1 | { 2 | "channels": { 3 | "a_comb_BA": { 4 | "latency": 10, 5 | "capacity": 2, 6 | "src_name": "srca.x_out", 7 | "dest_name": "adder.a_in" 8 | }, 9 | "b_comb_BA": { 10 | "latency": 2, 11 | "capacity": 10, 12 | "src_name": "srcb.x_out", 13 | "dest_name": "adder.b_in" 14 | }, 15 | "sum_comb_BA": { 16 | "latency": 0, 17 | "capacity": 0, 18 | "src_name": "adder.sum_out", 19 | "dest_name": "dest.sum_in" 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder4/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../../.. 18 | SRC_PATH := $(ROOT)/cmod/examples/ConnectionsRecipes 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/ConnectionsRecipes/Adder4/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/run/while -PIPELINE_INIT_INTERVAL 1 20 | directive set /$TOP_NAME/run/while -PIPELINE_STALL_MODE flush 21 | } 22 | 23 | nvhls::run 24 | -------------------------------------------------------------------------------- /matchlib/hls/Counter/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../.. 18 | SRC_PATH := $(ROOT)/cmod/examples/ 19 | SYSTEMC_DESIGN := 0 20 | 21 | include $(ROOT)/hls/hls_Makefile 22 | -------------------------------------------------------------------------------- /matchlib/hls/Counter/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /matchlib/hls/MemModel/Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | 17 | ROOT := ../.. 18 | SRC_PATH := $(ROOT)/cmod 19 | COMPILER_FLAGS := HLS_ALGORITHMICC 20 | SYSTEMC_DESIGN := 0 21 | 22 | include $(ROOT)/hls/hls_Makefile 23 | -------------------------------------------------------------------------------- /matchlib/hls/design_checker_summary.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License") 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | 17 | # This script parses the report file generated by Catapult Design Checker 18 | # to prepare a CSV summary. 19 | 20 | # It takes no inputs; it searches the working directory recursively 21 | # for files named design_checks_violated.log. 22 | 23 | import re 24 | from pathlib import Path 25 | import pandas as pd 26 | 27 | file_list =[] 28 | for filename in Path('.').glob('**/design_checks_violated.log'): 29 | file_list.append(filename) 30 | df = pd.DataFrame(columns=['Type','Rule','File','Message','Design']) 31 | type_re = re.compile('^\s*\*\*\*\*\s+([A-Z]*)') 32 | violation_re = re.compile('([A-Z]+)\s+(\w+.(?:h|cpp):[0-9]+,[0-9]+)\s+(.*)') 33 | row = 0 34 | for filename in file_list: 35 | print(filename) 36 | filelines = open(str(filename),'r').readlines() 37 | violation_type='' # Warning, Fatal, Error, Info 38 | for line in filelines: 39 | if (type_re.match(line)): 40 | m = type_re.match(line) 41 | violation_type = m.group(1) 42 | if (violation_re.match(line)): 43 | m = violation_re.match(line) 44 | rule = m.group(1) 45 | source = m.group(2) 46 | message = m.group(3).strip('\n') 47 | if (not re.search('spec_wrapper',source)): 48 | df.loc[row] = violation_type, rule, source, message, filename 49 | row += 1 50 | 51 | df.to_csv('DesignCheckSummary.csv',index=False) 52 | -------------------------------------------------------------------------------- /matchlib/hls/regress_Makefile: -------------------------------------------------------------------------------- 1 | # 2 | # Copyright (c) 2016-2019, NVIDIA CORPORATION. All rights reserved. 3 | # 4 | # Licensed under the Apache License, Version 2.0 (the "License") 5 | # you may not use this file except in compliance with the License. 6 | # You may obtain a copy of the License at 7 | # 8 | # http://www.apache.org/licenses/LICENSE-2.0 9 | # 10 | # Unless required by applicable law or agreed to in writing, software 11 | # distributed under the License is distributed on an "AS IS" BASIS, 12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | # See the License for the specific language governing permissions and 14 | # limitations under the License. 15 | # 16 | # Integration tests with a set of existing units. 17 | 18 | DIRS = \ 19 | Counter \ 20 | ConnectionsRecipes/Adder \ 21 | ConnectionsRecipes/Adder2 \ 22 | ConnectionsRecipes/Adder3 \ 23 | ConnectionsRecipes/Adder4 \ 24 | MemModel \ 25 | unittests/ArbiterModule \ 26 | unittests/ArbiterTop \ 27 | unittests/ArbitratedCrossbarTop \ 28 | unittests/ArbitratedScratchpadTop \ 29 | unittests/ArbitratedScratchpadDPTop \ 30 | unittests/CrossbarTop \ 31 | unittests/FifoTop \ 32 | unittests/LzdTop \ 33 | unittests/ReorderBufTop \ 34 | unittests/ScratchpadTop \ 35 | unittests/VectorUnit \ 36 | unittests/axi/AxiAddRemoveWRespTop \ 37 | unittests/axi/AxiArbSplitTop \ 38 | unittests/axi/AxiLiteSlaveToMemTop \ 39 | unittests/axi/AxiMasterGateTop \ 40 | unittests/axi/AxiSlaveToMemTop \ 41 | unittests/axi/AxiSlaveToReadyValidTop \ 42 | unittests/axi/AxiSlaveToRegTop \ 43 | unittests/WHVCRouterTop \ 44 | 45 | .PHONY: all $(DIRS) 46 | 47 | all: $(DIRS) 48 | 49 | $(DIRS): 50 | $(MAKE) -C $@ clean 51 | ifdef RUN_CDESIGN_CHECKER 52 | $(MAKE) -C $@ cdc 53 | else 54 | $(MAKE) -C $@ 55 | #endif 56 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbiterModule/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | 19 | # Only SIM_MODE 0 supported for this test. 20 | override SIM_MODE=0 21 | 22 | include $(ROOT)/hls/hls_Makefile 23 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbiterModule/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | } 19 | 20 | nvhls::run 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbiterTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbiterTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/core/main -PIPELINE_INIT_INTERVAL 1 20 | } 21 | 22 | nvhls::run 23 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbitratedCrossbarTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbitratedScratchpadDPTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbitratedScratchpadDPTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | set DESIGN_TOP "/$TOP_NAME/core" 20 | set NUM_BANKS 4 21 | set MAIN_PIPELINE_II 1 22 | 23 | for {set k 0} {$k < $NUM_BANKS} {incr k} { 24 | directive set ${DESIGN_TOP}/scratchpad_inst.banks.bank.array_impl.data$k:rsc -MAP_TO_MODULE ram_sample-065nm-separate_beh_dc.RAM_separateRW 25 | } 26 | directive set ${DESIGN_TOP}/main -PIPELINE_INIT_INTERVAL ${MAIN_PIPELINE_II} 27 | } 28 | 29 | nvhls::run 30 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbitratedScratchpadTop/.Makefile.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/harvard-acc/ESP_Systolic_Array_Accelerator/98f061fcfd9625ef97fbfc5e885e5bfb9b0c16b6/matchlib/hls/unittests/ArbitratedScratchpadTop/.Makefile.swp -------------------------------------------------------------------------------- /matchlib/hls/unittests/ArbitratedScratchpadTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := HLS_ALGORITHMICC 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/CrossbarTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := NO_XBAR_VALID_IN_OUT NO_XBAR_VALID_SOURCE 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/FifoTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/FifoTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/core/main -PIPELINE_INIT_INTERVAL 1 20 | directive set /FifoTop/core/fifo.fifo_body.bank.array_impl.data0:rsc -MAP_TO_MODULE ram_sample-065nm-separate_beh_dc.RAM_separateRW 21 | } 22 | 23 | nvhls::run 24 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/LzdTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/LzdTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/core/main -PIPELINE_INIT_INTERVAL 1 20 | } 21 | 22 | nvhls::run 23 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ReorderBufTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ReorderBufTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/core/main -PIPELINE_INIT_INTERVAL 1 20 | } 21 | 22 | nvhls::run 23 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ScratchpadTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := SCRATCHPAD_CAPACITY=1024 SCRATCHPAD_BANKS=8 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/ScratchpadTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | set CAPACITY_PER_BANK 128 18 | set BANKS 8 19 | set CAPACITY [expr $CAPACITY_PER_BANK*$BANKS] 20 | 21 | proc nvhls::usercmd_pre_compile {} { 22 | # Enable clock gating 23 | directive set -GATE_REGISTERS {true} 24 | directive set -GATE_EFFORT {high} 25 | directive set -GATE_MIN_WIDTH {4} 26 | directive set -GATE_EXPAND_MIN_WIDTH {4} 27 | } 28 | 29 | proc nvhls::usercmd_post_assembly {} { 30 | global BANKS CAPACITY 31 | upvar TOP_NAME TOP_NAME 32 | 33 | for {set k 0} {$k < $BANKS} {incr k} { 34 | directive set /${TOP_NAME}/Scratchpad/run/banks.bank.array_impl.data$k:rsc -MAP_TO_MODULE ram_sample-065nm-separate_beh_dc.RAM_separateRW 35 | } 36 | } 37 | 38 | nvhls::run 39 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/VectorUnit/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | COMPILER_FLAGS := 18 | SYSTEMC_DESIGN := 0 19 | 20 | include $(ROOT)/hls/hls_Makefile 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/VectorUnit/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/core/main -PIPELINE_INIT_INTERVAL 1 20 | } 21 | 22 | nvhls::run 23 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/WHVCRouterTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../.. 17 | 18 | include $(ROOT)/hls/hls_Makefile 19 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/WHVCRouterTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiAddRemoveWRespTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../../.. 17 | SRC_PATH := $(ROOT)/cmod/unittests/axi 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | 21 | # Without write responses there is no way to prevent a bad seed 22 | # that will stall writes in the TB so that reads overtake them. 23 | COMPILER_FLAGS += RAND_SEED=1000 24 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiAddRemoveWRespTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiArbSplitTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../../.. 17 | SRC_PATH := $(ROOT)/cmod/unittests/axi 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiArbSplitTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiLiteSlaveToMemTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../../.. 17 | SRC_PATH := $(ROOT)/cmod/unittests/axi 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiLiteSlaveToMemTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_pre_analyze {} { 18 | directive set -REGISTER_THRESHOLD 2048 19 | directive set -MEM_MAP_THRESHOLD 1024 20 | } 21 | 22 | proc nvhls::usercmd_post_assembly {} { 23 | upvar TOP_NAME TOP_NAME 24 | directive set /$TOP_NAME/slave/run/memarray.bank.array_impl.data0:rsc -MAP_TO_MODULE ram_sample-065nm-separate_beh_dc.RAM_separateRW 25 | } 26 | 27 | nvhls::run 28 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiMasterGateTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../../.. 17 | SRC_PATH := $(ROOT)/cmod/unittests/axi 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | 21 | COMPILER_FLAGS += HLS_ALGORITHMICC 22 | 23 | # The tetstbench is not very sophisticated, so certain random seeds 24 | # will cause reads to overtake writes. 25 | COMPILER_FLAGS += RAND_SEED=1000 26 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiMasterGateTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiSlaveToMemTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../../.. 17 | SRC_PATH := $(ROOT)/cmod/unittests/axi 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiSlaveToMemTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/slave/run/memarray.bank.array_impl.data0:rsc -MAP_TO_MODULE ram_sample-065nm-separate_beh_dc.RAM_separateRW 20 | } 21 | 22 | nvhls::run 23 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiSlaveToReadyValidTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../../.. 17 | SRC_PATH := $(ROOT)/cmod/unittests/axi 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiSlaveToReadyValidTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../../nvhls_exec.tcl 16 | 17 | nvhls::run 18 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiSlaveToRegTop/Makefile: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | 16 | ROOT := ../../../.. 17 | SRC_PATH := $(ROOT)/cmod/unittests/axi 18 | 19 | include $(ROOT)/hls/hls_Makefile 20 | 21 | -------------------------------------------------------------------------------- /matchlib/hls/unittests/axi/AxiSlaveToRegTop/go_hls.tcl: -------------------------------------------------------------------------------- 1 | # Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved. 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 | source ../../../nvhls_exec.tcl 16 | 17 | proc nvhls::usercmd_post_assembly {} { 18 | upvar TOP_NAME TOP_NAME 19 | directive set /$TOP_NAME/slave/run/reg:rsc -MAP_TO_MODULE {[Register]} 20 | } 21 | 22 | nvhls::run 23 | --------------------------------------------------------------------------------