3 The Module data types and operators Flashcards
System Verilog Module?
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.
Module diagram with inputs and outputs?
System verilog internal module structure?
Example of a logic gate AND with 2 input bits.
SystemVerilog supports four basic values that a signal can take on:
SystemVerilog supports four basic values that a signal can take on: 0, 1, X and Z. The data types in SystemVerilog store these values.
Net Data types?
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.
Variable data types?
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.
The most important variable data type?
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.
What are busses?
- 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.
Syntax required to create busses or vectors?
wire [7:0] Sum;
// 8-bit vector called ‘Sum’ of type wire. MSB
// has the index 7 and LSB has the index 0.
logic [15:0] Q;
// 16-bit vector called ‘Q’ of type logic.
logic [11:0] address;
// This defines a 12-bit vector called ‘address’
// of type logic.
How can individual bits within the vector be addressed?
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 can groups of bits be addressed?
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’
What are arrays?
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.
Syntax required for array configuration?
Logic [7:0] Mem [0:9];
// Defines an array of 10 vectors of type logic,
// where each vector is composed of 8 bits
Integer A [0:99];
// Defines an array of 100 integers
Mem Map?
logic [7:0] Mem [0:9];
Numbers in SystemVerilog use the following syntax:
<size_in_bits>'<base></base>
<value></value></size_in_bits>
System verilog number displays
2’b11 // 2 bit number with value 11
4’b1010 // 4 bit number with value 1010
8’b00110101 // 8 bit number with value 00110101