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
Copy file name to clipboardExpand all lines: doc/prepare.tex
+18-1Lines changed: 18 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -303,6 +303,21 @@ \subsection{Clock and reset}
303
303
304
304
Clocked thread process ({\tt SC\_CTHREAD} and {\tt SC\_THREAD}) is activated by one clock edge. Method process ({\tt SC\_METHOD}) can be sensitive to any change in the signals including clock positive or/and negative edge.
305
305
306
+
Method process can have arbitrary number of resets in its sensitivity list.
307
+
\begin{lstlisting}[style=mycpp]
308
+
SC_CTOR(test_reset) {
309
+
SC_METHOD(proc);
310
+
sensitive << sreset << areset << ...;
311
+
}
312
+
void proc() {
313
+
if (!sreset || !areset) {
314
+
// Reset behavior
315
+
} else {
316
+
// Normal behavior
317
+
}
318
+
}
319
+
\end{lstlisting}
320
+
306
321
Clocked thread process can have one, several or no reset. Clocked thread cannot have more than one asynchronous reset, but can have multiple synchronous resets. SystemC synthesizable subset does not allow clocked thread without resets and multiple synchronous resets. As soon as no reset clocked threads and clocked thread with multiple synchronous resets are required for some applications that is supported by ICSC tool.
307
322
308
323
Method process can be sensitive to all resets required.
@@ -354,7 +369,9 @@ \subsection{Clock and reset}
354
369
}
355
370
\end{lstlisting}
356
371
357
-
For thread process ICSC generates pair of {\tt always\_comb} and {\tt always\_ff} blocks as described in~\ref{section:noreset}.
372
+
For clocked thread process ICSC generates pair of {\tt always\_comb} and {\tt always\_ff} blocks as described in~\ref{section:thread_gen}.
373
+
374
+
There are some limitation to variable use in reset section of clocked thread described in~\ref{section:reg_in_reset}.
// Assignments generated for SystemC array of channels
77
+
// Assignments generated for SystemC channel arrays
78
78
assign f[0] = f0;
79
79
assign f[1] = f1;
80
80
@@ -388,6 +388,51 @@ \subsection{Thread process generation}\label{section:thread_gen}
388
388
end
389
389
\end{lstlisting}
390
390
391
+
\subsection{Register variables in thread reset section}\label{section:reg_in_reset}
392
+
393
+
There are some limitations to use register variables in reset section of clocked thread. Register variable is a variable which keeps its values between thread states. Register variable {\tt i} is represented with a pair of variables {\tt i} and {\tt i\_next} in SV code. Register next to current value has non-blocking assignment in {\tt always\_ff} block, therefore such variable cannot have blocking assignment in reset section. For operations which modify register variable in reset section error is reported:
394
+
%
395
+
\begin{lstlisting}[style=mycpp]
396
+
void proc() {
397
+
int i = 1; // Register variable
398
+
i++; // Error reported
399
+
i += 1; // Error reported
400
+
wait();
401
+
while (true) {
402
+
out = i; // Value from reset used here
403
+
wait();
404
+
}
405
+
\end{lstlisting}
406
+
407
+
\begin{lstlisting}[style=myverilog]
408
+
logic signed [31:0] i;
409
+
logic signed [31:0] i_next;
410
+
always_ff @(posedge clk or negedge arstn)
411
+
begin : read_modify_reg_in_reset_ff
412
+
if ( ~arstn ) begin
413
+
i <= 1;
414
+
i++; // Blocking assignment
415
+
i = i + 2;
416
+
end
417
+
else begin
418
+
i <= i_next;
419
+
end
420
+
\end{lstlisting}
421
+
422
+
Another problem with register variable is reading it in reset section. As soon as the variables has non-blocking assignment it values could be incorrect in RHS of the following statements. For operations which read register variable in reset section warning is reported:
423
+
%
424
+
\begin{lstlisting}[style=mycpp]
425
+
void proc() {
426
+
int i = 1; // Register variable
427
+
int j = i; // Warning reported
428
+
i = j; // X results in SV simulation
429
+
wait();
430
+
while (true) {
431
+
out = i; // Value from reset used here
432
+
wait();
433
+
}
434
+
\end{lstlisting}
435
+
391
436
\subsection{Thread process without reset}\label{section:noreset}
392
437
393
438
Thread process without reset supported with limitations: such process can have only one {\tt wait()} and cannot have any code in reset section.
0 commit comments