Coding mistakes Flashcards

1
Q

Define module with inputs/outputs

A

Stuck at :
module rr_3_2_switch;
output ask_for_it;
input req[3:0];
…..

<logic>
endmodule;



Answer :
module rr_3_2_switch
#(parameter M_CNT=3,S_CNT=2)
(
output logic ask_for_it;
input wire req[2:0]
.....);

<logic>
endmodule;
</logic></logic>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

SV scheduling queue

A

1) Preponed

2) Active
3) InActive
4) NBA
5) Observed

6) Re-Active
7) Re-inactive
8) Re-NBA

9) Postponed

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Preponed region

A

*) #1step sampling delay provides the ability to sample data immediately before entering the current time slot
*) Sampling in the Preponed region is equivalent to sampling in the previous Postponed region.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How does below code work : (switching between #0 to active code)

a = 1;
#0 b = 1;
c = 2;

c=1;
b=2;

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

NBA working (variable used in nba is updated by nba)

a => b& c;
b=1;
c = 1;
b=>2;
d = b& c;
b=2;
c = 3;
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Observed region

A

Evaluation of concurrent assertions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Reactive region

A

*) blocking assignments in program blocks
*) Action blocks of concurrent assertions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Re-inactive region

A

0 in reactive region code : i.e

*) #0 in program blocks
*) #0 Action blocks of concurrent assertions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Re-NBA

A

=> in reactive region code : i.e
1.=> in program blocks
2.=> Action blocks of concurrent assertions

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Postponed

A

$monitor, $strobe

=== preponed on next clk

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

$monitor vs $strobe vs $write vs $display

A
  • $display : is the normal display, which executes its parameters wherever it is present in the code.
  • $write : similar to $display except contents are displayed in the same line.
  • $strobe : only once in a time instant, when all processes in that time instant have executed. (postponed)
  • $monitor : executes only if any of its parameters change (in one time instant). (postponed)
module d11; 
bit a=0, b=0; 
initial
begin
a=0; 
b=1; 
$display(a,b); 
$strobe(a,b); 
b=0; 
a=1; 
$display(a,b); 
$write(a,b); 
$display(a,b); 
#1 b=1; 
end
initial
$monitor($time"ns: %b%b",a,b); 
Endmodule

Output:

01

10

1010

10

0ns: 10

1ns: 11

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

not vs negate

(!) vs (~) vs not

A
  • ~ is a bit-wise operator and returns the invert of the argument.
  • ! is a logical operator and returns a single bit.
  • not : Only used in SVA
reg [7:0] bit_wise, logic_op;
integer val = 1;
interger result;
initial begin
  bit_wise = ~8'hA1; // bit_wise == 8'h5E
  logic_op = !8'hA1; // logic_op == 8'b00
	result = ~val;   // result=11111111111111111111111111111110 
	                         //           = 0xFFFE
	                         // (interger converted to 32-bit logic)
	result = !val;   // result=0
	end
//*********************************************
sequence s_is_a;
@(posedge clk) a;
endsequence
property p_is_n_a;
not s_is_a;
endproperty
prop_name : assert propery(p_is_n_a);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Enable dumping

A
initial begin
  $dumpfile("dump.vcd");
  $dumpvars;
end
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

100 $finish;

vs
#100; $finish;
vs
repeat(10) @(posedge clk) $finish;
vs
repeat(10) @(posedge clk); $finish;

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

$finish vs $exit vs $stop

A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

$finish argument

A

$finish can take arg of value :
* 0 : Prints nothing(default)
* 1 : Prints simulation time and location
* 2 : Prints simulation time, location, and statistics about the memory and central processing unit (CPU) time used in simulation