Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,6 @@ dkms.conf

# Misc
sc_tool/arc
build/
build_*/

30 changes: 14 additions & 16 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ add_custom_command(OUTPUT ${SYSTEMC_PCH}
COMMAND
${CLANG_CXX_EXECUTABLE} -Xclang -emit-pch -x c++-header
${CMAKE_SOURCE_DIR}/systemc/src/systemc.h -o ${SYSTEMC_PCH} ${MSVC_FLAGS}
-D__SC_TOOL__ -D__SC_TOOL_ANALYZE__ -DNDEBUG -std=c++14
-D__SC_TOOL__ -D__SC_TOOL_ANALYZE__ -DNDEBUG -std=c++17
-I${CMAKE_SOURCE_DIR}/systemc/src
DEPENDS systemc
COMMENT "Generating SystemC precompiled header ${SYSTEMC_PCH}"
Expand All @@ -73,12 +73,12 @@ include(cmake/svc_target.cmake)
enable_testing()

# Compile tests and test designs
if( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
message (STATUS "Debug mode: add tests and test designs")
add_subdirectory(tests)
add_subdirectory(examples)
add_subdirectory(designs)
endif()
#if( ${CMAKE_BUILD_TYPE} STREQUAL "Debug" )
# message (STATUS "Debug mode: add tests and test designs")
# add_subdirectory(tests)
# add_subdirectory(examples)
# add_subdirectory(designs)
#endif()

###############################################################################

Expand All @@ -101,12 +101,10 @@ install(FILES ${PROJECT_BINARY_DIR}/SVCConfig.cmake cmake/svc_target.cmake
# Install sctCommon
install(DIRECTORY components/common/sctcommon DESTINATION include)

# Install release mode CMakeLists and scripts
if( ${CMAKE_BUILD_TYPE} STREQUAL "Release" )
message (STATUS "Release mode: copy CMakeLists and scripts")
install(FILES cmake/CMakeLists.txt
cmake/setenv.sh
cmake/README
DESTINATION $ENV{ICSC_HOME})

endif()
# Install setenv scripts
install(FILES cmake/setenv.sh gdb/gdbinit-example.txt
DESTINATION $ENV{ICSC_HOME})

# Install GDB pretty-printers
install(FILES gdb/sysc23x_printers/sysc23x_printers.py
DESTINATION $ENV{ICSC_HOME}/share/gdb/python/sysc23x_printers)
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ICSC is distributed under the [Apache License v2.0 with LLVM Exceptions](https:/

## Getting started

ICSC is based on Clang/LLVM frontend and can be installed at most Linux OS. There is ```install.sh``` script that downloads and builds ICSC and the required dependecies at **Ubuntu 20.04**.
ICSC is based on Clang/LLVM frontend and can be installed at most Linux OS. There is ```install.sh``` script that downloads and builds ICSC and the required dependencies at **Ubuntu 20.04**.

An instruction how to install and run ISCS is given at [Getting started](https://github.com/intel/systemc-compiler/wiki/Getting-started).

Expand Down
25 changes: 0 additions & 25 deletions cmake/CMakeLists.txt

This file was deleted.

2 changes: 0 additions & 2 deletions cmake/setenv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,3 @@ export PATH=$ICSC_HOME/bin:$ICSC_HOME/include:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$ICSC_HOME/lib64:$ICSC_HOME/lib
export SYSTEMC_HOME=$ICSC_HOME



1 change: 0 additions & 1 deletion designs/CMakeLists.txt

This file was deleted.

10 changes: 4 additions & 6 deletions cmake/README → designs/README
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
$ bash

* Setup ICSC environment
$ source setenv.sh
$ source icsc/setenv.sh

* Build sources
$ cd systemc-compiler/designs/examples
$ mkdir build && cd build
$ cmake ../
$ make -j8
Expand All @@ -28,10 +29,7 @@ $ make -j8
$ ctest -j8

* Check the generated SystemVerilog in sv_out folder
$cd examples/counter/sv_out
$cat counter.sv
$ cat counter/sv_out/counter.sv

* Run SystemC simulation for an example
$ cd examples/counter
$ ./counter

$ counter/counter
17 changes: 17 additions & 0 deletions examples/CMakeLists.txt → designs/examples/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,23 @@
#
# *****************************************************************************

cmake_minimum_required(VERSION 3.12)

enable_testing()

if(NOT DEFINED ENV{ICSC_HOME})
message("ICSC_HOME is not defined!")
return()
endif()

project(icsc_examples)

## SVC package contains ScTool and SystemC libraries
find_package(SVC REQUIRED)

# C++ standard must be the same as in ScTool, $(SystemC_CXX_STANDARD) contains 17
set(CMAKE_CXX_STANDARD 17)

add_subdirectory(asserts)
add_subdirectory(counter)
add_subdirectory(decoder)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
22 changes: 18 additions & 4 deletions designs/template/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,29 @@
#
# *****************************************************************************

cmake_minimum_required(VERSION 3.12)

enable_testing()

if(NOT DEFINED ENV{ICSC_HOME})
message("ICSC_HOME is not defined!")
return()
endif()

# Design template
project(mydesign)

## SVC package contains ScTool and SystemC libraries
find_package(SVC REQUIRED)

# C++ standard must be the same as in ScTool, $(SystemC_CXX_STANDARD) contains 17
set(CMAKE_CXX_STANDARD 17)

#include_directories($ENV{ICSC_HOME}/include)

# All synthesizable source files must be listed here (not in libraries)
add_executable(mydesign example.cpp)

# Test source directory
target_include_directories(mydesign PUBLIC $ENV{ICSC_HOME}/examples/template)

# Add compilation options
# target_compile_definitions(mydesign PUBLIC -DMYOPTION)
# target_compile_options(mydesign PUBLIC -Wall)
Expand All @@ -25,4 +39,4 @@ target_include_directories(mydesign PUBLIC $ENV{ICSC_HOME}/examples/template)
# and @mydesign that runs general SystemC simulation
# ELAB_TOP parameter accepts hierarchical name of DUT
# (that is SystemC name, returned by sc_object::name() method)
svc_target(mydesign ELAB_TOP tb.dut_inst)
svc_target(mydesign INIT_LOCAL_VARS ELAB_TOP tb.dut_inst)
21 changes: 15 additions & 6 deletions designs/template/dut.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,42 @@

struct Dut : sc_module
{
typedef sc_uint<16> data_t;

sc_in<bool> clk{"clk"};
sc_in<bool> rstn{"rstn"};

sc_signal<sc_uint<16>> s{"s"};
sc_in<data_t> inp{"inp"};
sc_out<data_t> outp{"outp"};


SC_CTOR(Dut)
{
SC_CTHREAD(threadProc, clk.pos());
async_reset_signal_is(rstn, false);
SC_CTHREAD(threadProc, clk.pos());
async_reset_signal_is(rstn, false);

SC_METHOD(methodProc);
sensitive << s; // Add all signal/ports read in method function here
SC_METHOD(methodProc);
sensitive << tmps; // Add all signal/ports read in method function here
}

sc_signal<data_t> tmps{"tmps"};

void threadProc()
{
// Reset signal/output port values here
tmps = 0;
wait();

while (true) {
// Place sequential logic here
tmps = inp;
wait();
}
}

void methodProc() {
// Place combinational logic here
outp = tmps.read() + data_t(1);
}

};
};
23 changes: 20 additions & 3 deletions designs/template/example.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,34 +7,51 @@

// Design template

#include "dut.h"
#include <systemc.h>
#include "dut.h"

// ICSC requires DUT top should be instantiated inside wrapper (typically TB)
// and all DUT ports are bound.
struct Tb : sc_module
{
typedef Dut::data_t data_t;

sc_in_clk clk{"clk"};
sc_signal<bool> rstn{"rstn"};

sc_signal<data_t> inp{"inp"};
sc_signal<data_t> outp{"outp"};

Dut dut_inst{"dut_inst"};


SC_CTOR(Tb)
{
dut_inst.clk(clk);
dut_inst.rstn(rstn);
dut_inst.inp(inp);
dut_inst.outp(outp);

SC_CTHREAD(test_proc, clk.pos());
}

// Assert and de-assert reset for DUT
void test_proc()
{
cout << "test_proc() started" << endl;

// Assert and de-assert reset for DUT
rstn = 0;
inp = 0;
wait();
rstn = 1;

// Add testbench code here
inp = 10;
wait(2);
inp = 0;
sc_assert(outp.read() == 11);
sc_stop();
cout << "test_proc() finished!" << endl;
}
};

Expand All @@ -45,4 +62,4 @@ int sc_main (int argc, char **argv)
tb.clk(clk);
sc_start();
return 0;
}
}
33 changes: 33 additions & 0 deletions designs/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#******************************************************************************
# Copyright (c) 2020, Intel Corporation. All rights reserved.
#
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception.
#
# *****************************************************************************

cmake_minimum_required(VERSION 3.12)

enable_testing()

if(NOT DEFINED ENV{ICSC_HOME})
message("ICSC_HOME is not defined!")
return()
endif()

project(icsc_tests)

## SVC package contains ScTool and SystemC libraries
find_package(SVC REQUIRED)

# C++ standard must be the same as in ScTool, $(SystemC_CXX_STANDARD) contains 17
set(CMAKE_CXX_STANDARD 17)

add_subdirectory(const_prop)
add_subdirectory(cthread)
add_subdirectory(method)
add_subdirectory(mif)
add_subdirectory(misc)
add_subdirectory(record)
add_subdirectory(state)
add_subdirectory(uniquify)

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading