Skip to content

Latest commit

ย 

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 

Repository files navigation

๐Ÿ”ฌ Chapter 1 โ€” Verification Guidelines

๐Ÿ“Œ 1.1.2 The Verification Plan

A Verification Plan defines what needs to be verified, how it will be verified, and how we will determine whether the design is sufficiently tested.

๐Ÿงช Main Verification Techniques

๐Ÿ”น Directed Testing Specific test scenarios are created to verify known and important behaviors.

๐Ÿ”น Random Testing Inputs are generated randomly to explore a wider range of possible scenarios and uncover unexpected bugs.

๐Ÿ”น Assertions Assertions continuously check whether specific design properties or rules are satisfied during simulation.

๐Ÿ’ก Simple Examples

Example 1 โ€” Directed Test: For a FIFO, explicitly write data until it becomes FULL, then verify that another write is rejected.

Example 2 โ€” Random Test: Generate random read/write operations and compare the DUT output against a reference model.

๐ŸŽฏ A good verification plan combines multiple techniques rather than relying on only one.


๐Ÿ“š 1.2 The Verification Methodology Manual (VMM)

The Verification Methodology Manual (VMM) introduced a structured approach to developing reusable and scalable verification environments.

๐Ÿ”น VMM techniques were originally developed for use with the OpenVera language.

๐Ÿ”น In 2005, these techniques were extended for SystemVerilog.

๐Ÿ”น VMM was preceded by the Reference Verification Methodology (RVM) for Vera.

๐Ÿ”— Key Point

VMM helped establish systematic verification practices such as:

  • ๐Ÿงฉ Reusable verification components
  • ๐Ÿงช Constrained-random testing
  • ๐Ÿ“Š Functional coverage
  • ๐Ÿ” Structured test environments
  • ๐ŸŽฏ Scalable verification methodologies

๐Ÿ’ก Why Methodologies Matter

Without a methodology, a large verification environment can become difficult to maintain and reuse.

Example 1: A reusable bus verification component can be used across multiple projects.

Example 2: A standardized test structure makes it easier for multiple verification engineers to work on the same project.

๐Ÿš€ Next: Understanding how verification methodologies evolved toward modern SystemVerilog/UVM-based verification.

๐Ÿ”ฌ 1.3 Basic Testbench Functionality

The primary purpose of a testbench is to determine the correctness of the Design Under Test (DUT).

A testbench accomplishes this through the following steps:

๐Ÿงช Basic Testbench Steps

1๏ธโƒฃ Generate Stimulus Create input transactions that exercise the DUT.

2๏ธโƒฃ Apply Stimulus to the DUT Drive the generated inputs into the DUT.

3๏ธโƒฃ Capture the Response Observe and collect the DUT's outputs.

4๏ธโƒฃ Check for Correctness Compare the actual response with the expected response and identify errors.

5๏ธโƒฃ Measure Progress Against Verification Goals Determine how much of the design functionality has been exercised and whether the verification objectives are being achieved.


โš™๏ธ Automatic vs Manual Tasks

Not every verification activity is performed automatically.

๐Ÿ”น Some steps can be automated by the testbench, such as stimulus generation, monitoring, and checking.

๐Ÿ”น Other decisions are manually determined by the verification engineer, such as defining scenarios, expected behavior, and verification goals.

๐Ÿ“Œ The verification methodology you choose determines how these activities are structured and carried out.


๐Ÿ’ก Example 1 โ€” ALU

Generate โ†’ Apply โ†’ Capture โ†’ Check

For an ALU, the testbench may:

  • ๐ŸŽฏ Generate random operands and operations
  • ๐Ÿ“ฅ Apply them to the ALU
  • ๐Ÿ“ค Capture the result
  • ๐Ÿ” Compare it with a reference model
  • ๐Ÿ“Š Track which operations have been verified

๐Ÿ’ก Example 2 โ€” FIFO

For a FIFO, the testbench may:

  • ๐Ÿ“ Generate read/write transactions
  • ๐Ÿ“ฅ Apply them to the FIFO
  • ๐Ÿ‘€ Monitor output data and status flags
  • ๐Ÿ” Compare read data against expected data
  • ๐Ÿ“Š Track coverage of FULL, EMPTY, READ, and WRITE scenarios

๐Ÿ“Œ Key Takeaway

Generate โ†’ Apply โ†’ Capture โ†’ Check โ†’ Measure


๐Ÿ“Œ 1.4 Directed Testing

Directed testing is a verification approach where you study the hardware specification and create a verification plan containing a list of specific tests.

Each test focuses on a particular set of related features of the DUT. Screenshot 2026-09-06 222210

Screenshot 2026-09-06 222611

๐ŸŽฏ Basic Approach

Specification โ†’ Verification Plan โ†’ Test Cases โ†’ DUT โ†’ Check Results

๐Ÿ”น Identify the features from the specification. ๐Ÿ”น Create specific test cases for those features. ๐Ÿ”น Apply the required stimulus. ๐Ÿ”น Check whether the DUT behaves correctly.

๐Ÿ’ก Example 1 โ€” UART

Suppose the UART specification has:

Start-bit detection 8-bit data transmission Parity Stop-bit detection

You could create separate directed tests:

๐Ÿงช Test 1 โ†’ Verify start-bit detection ๐Ÿงช Test 2 โ†’ Verify different data patterns ๐Ÿงช Test 3 โ†’ Verify parity ๐Ÿงช Test 4 โ†’ Verify stop-bit detection ๐Ÿ’ก Example 2 โ€” FIFO

For a FIFO, directed tests could target:

๐Ÿงช Write until FULL ๐Ÿงช Read until EMPTY ๐Ÿงช Attempt write when FULL ๐Ÿงช Attempt read when EMPTY ๐Ÿ“Š Directed vs Random Testing

In the first image, the dashed line represents random testing and the solid line represents directed testing.

The important idea is that random testing can reach different coverage points quickly, while directed testing progresses through explicitly planned scenarios.

๐Ÿ“Œ Key Point: Directed testing is predictable and targeted, but writing enough directed tests for a complex design can become time-consuming.

1.4.1 Constrained-Random Stimulus: Although you want the simulator to generate the stimulus, you donโ€™t want totally random values. You use the SystemVerilog language to describe the format of the stimulus (โ€œaddress is 32-bits; opcode is ADD, SUB or STORE; length < 32 bytesโ€), and the simulator picks values that meet the constraints.

Screenshot 2026-09-06 222501

๐Ÿ“Œ 1.5 Methodology Basics

๐Ÿ”น 1. Constrained-Random Stimulus ๐ŸŽฒ

๐Ÿ”น 2. Functional Coverage ๐Ÿ“Š

๐Ÿ”น 3. Layered Testbench Using Transactors ๐Ÿงฉ

๐Ÿ”น 4. Common Testbench for All Tests โ™ป๏ธ

๐Ÿ”น 5. Keep Test-Specific Code Separate ๐Ÿงฉ

๐Ÿ“Œ Key Takeaway:

A good verification methodology is not just about finding bugs. It is about creating a reusable and measurable process for demonstrating that the DUT meets its specification.


๐Ÿ“Œ 1.6 What Should You Randomize?

๐Ÿ”น 1. Device Configuration โš™๏ธ

๐Ÿ”น 2. Environment Configuration ๐ŸŒ

๐Ÿ”น 3. Input Data ๐Ÿ“ฅ

๐Ÿ”น 4. Protocol Exceptions โš ๏ธ

๐Ÿ”น 5. Errors and Violations ๐Ÿšจ

๐Ÿ”น 6. Delays โฑ๏ธ

๐Ÿ“Œ Key Takeaway

Don't simply randomize everything.

The useful strategy is:

๐ŸŽฒ Randomize โ†’ ๐Ÿ”’ Constrain โ†’ ๐Ÿงช Stimulate โ†’ ๐Ÿ” Check โ†’ ๐Ÿ“Š Measure Coverage


๐Ÿ”ฌ 1.7 The Testbench โ€” Design Environment

The testbench wraps around the Design Under Test (DUT), similar to how a hardware tester connects to a physical chip. ๐Ÿงช TESTBENCH

๐ŸŽฏ Basic Testbench Function

The testbench performs two main activities:

๐Ÿ“ฅ Provide Stimulus โ†’ Sends inputs to the DUT ๐Ÿ“ค Capture Responses โ†’ Observes and checks DUT outputs


๐Ÿ“Œ 1.8 Testbench Components โ€” Bus Functional Models (BFMs)

A testbench can contain multiple Bus Functional Models (BFMs). For example, ๐Ÿ”ต AMBA ๐ŸŸข USB ๐ŸŸ  PCI ๐ŸŸฃ SPI

๐Ÿ“Œ Key Takeaway

Testbench = More than just stimulus

A well-structured testbench can contain:

๐ŸŽฏ Tests โ†’ ๐Ÿ“ฆ Transactions โ†’ ๐Ÿ”„ Transactors/BFMs โ†’ ๐Ÿ”Œ DUT Interface โ†’ ๐Ÿ” Monitors โ†’ ๐Ÿ“Š Checkers


๐Ÿ’ก A Flat Testbench : When you fi rst learned Verilog and started writing tests, they probably looked like the low-level code inSample 1.1 , which does a simplifi ed APB (AMBA Peripheral Bus) Write. (VHDL users may have written similar code).

๐Ÿงช Sample 1.1 โ€” Driving the APB Pins

This example demonstrates a basic low-level Verilog testbench that directly drives APB signals, performs a write operation, and checks the result.

module test(PAddr, PWrite, PSel, PWData, PEnable, Rst, clk);

// Port declarations omitted...

initial begin

    // ๐Ÿ”„ Drive reset
    Rst <= 0;
    #100 Rst <= 1'b1;

    // ๐ŸŽฏ Drive the APB control bus
    @(posedge clk);
    PAddr  <= 16'h50;
    PWData <= 32'h50;
    PWrite <= 1'b1;
    PSel   <= 1'b1;

    // โฑ๏ธ Enable APB access
    @(posedge clk);
    PEnable <= 1'b1;

    @(posedge clk);
    PEnable <= 1'b0;

    // ๐Ÿ” Check the result
    if (top.mem.memory[16'h50] == 32'h50)
        $display("Success");
    else
        $display("Error, wrong value in memory");

    $finish;
end

endmodule ๐Ÿ“Œ Description ๐Ÿ”„ Reset: Initializes the DUT into a known state. ๐ŸŽฏ APB Control Bus: Drives address, data, write, and select signals. โฑ๏ธ PEnable: Enables the APB access for one clock cycle. ๐Ÿ” Result Check: Verifies that 32'h50 was correctly written to address 16'h50. ๐Ÿ›‘ $finish: Ends the simulation.

๐Ÿ‘‰ Key Point: This is pin-level testing, where the testbench directly controls the DUT's interface signals.


๐Ÿงช Sample 1.2 โ€” Task to Drive APB Pins

A task is used to make APB write operations reusable.

task write(reg [15:0] addr, reg [31:0] data); @(posedge clk); PAddr <= addr; PWData <= data; PWrite <= 1'b1; PSel <= 1'b1;

@(posedge clk);
PEnable <= 1'b1;

@(posedge clk);
PEnable <= 1'b0;

endtask

๐Ÿ“Œ Key Point: Instead of driving APB pins repeatedly, simply call:

write(16'h50, 32'hABCD);

๐Ÿ‘‰ Task = Reusable APB write operation.


๐Ÿงช Sample 1.3 โ€” Low-Level Verilog Test

This example shows a simple Verilog test using the tasks from Sample 1.2.

๐Ÿ”น Test Flow Reset โ†’ Write Data โ†’ Check Result โ†’ Finish ๐Ÿ”„ reset() โ†’ Resets the DUT. โœ๏ธ write(16'h50, 32'h50) โ†’ Writes data into memory. ๐Ÿ” Checks whether memory location 16'h50 contains 32'h50. โœ… Match โ†’ Success โŒ Mismatch โ†’ Error ๐Ÿ›‘ $finish โ†’ Ends simulation.

๐Ÿ“Œ Key Point: Sample 1.3 is called a low-level Verilog test because the test still directly depends on Verilog tasks and DUT-level details.

๐Ÿ‘‰ Sample 1.1: Directly drives APB pins ๐Ÿ‘‰ Sample 1.2: Encapsulates pin driving into a task ๐Ÿ‘‰ Sample 1.3: Uses the task to create a complete test case

๐Ÿ”Œ The Signal and Command Layers

๐Ÿ“Œ 1. Signal Layer

๐Ÿ“Œ 2. Command Layer

๐Ÿš— Driver โ†’ Converts commands into DUT input signals. ๐Ÿ‘€ Monitor โ†’ Observes DUT output signals and groups them into commands. ๐ŸŽฏ Assertions โ†’ Check individual signals and behavior across complete commands.

Screenshot 2026-09-06 221110

๐Ÿ”ฌ Figure 1.10 โ€” Testbench with Functional Layer The Functional Layer is added above the Command and Signal layers to work with high-level functionality.

๐Ÿ“Œ Functional Layer Components โš™๏ธ Agent โ†’ Connects the functional layer with the command layer. ๐Ÿ“Š Scoreboard โ†’ Compares expected results with actual results. ๐Ÿ” Checker โ†’ Determines whether the DUT behavior is correct.

Screenshot 2026-09-06 221328

๐ŸŽฏ The Scenario Layer The Scenario Layer is the highest layer of the testbench. It is driven by the Generator and defines complete, realistic operations that the DUT should perform.

๐Ÿ“Œ What is a Scenario?

A scenario is a sequence of operations that represents a particular use case or task.

For example, in a music player:

๐ŸŽต Play music from storage ๐Ÿ“ฅ Download a new song ๐Ÿ”Š Adjust volume โฉ Change tracks Screenshot 2026-09-06 221430

๐Ÿ”ฌ Fig. 1.12 โ€” Full Testbench with All Layers

This figure shows a complete layered testbench, including the Scenario, Functional, Command, and Signal layers.

๐Ÿ“Œ Main Components ๐Ÿงช Test โ†’ Starts and controls the verification scenario. ๐ŸŽฏ Generator โ†’ Generates scenarios/transactions. โš™๏ธ Agent โ†’ Connects the generator to the lower-level components. ๐Ÿš— Driver โ†’ Converts transactions into DUT signals. ๐Ÿ” Assertions โ†’ Check signal-level and protocol behavior. ๐Ÿ‘€ Monitor โ†’ Observes DUT signals and collects responses. ๐Ÿ“Š Scoreboard โ†’ Compares expected and actual results. โœ… Checker โ†’ Determines whether the DUT behavior is correct. ๐Ÿ“ˆ Functional Coverage โ†’ Measures which required functionality has been exercised. Screenshot 2026-09-06 221554

๐Ÿงช Exercise 1 โ€” ALU Verification Plan ๐Ÿ“Œ DUT Specifications ๐Ÿ”„ Reset: Asynchronous, active HIGH โฑ๏ธ Clock: Input clock ๐Ÿ“ฅ A: 4-bit signed input ๐Ÿ“ฅ B: 4-bit signed input ๐Ÿ“ค C: 5-bit signed registered output โš™๏ธ C updates: Positive edge of clock ๐Ÿ”ข Opcodes: 4 operations

solution: module alu ( input logic clk, input logic reset, input logic signed [3:0] A, input logic signed [3:0] B, input logic [1:0] opcode, output logic signed [4:0] C );

always_ff @(posedge clk or posedge reset) begin
    if (reset)
        C <= 5'sd0;
    else begin
        case (opcode)
            2'b00: C <= A + B;
            2'b01: C <= A - B;
            2'b10: C <= ~A;
            2'b11: C <= |B;
        endcase
    end
end

endmodule

module alu_tb;

logic clk;
logic reset;
logic signed [3:0] A, B;
logic [1:0] opcode;
logic signed [4:0] C;

// Opcode definitions
localparam ADD    = 2'b00;
localparam SUB    = 2'b01;
localparam INV    = 2'b10;
localparam RED_OR = 2'b11;

// DUT
alu dut (
    .clk    (clk),
    .reset  (reset),
    .A      (A),
    .B      (B),
    .opcode (opcode),
    .C      (C)
);

// Clock generation
always #5 clk = ~clk;

initial begin
    clk   = 0;
    reset = 0;
    A     = 0;
    B     = 0;
    opcode = ADD;

    // Asynchronous active-high reset
    #2 reset = 1;
    #2 reset = 0;

    // ADD
    A = 4'sd5;
    B = 4'sd3;
    opcode = ADD;
    @(posedge clk);
    #1 $display("ADD: A=%0d B=%0d C=%0d", A, B, C);

    // SUB
    A = 4'sd7;
    B = 4'sd3;
    opcode = SUB;
    @(posedge clk);
    #1 $display("SUB: A=%0d B=%0d C=%0d", A, B, C);

    // INVERT A
    A = 4'b1010;
    opcode = INV;
    @(posedge clk);
    #1 $display("INV: A=%b C=%b", A, C);

    // REDUCTION OR B
    B = 4'b0001;
    opcode = RED_OR;
    @(posedge clk);
    #1 $display("RED_OR: B=%b C=%b", B, C);

    $finish;
end

endmodule


๐Ÿ“˜ Chapter 2 โ€” SystemVerilog Data Types

SystemVerilog provides improved data types and data structures for better performance, less memory, and easier verification.

๐Ÿ”น Key Features โšก Two-State Types โ†’ bit, int โ†’ better performance & less memory ๐Ÿ“ฆ Queues โ†’ Variable-size storage with built-in push/pop ๐Ÿ“Š Dynamic Arrays โ†’ Size decided at runtime ๐Ÿ”‘ Associative Arrays โ†’ Key-based storage & searching ๐Ÿ—๏ธ Classes & Structures โ†’ Organize complex data ๐Ÿ”„ Unions & Packed Structures โ†’ Multiple views of same data ๐Ÿ“ Strings โ†’ Built-in text handling ๐Ÿ”ข Enumerated Types โ†’ Readable and meaningful values ๐ŸŽฏ Main Benefit

SystemVerilog = Flexible + Efficient + Verification-friendly data structures ๐Ÿš€


๐Ÿ“˜ 2.1 โ€” Built-In Data Types

SystemVerilog provides several built-in data types for storing different kinds of data.

๐Ÿ”น Main Categories ๐Ÿ”ข Integer Types โ†’ bit, logic, reg, int, integer ๐Ÿ”ค String Type โ†’ string ๐Ÿ”ข Enumerated Type โ†’ enum ๐Ÿ“ฆ Structure Type โ†’ struct ๐Ÿ”„ Union Type โ†’ union โญ Important Classification

2-State: bit, byte, shortint, int, longint

โžก๏ธ Stores only 0 and 1 โšก

4-State: logic, reg, integer, time

โžก๏ธ Stores 0, 1, X, Z ๐Ÿ”ฌ

๐ŸŽฏ Remember

2-state โ†’ 0, 1 4-state โ†’ 0, 1, X, Z

int i; // 32-bit, 2-state, signed int unsigned ui; // 32-bit, 2-state, unsigned

byte b8; // 8-bit signed shortint s; // 16-bit signed longint l; // 64-bit signed

integer i4; // 32-bit, 4-state signed time t; // 64-bit, 4-state unsigned real r; // floating-point

Type States Size Signed?
bit 2-state 1 bit โŒ Unsigned
bit [31:0] 2-state 32 bit โŒ Unsigned
int unsigned 2-state 32 bit โŒ Unsigned
int 2-state 32 bit โœ… Signed
byte 2-state 8 bit โœ… Signed
shortint 2-state 16 bit โœ… Signed
longint 2-state 64 bit โœ… Signed
integer 4-state 32 bit โœ… Signed
time 4-state 64 bit โŒ Unsigned
real 2-state 64-bit floating point โ€”

๐Ÿง  Easy Memory Trick 2-state: 0, 1 โšก 4-state: 0, 1, X, Z ๐Ÿ”ฌ Signed: Can represent โž• positive and โž– negative numbers.

Screenshot 2026-09-07 220434 Screenshot 2026-09-07 220427

๐Ÿ“˜ 2.2 Fixed-Size Arrays Fixed-size array = Array whose size is known at compile time and cannot change during simulation. ๐Ÿ“ฆ

Screenshot 2026-09-07 220720

SystemVerilog has the $clog2() function that calculates the ceiling of log base 2,

Screenshot 2026-09-07 220831 Screenshot 2026-09-07 220906 Screenshot 2026-09-07 221000

๐Ÿ“˜ 2.2.2 โ€” Array Literal

An array literal is a way to initialize an array with values directly using '{' and '}'. ๐Ÿงฉ Screenshot 2026-09-07 221121

Screenshot 2026-09-07 221137

๐Ÿ“˜ 2.2.3 โ€” Basic Array Operations: for & foreach Both for and foreach are used to access array elements. ๐Ÿ”ข

Screenshot 2026-09-07 221239 Screenshot 2026-09-07 221259 Screenshot 2026-09-07 221324 Screenshot 2026-09-07 221413

๐Ÿ“˜ Basic Array Operations โ€” Copy & Compare

Screenshot 2026-09-07 222207

๐Ÿ“˜ Bit and Array Subscripts โ€” Together at Last

SystemVerilog allows you to combine bit/part-selects with array indexes. ๐Ÿ”ข

Screenshot 2026-09-07 222702

Verilog-2001 Improvement โ€” Double Comma in $display

This is a small but useful improvement in Verilog-2001. ๐Ÿ› ๏ธ

๐Ÿ”น Double Comma ,,

In a $display statement, using two commas inserts a space in the output.

Example 1๏ธโƒฃ $display("Hello",,"World");

Output:

Hello World Example 2๏ธโƒฃ int a = 10; int b = 20;

$display("a =",a,,"b =",b);

๐Ÿ“˜ 2.2.6 โ€” Packed Arrays

A packed array is a collection of bits stored continuously next to each other in memory. ๐Ÿ”ข

Screenshot 2026-09-07 222922 Screenshot 2026-09-07 223026

With a single subscript, you get a word of data, barray[0] .With two subscripts, you get a byte of data, barray[0][3] . With three subscripts, you can access a single bit, barray[0][1][6] . Because one dimension is specifi ed after the name, barray[5] , that dimension is unpacked, so you must always give at least one subscript.

๐Ÿ“˜ 2.2.8 โ€” Choosing Between Packed and Unpacked Arrays

The choice depends on what you want the array to represent. ๐Ÿ”ข

๐Ÿ”น Waiting for Array Changes

The @ operator can be used with scalar values and packed arrays.

For example:

logic [7:0] barray[4];

@(barray[0]); // โœ… Legal

But:

@(barray); // โŒ Not legal

because barray is an unpacked array.

To wait for any element of the unpacked array to change:

@(barray[0] or barray[1] or barray[2] or barray[3]); ๐Ÿง  Remember ๐Ÿ”ข Packed array โ†’ useful for scalar conversion and @ event control. ๐Ÿ“ฆ Unpacked array โ†’ useful for storing separate elements/memory. โณ @ works with scalars and packed arrays, not an entire unpacked array.

๐Ÿ“˜ 2.3 โ€” Dynamic Arrays

A dynamic array is an array whose size can be decided and changed at runtime. ๐Ÿ”„

A dynamic array is declared with empty word subscripts [] . This means that you do not specify the array size at compile time; instead, give it at run time. The array is initially empty, so you must call the new[] constructor to allocate space, passing in the number of entries in the square brackets. If you pass an array name to the new[] constructor,

Screenshot 2026-09-07 225153 Screenshot 2026-09-07 225444 Screenshot 2026-09-07 225547

๐Ÿ“˜ 2.4 โ€” Queues

A queue is a variable-size array that stores elements in a specific order. ๐Ÿ“ฆA queue is declared with word subscripts containing a dollar sign: [$] . The elements of a queue are numbered from 0 to $

if you put a $ on the left side of a range, such as [$:2] , the $ stands for the minimum value, [0:2] . A $ on the right side, as in [1:$] , stands for the maximum value, [1:2]

Screenshot 2026-09-07 231132 Screenshot 2026-09-07 231238

๐Ÿ“˜ Chapter 2.5 โ€” Associative Arrays in SystemVerilog ๐Ÿ”ฌ ๐Ÿง  1. What is an Associative Array?

An Associative Array is an unpacked array where elements are accessed using a key/index instead of a fixed size. ๐Ÿ”‘

It is useful when:

๐Ÿ“Œ You don't know the number of elements in advance. ๐Ÿ”‘ You want to access data using meaningful keys. ๐Ÿ’พ You want to avoid allocating unused memory. โœ๏ธ Syntax data_type array_name [index_type];

Screenshot 2026-09-08 220016 Screenshot 2026-09-08 222130 Screenshot 2026-09-08 222120 Screenshot 2026-09-08 222107

๐Ÿ“˜ Chapter 2.6 โ€” Array Methods in SystemVerilog ๐Ÿ”ฌ SystemVerilog provides built-in array methods to search, sort, locate, count, and manipulate array elements. ๐Ÿ› ๏ธ

๐Ÿงฉ 1. Types of Array Methods

Array methods can be broadly divided into:

Category Methods ๐Ÿ” Searching find(), find_index(), find_first(), find_last() ๐Ÿ”ข Counting sum(), count() ๐Ÿ“Š Sorting sort(), rsort() ๐Ÿ”€ Ordering reverse(), shuffle() ๐Ÿงฎ Reduction sum(), product(), and(), or(), xor() ๐Ÿ“ฆ Size/Manipulation size(), delete()

Screenshot 2026-09-08 222408 Screenshot 2026-09-08 222948 Screenshot 2026-09-08 223042 Screenshot 2026-09-08 223154 Screenshot 2026-09-08 224800 Screenshot 2026-09-08 224752 Screenshot 2026-09-08 225554 Screenshot 2026-09-08 225544

๐Ÿ“˜ 2.6.3 โ€” Array Sorting and Ordering ๐Ÿ”ข

SystemVerilog provides built-in methods to sort, reverse, and randomly rearrange array elements. These methods are very useful in verification for organizing transactions and test data. ๐Ÿงช

The main methods are:

Method Purpose sort() โฌ†๏ธ Ascending order rsort() โฌ‡๏ธ Descending order reverse() ๐Ÿ”„ Reverse existing order shuffle() ๐ŸŽฒ Randomly rearrange

Screenshot 2026-09-08 230123 Screenshot 2026-09-08 230114

#SYSTEMVERILOG ASSIGNMENT Screenshot 2026-09-30 183811

Answers:

a. Byte in systemVerilog is 8-bit signed by default -128 to +127

b. my_integer = 32โ€™b0000_1111_xxxx_zzzz; my_int = my_integer; binary = 0000_0000_0000_0000_0000_1111_0000_0000 hex = 00000f00

c. my_bit =16โ€™h8000; 16'h8000 = 1000 0000 0000 0000 2^15 = 32768

d.my_short_int1 = my_bit; binary = 0000_1000_0000_0000 = decimal 2048

c. my_short_int2 = my_short_int1 - 1; binary in 2โ€™complement form = 0111_1111_1111_1111 decimal = 32767

About

No description, website, or topics provided.

Resources

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors