3 The Module data types and operators Flashcards

1
Q

System Verilog Module?

A

A SystemVerilog design describes the hardware module of a system. This design, which will carry out some function, will eventually be synthesised into hardware.

The main component of a SystemVerilog design is the module which includes the interface to the system and description of the behaviour.

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

Module diagram with inputs and outputs?

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

System verilog internal module structure?

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

Example of a logic gate AND with 2 input bits.

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

SystemVerilog supports four basic values that a signal can take on:

A

SystemVerilog supports four basic values that a signal can take on: 0, 1, X and Z. The data types in SystemVerilog store these values.

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

Net Data types?

A

Net data types model the interconnection between components and can take values 0, 1, X and Z. The most common net data type is the wire.

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

Variable data types?

A

SystemVerilog contains many types that model storage which are called variable data types. These data types hold the value assigned to them until their next assignment.

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

The most important variable data type?

A

The most important variable data type is logic, which is 4-valued and allows to represent values 0, 1, X, Z, and is useful to create warnings in simulations if a value is not set.

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

What are busses?

A
  • It is often necessary to handle multi-bit values (busses).
  • SystemVerilog allows to create busses or vectors, which are one-dimensional array of elements.
  • Net data types and variable data types can be used to create busses.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Syntax required to create busses or vectors?

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

wire [7:0] Sum;

A

// 8-bit vector called ‘Sum’ of type wire. MSB

// has the index 7 and LSB has the index 0.

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

logic [15:0] Q;

A

// 16-bit vector called ‘Q’ of type logic.

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

logic [11:0] address;

A

// This defines a 12-bit vector called ‘address’

// of type logic.

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

How can individual bits within the vector be addressed?

A

Individual bits within the vector can be addressed using their index.

address[0]; // This is the least significant bit of the vector ‘address’

address[11]; // This is the most significant bit of the vector ‘address’

address[6]; // This the 7th bit of the vector ‘address’

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

How can groups of bits be addressed?

A

Using an index range

address[3:0]; // This is the lower 4 bits of the vector ‘address’

address[11:8]; // This is the upper 4 bits of the vector ‘address’

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

What are arrays?

A

SystemVerilog also allows to create multidimensional arrays of elements, which can be seen as a “vector of vectors”. Vectors within the array all have the same dimensions.

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

Syntax required for array configuration?

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

Logic [7:0] Mem [0:9];

A

// Defines an array of 10 vectors of type logic,

// where each vector is composed of 8 bits

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

Integer A [0:99];

A

// Defines an array of 100 integers

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

Mem Map?

logic [7:0] Mem [0:9];

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

Numbers in SystemVerilog use the following syntax:

A

<size_in_bits>'<base></base>
<value></value></size_in_bits>

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

System verilog number displays

A

2’b11 // 2 bit number with value 11

4’b1010 // 4 bit number with value 1010

8’b00110101 // 8 bit number with value 00110101

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

How can the readability of numbers be improved?

A
24
Q

The support for numbers in different bases?

A
25
Q

How to sign values?

A

Whether a values is signed of not can make a difference to some operations. Use of the signed keyword in a definition makes the variable signed.

26
Q

How change values from signed to unsigned and visa versa?

A

Arithmetic is automatically signed if all variables passed to the operator are signed. An unsigned value can be converted to signed and vice versa:

signed’(variable)

unsigned’(variable)

27
Q

Example of signed numbers in system verilog?

A
28
Q

What is an enumerated type?

A

An enumerated type (enum) allows the definition of a new variable data type composed by a set of named values.

29
Q

Syntax and examples of enum?

A
30
Q

What are structures?

A

A structure type (struct) allows the creation of a compound variable i.e. a single variable that contains sub-variables.

31
Q

How are structures implemented?

A
32
Q

How are packages used in system verilog?

A

SystemVerilog uses packages to share definitions of new data types between modules. For this, the definitions are stored in a separate file, which is imported to each module that needs the created definitions.

33
Q

The differences between a System Verilog package and an imported package?

A
34
Q

How are tasks used in System Verilog?

A

SystemVerilog allows the use of Tasks to execute common processes. Tasks are useful to split large processes into smaller ones making the code clear, and easy to read and scale.

35
Q

Task syntax in system verilog?

A
36
Q

The function of the assign statement?

A

The use of an assign statement indicates the creation of combinatorial logic. Creates the logic for one wire or a bus of wires.

37
Q

Assign syntax?

A
38
Q

Key information regarding the assign command?

A

Any change on the right-hand side of “=“ will result in an update to the left-hand side. Each individual assignment will run all the time, executed concurrently and synthesised as separate logic circuits.

39
Q

What are bitwise logic operators?

A

Logic operators perform bitwise logic functions on individual bits. The logic operators can be used with a pair of wires or busses (vectors).

40
Q

Bitwise operators when vectors are of different length?

A

If the case of inputs vectors with the same length, each bit in the first vector is operated on by the bit in the same position from the second vector. If the vectors are not the same length, the shorter vector is padded with leading zeros.

41
Q

System Verilog bitwise operators?

A
42
Q

example bitwise logic

logic [3:0] a = 4’b0101;

logic [3:0] b = 4’b0000;

assign b = a > 1;

assign b = a >> 2;

assign b = a ^ a;

assign b = ~a;

A

logic [3:0] a = 4’b0101;

logic [3:0] b = 4’b0000;

assign b = a > 1; // right shift 1 bit, then b = 0010;

assign b = a >> 2; // right shift 2 bits, then b = 0001;

assign b = a ^ a; // a xor a, then b = 0000;

assign b = ~a; // not a, then b = 1010;

43
Q

Boolean logic in system verilog?

A

A Boolean logic operator is one that returns a value of TRUE (1) or FALSE (0) based on a logic operation of the input operations. These operations are used in decision statements.

44
Q

System Verilog boolean operators?

A
45
Q

Boolean operator examples:

!X

X&&Y

X||Y

A

!X // True if all values in X are 0, False otherwise

X&&Y // True if the bitwise AND of X and Y is all ones, False otherwise

X||Y // True if the bitwise OR of X and Y is all ones, False otherwise

46
Q

arithmetic operators system Verilog?

A
47
Q

relational operators?

A

A relational operator is one that returns a value of TRUE (1) or FALSE (0) based on a comparison of two inputs.

48
Q

The relational operators in system Verilog?

A
49
Q

What are conditional operators?

A

SystemVerilog has a conditional operator, ? : , also known as the ternary operator, that can be used to provide a more intuitive approach to modelling logic statements.

50
Q

The syntax for conditional operators?

A
51
Q

assign A = (B == 1) ? C : D;

assign F = (sel == 0) ? A : B;

A

// sets A to C if B is 1, D otherwise

// sets F to A if sel is 0, B otherwise

52
Q

Syntax for a multiplexer in System verilog?

A
53
Q

What is used in complex decision making?

A

When complex decision making is needed, different operators can be combined together with the conditional operator.

54
Q

Example of combining operators?

A

assign A = ((B == 1) && !(C > 4)) ? D : E;

assign F = (!C && (!A || B)) ? 1’b1 : 1’b0;

55
Q
A