Part 1: Topic 2 - SystemVerilog Flashcards

1
Q

What do modules represent in SV?

A

As SystemVerilog is a hardware description language, a module represents a circuit block.

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

What are all signals defined as in SV?

A

they are defined as type logic

e.g. logic c1;

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

What are binary bitwise operators?

A

SV bitwise operators are used to perform a bit-by-bit operation on two inputs, producing a single output.

They take each bit individually and perform a boolean algebra operation with the other input

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

What is the table of bitwise operators for SV?

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

What is the 1s complement useful for?

What is its main downfall?

A

The main benefit of using the 1s complement is that the addition of a positive number and a negative number gives the correct answer (provided the answer is negative…)

The main issue is that there is a dual representation of zero.

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

What is the 2s complement?

A

Modification of the 1s complement that allows for a unique representation of zero.

By adding 12 to the 1s complement of the negative number we remove the value -0(negative zero).

You add 1 to the end and remember to take into account any carryover.

2s complement is only for negative!!

You can now add negative and positive values even if the output is positive.

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

What is the 2s complement of 2?

A

We can remove the negative sign as we are only looking at the magnitude, the sign bit 1 is in fact still there, just not shown…

So you determine binary value for non-negative value, then invert the bits and add one at the end.

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

What is the value of 6 - 2 using 2s complement negative numbers ?

A

Remember 2s complement essentially inverts the its so it make sense for it to be 11110.

Note that 6 does not have to be converted to 2s complement, its only the negative values.

Apparently the carry is ignored..

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

What is the value of -2 - 6 using 2s complement negative numbers?

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

What do synthesisers do?

A

convert the behavioural model into the most suitable structural model for the physical technology

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

Behavioural vs Structural modelling

A

Structural modelling - structural (instantiating primitive entities, e.g. logic gates gates and flip-flops). It is like connecting and arranging different parts of circuits available to implement a functions you are looking for.

Behavioural - (if then, case statements etc.). Writing algorithm type of code.

Structure - using primitives to get end result

Behavioural - using code to get the result

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

Does a always_comb block need a need begin/end statements if the block only consists of 1 clause?

A

No it doesn’t.

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

What is a case statement?

Explain how it works with reference to the attached module.

A

The case statement is a decision instruction that chooses one statement for execution. The statement chosen is one with a value that matches the value of the case statement.

The case statement takes in the value for the variable IN. The 3’b000 refers to a 3 bit binary value, in this case the IN variable. What the respective lines are saying is that if IN is equal to the binary value of that line set the OUT variable to the specified value.

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

What does this line say?

A

The ‘x’ represents ‘dont’ care’ meaning the respective bit can take any value, in this case 0 and 1.

if a 3 bit binary input of value

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

Write a 4:1 MUX using always_comb

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

Write a 4:1 Mux using a case statement

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

200ps B = 2;

What does this mean?

A

Means wait for 200ps of simulation time before continuing execution of the block.

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

What is a test bench

A

A SystemVerilog module which is used to test a synthesisable module in simulation.

19
Q

Property of a Sequential Logic System?

A

The outputs depend not only on the present inputs but also on all previous inputs over a specific operating time.

20
Q

Function of a storage logic system ?

A

Storage of information (data is input and stored but nothing is output)

Access of information (data is output without data input)

22
Q

The relationship between combinatorial, sequential and memory systems

A
  • A simple sequential circuit has memory properties.
  • A combinational logic circuit can be converted into a sequential system by applying feedback from some of the outputs to form additional internal inputs.
  • A memory circuit can be organized as a combinational logic function.
23
Q

What does this flip flop tell us?

A

The @(…) clause is the sensitivity list. This specifies the conditions under which the always_ff block will execute in simulation.

Thus, , on the positive-going edge of the clock, the signal Q takes on the values of D.

24
Q

What do you have to remember about specifying sequential logic?

A

The <= operator is used when assigning values during sequential operation, this is known as a non-blocking assignments.

25
Q

What is the main difference between an SR flip flop and D flip flop?

A

The D in D flop stands for Data.

The main difference is that a D flip takes in one input. For the S and R, however, it has an inverter for the R. Thus, S and R never have the same value, which removes the invalid S=1 and R=1 condition of a SR flip flop.

26
Q

How does a D flip flop store information?

A

D flips change value depending on the clock.

If D has changed, but the cock is equal to 0, the value of Qn will simply be equal to the previous value. Thus, it has memory.

27
Q

Explain this 4 bit register model.

A

As you can see from the timing diagrams, the value of Q only changes on the positive edge of the clock cycle.

Also, Q is defined by a non-blocking assignment.

Clearly Q only changes after D has changed…which is why we only see a change after the second clock trigger.

28
Q

What is the @(…) clause?

e.g. always_ff @(…)

A

The @(…) clause is the sensitivity list. This specifies the conditions under which the module block will execute in simulation.

Usually the module in question is always_ff.

29
Q

What does always_ff represent in SV?

A

Represents a flip-flop (ff), the process is triggered (executed) on every positive edge of the clock. This replaces always @(posedge clk). This is the only type where non-blocking (<=) assignments should be used, as this mimics the way a flip-flop transfers data.

Of course, you can add a sensitivity list to alter the clk.

30
Q

What do always and intial mean in SV?

A

always is the main type of process from Verilog, it continues running throughout the simulation, the other is an initial which is ran once at the start of a simulation.

31
Q

In SV what does the for loop represent?

A

It represents duplicated parallel logic.

In this case a chain of D flip-flops

32
Q

Question in Part 2 of Notes

A
33
Q

What does ? : represent in SV?

It takes values in between and around the ? and :

e.g. a ? b : c

A

It is a conditional operator.

The operator returns b if a is true, otherwise c.

34
Q

How many bits does this variable hold?

How many possible values does it have?

logic [4:0] f

A

5 bit

32 possible values.

35
Q

With SI = 0 and sr = 00100000

What would the value of sr and SO be after one iteration?

A

the values would be concatenated to form => 000100000

Since the assignment {sr, SO}, sr = 00010000 and SO = 0

So sr was shift to the right by one place.

36
Q

What sort of period does this clock have?

A

It has a 10ns period.

every 5ns change the clock to the opposite value. It would take two changes to make one period, which is why its a 10ns period.

37
Q

If you have two initials processes in code, do they start in parallel or does the environment go through the processes in order of position in the code?

A

for initials, SV goes through line by line, thus an inital process stated higher up will occur sooner.

38
Q

In a module, are always statements read in order of position in the code or are do they run in parallel?

Can they run before initial statements?

A

They run in parallel.

Apparentely they can, however, usually they need a clock edge to run, which is why any values inside the always statement would be unkown until this happens.

39
Q

Why is S_reg still at 0 after the reset change?

A

From the code it can be seen that reset changes 0 after 10ns, which means that S_reg will no longer be assigned to 0. However, the code inside always_ff is only read on the positive rising edge of the clock and ‘reset’ is not part of the sensitivity list, i.e. a change ‘reset’ isn’t immediately picked up.

The system still has to wait 5ns to reach the rising edge.

We can notice that on the first positive clock edge S_reg is set to 0 because reset is equal to 1. Before that it was ‘unkown’ because it hadn’t been assigned at all yet.

40
Q

Why is this wrong?

A

4 bits can’t hold 17

Maximum 4 bits can hold is 16.

SV will truncate values that are too large for the bits they are being assigned to.

41
Q

How can this assignment be written in binary form?

A

Negative binary values need to be written in 2s complement.

42
Q

What is the rule for blocking and non-blocking assignments that you need to remember?

A

Use blocking assignments for combinational logic and test benches.

Use non-blocking for sequential (edge-triggered) logic (synchronous).

43
Q

What does { } with variables inside mean?

A

Concantenation

44
Q

What is the value of the first binary term?

A

first term is equal to 20 = 1,

so either 1 or 0.