Part 1: Topic 2 - SystemVerilog Flashcards
What do modules represent in SV?
As SystemVerilog is a hardware description language, a module represents a circuit block.
What are all signals defined as in SV?
they are defined as type logic
e.g. logic c1;
What are binary bitwise operators?
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
What is the table of bitwise operators for SV?
What is the 1s complement useful for?
What is its main downfall?
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.
What is the 2s complement?
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.
What is the 2s complement of 2?
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.
What is the value of 6 - 2 using 2s complement negative numbers ?
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..
What is the value of -2 - 6 using 2s complement negative numbers?
What do synthesisers do?
convert the behavioural model into the most suitable structural model for the physical technology
Behavioural vs Structural modelling
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
Does a always_comb block need a need begin/end statements if the block only consists of 1 clause?
No it doesn’t.
What is a case statement?
Explain how it works with reference to the attached module.
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.
What does this line say?
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
Write a 4:1 MUX using always_comb
Write a 4:1 Mux using a case statement
200ps B = 2;
What does this mean?
Means wait for 200ps of simulation time before continuing execution of the block.