You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This section describes how to create own memory module with module name specified.
124
+
This section describes how to create a custom memory module with module name specified.
130
125
131
-
To support vendor memory it needs to specify memory module name at instantiation point and exclude the SV module code generation (memory module is external one). To exclude SV module code generation empty {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} should be used. To specify memory module name it needs to define {\tt\_\_SC\_TOOL\_MEMORY\_NAME\_\_} variable in the module body and initialize it with required name string.
126
+
To support vendor memory it needs to specify memory module name at instantiation point and exclude the SV module code generation (memory module is external one). To exclude SV module code generation empty {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} should be used. To specify memory module name it needs to define {\tt\_\_SC\_TOOL\_MODULE\_NAME\_\_} variable in the module body and initialize it with required name string.
132
127
133
128
If there are two instances of the same SystemC module, it is possible to give them different names, but {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} must be declared in the module. If {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} is not declared the SystemC module, only one SV module with first given name will be generated .
134
129
135
-
Module name could be specified for module with non-empty {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_}, but module names in {\tt\_\_SC\_TOOL\_MEMORY\_NAME\_\_} and {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} should be the same.
130
+
Module name could be specified for module with non-empty {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_}, but module names in {\tt\_\_SC\_TOOL\_MODULE\_NAME\_\_} and {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} should be the same.
136
131
137
132
If specified module name in module without {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} declaration conflicts with another module name, it updated with numeric suffix. Specified name in module with {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_} declaration never changed, so name uniqueness should be checked by user.
Copy file name to clipboardExpand all lines: doc/install.tex
-21Lines changed: 0 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -246,24 +246,3 @@ \subsection{Run tool for custom design}
246
246
svc_target(mydesign ELAB_TOP tb.dut_inst)
247
247
\end{lstlisting}
248
248
249
-
250
-
\subsection{Tool options and defines}\label{section:tool_options}
251
-
252
-
To run ICSC tool for the custom project it needs to create CMakeList.txt file. SystemVeriog code generation is done with {\tt svc\_target} function. {\tt svc\_target} is CMake function defined in {\tt\$ICSC\_HOME/lib64/cmake/SVC/svc\_target.cmake}.
253
-
254
-
ICSC has several options, which can be specified as {\tt svc\_target} parameters:
255
-
256
-
\begin{itemize}
257
-
\item {\tt ELAB\_TOP} – design top module name, it needs to be specified if top module is instantiated outside of {\tt sc\_main()} or if there are more than one modules in {\tt sc\_main()};
258
-
\item {\tt MODULE\_PREFIX} – module prefix string, no prefix if not specified, prefix applied for every module excluding Verilog intrinsic (module with {\tt\_\_SC\_TOOL\_VERILOG\_MOD\_\_}) and memory modules (modules with {\tt\_\_SC\_TOOL\_MEMORY\_NAME\_\_});
259
-
\item {\tt REPLACE\_CONST\_VALUE} – replace constant with its evaluated value if possible, by default constant variable is used;
260
-
\item {\tt INIT\_LOCAL\_VARS} – initialize non-initialized process local variables with zero to avoid latches, that related to CPP data types only, SC data types always initialized with 0;
261
-
\item {\tt NO\_SVA\_GENERATE} – do not generate SVA from immediate and temporal SystemC assertions, normally SVA are generated;
262
-
\item {\tt NO\_REMOVE\_EXTRA\_CODE} – do not remove unused variable and unused code in generated SV, normally such code is removed to improve readability.
263
-
\end{itemize}
264
-
265
-
ICSC tool provides {\tt\_\_SC\_TOOL\_\_} define for input SystemC project translation. This define used in temporal assertions and other ICSC library modules to have different behavior for simulation and SV generation. {\tt\_\_SC\_TOOL\_\_} can also be used in project code to hide pieces of code which is not targeted for translation to SystemVerilog.
266
-
267
-
To completely disable SystemC temporal assertion macro {\tt SCT\_ASSERT\_OFF} can be defined. That allows to hide all assertion specific code to meet SystemC synthesizable standard requirements. {\tt SCT\_ASSERT\_OFF} is required if the SystemC design is passed through a tool which includes its own (not patched) SystemC library.
\subsection{Tool options and defines}\label{section:tool_options}
3
+
4
+
ICSC has several options, which can be specified as {\tt svc\_target} parameters. These options given in Table~\ref{tab:tool_opts}.
5
+
6
+
7
+
\begin{table}
8
+
\begin{tabular}{|l|l|}
9
+
\hline
10
+
Tool option & Description \\
11
+
\hline
12
+
{\tt ELAB\_TOP} & Design top module name, it needs to be specified if \\
13
+
& top module is instantiated outside of {\tt sc\_main()} \\
14
+
& or if there are more than one modules in {\tt sc\_main()} \\
15
+
{\tt MODULE\_PREFIX} & Module prefix string, no prefix if not specified, prefix \\
16
+
& applied for every module excluding SV intrinsic, \\
17
+
& see~\ref{section:black_box} \\
18
+
{\tt UNSIGNED} & Unsigned mode for designs with unsigned arithmetic only, \\
19
+
& see~\ref{section:unsigned_mode} \\
20
+
{\tt INIT\_LOCAL\_VARS} & Initialize non-initialized process local variables \\
21
+
& with 0 to avoid latches, that related to CPP data \\
22
+
& types only, SC data types always initialized with 0 \\
23
+
{\tt INIT\_RESET\_LOCAL\_VARS} & Initialize non-initialized clocked thread local \\
24
+
& variables declared in reset section with zero, \\
25
+
& that related to CPP data types only, \\
26
+
& SC data types always initialized with 0 \\
27
+
{\tt PORT\_MAP\_GENERATE} & Generate port map file and top module wrapper with \\
28
+
& flatten port arrays, port map file used for SC/SV \\
29
+
& mixed language simulation, top module wrapper used for \\
30
+
& logic synthesis tools which do not support unpacked \\
31
+
& port array in top module interface \\
32
+
{\tt NO\_SVA\_GENERATE} & Do not generate SVA from immediate and temporal \\
33
+
& SystemC assertions, SVA are generated by default \\
34
+
{\tt NO\_REMOVE\_EXTRA\_CODE} & Do not remove unused variable and unused code, \\
35
+
& normally such code is removed to improve readability \\
36
+
\hline
37
+
\end{tabular}
38
+
\caption{{\tt svc\_target} parameters}
39
+
\label{tab:tool_opts}
40
+
\end{table}
41
+
42
+
ICSC tool provides {\tt\_\_SC\_TOOL\_\_} define for input SystemC project translation. This define used in temporal assertions and other ICSC library modules to have different behavior for simulation and SV generation. {\tt\_\_SC\_TOOL\_\_} can also be used in project code to hide pieces of code which is not targeted for translation to SystemVerilog.
43
+
44
+
To completely disable SystemC temporal assertion macro {\tt SCT\_ASSERT\_OFF} can be defined. That allows to hide all assertion specific code to meet SystemC synthesizable standard requirements. {\tt SCT\_ASSERT\_OFF} is required if the SystemC design is passed through a tool which includes its own (not patched) SystemC library.
Unsigned mode is intended for designs with unsigned arithmetic only. That means all variables and constants types are unsigned, all expressions are evaluated as non-negative.
49
+
50
+
In this mode variables and constants types as well as expressions types are checked to be unsigned. C99 types {\tt uint8\_t} and {\tt uint16\_t} (declared in {\tt <cstdint>}) are not recommended to use in this mode as they leads to false warnings.
51
+
52
+
Literals could be signed and unsigned (with suffix {\tt U}) in all operations except shifts. In shift expressions both arguments, including literals, should be unsigned.
\subsection{Non-modified member variables generation}\label{section:non_modif_var_gen}
213
+
Module or modular interface member variables which are non-modified in any process, considered as initialized at elaboration phase. Because of dynamic elaborator used in the tool, it is not possible to detect if a variable is not initialized at elaboration phase.
214
+
215
+
For such member variables which are scalar (non-array) and non-record type, SV local parameters are generated.
216
+
No local parameters generated for array and record members, so these variables remain non-initialized. Such member variable should be initialized in reset section of a process where it is used.
217
+
218
+
\begin{lstlisting}[style=mycpp]
219
+
class MyModule : public sc_module {
220
+
bool C = true;
221
+
int D;
222
+
unsigned E;
223
+
224
+
CTOR (MyModule) {
225
+
D = 42;
226
+
}
227
+
void setE(unsigned par) { E = par; }
228
+
}
229
+
...
230
+
MyModule m{"m"};
231
+
...
232
+
m.setE(43); // In parent module constructor
233
+
\end{lstlisting}
234
+
%
235
+
\begin{lstlisting}[style=myverilog]
236
+
// Generated SystemVerilog
237
+
localparam logic C = 1;
238
+
localparam logic signed [31:0] D = 42;
239
+
localparam logic [31:0] E = 43;
240
+
\end{lstlisting}
241
+
242
+
Nothing is generated if the variable is not used in any process. If such variable is member of array of modular interfaces, it should be used in a process of each modular interface.
For constants and static constants SV local parameters are generated. There is {\tt KEEP\_CONST\_VARIABLES} option to replace the constants in the code with their values, see~\ref{section:tool_options}. Constant is replaced with its value if the value if there is no reference to the constant. If constant is replaced with its value or not used in the code, no SV local parameter is generated.
246
+
For constants and static constants SV local parameters are generated.
There is {\tt REPLACE\_CONST\_VARIABLES} option to replace the constants in the code with their values, see~\ref{section:tool_options}. A constant is replaced with its value if the value if there is no reference to the constant. If constant is replaced with its value or not used in the code, no SV local parameter is generated.
261
+
229
262
\subsection{Method process generation}\label{section:method_gen}
230
263
231
264
Method process is directly translated into {\tt always\_comb} block. All the local variables of the method are translated into local variables in the {\tt always\_comb} block.
Copy file name to clipboardExpand all lines: doc/ug.tex
+10-2Lines changed: 10 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -6,9 +6,12 @@
6
6
\subtitle{version 1.4}
7
7
8
8
\author{Mikhail Moiseev}
9
+
\ifdefined\INTEL
10
+
\else
9
11
\affiliation[obeypunctuation=true]{
10
12
\institution{Intel Corporation}
11
13
}
14
+
\fi
12
15
13
16
%\email{mikhail.moiseev at intel.com}
14
17
@@ -23,8 +26,6 @@
23
26
24
27
\pagebreak
25
28
26
-
%\newif\INTEL
27
-
28
29
\section{Preface}
29
30
30
31
Intel\textregistered Compiler for SystemC* (ICSC) is open source tool distributed under \href{https://github.com/intel/systemc-compiler/blob/main/LICENSE.txt}{Apache License v2.0 with LLVM Exceptions}. The source codes are available at \href{https://github.com/intel/systemc-compiler}{github.com/intel/systemc-compiler}.
@@ -69,11 +70,18 @@ \section{Terminology and abbreviations}
0 commit comments