
Explore the fundamentals of class-based verification in Python, building generator, driver, monitor, and scoreboard components, and design transaction classes to apply random stimuli and verify DUT responses.
Develop object-oriented fundamentals in Python for PyUVM by creating independent Generator, Driver, and comparator classes, using class blueprints and instances to manage stimuli, responses, and golden data comparisons.
See how each class instance has a unique memory location, then create independent 4-bit input and output data members, and access or update them with the dot operator.
Learn how to initialize class data members using the __init__ dunder method, access them with self, and provide required or default arguments to create flexible Python objects.
Understand how self identifies a class instance and enables per-instance data access and methods, demonstrated by a First class with a constructor and print methods for F1 and F2.
Explore how self stores the instance address in Python, enabling unique access to data members and methods, and why the first argument self is mandatory in method definitions.
Define and implement the __eq__ double underscore method to compare class instances, using isinstance and data member equality, with examples of Temp instances T1 and T2.
Learn to add user-defined methods to a class, update data members with set_a and set_b, and access values with get_a and get_b using self attributes.
Delete an instance of a class with the del keyword, then verify the deletion by encountering a 'T1' is not defined error when calling its methods.
Explore how inheritance extends a parent class by adding new data members and methods in Python, with examples that include and avoid double underscore methods.
Shows how to initialize parent and child classes with __init__ and super to set a and c. Demonstrates passing a to the parent and validating inheritance.
Understand shallow copy versus deep copy in Python by showing how P1 and P2 may share the same object pointer or create independent data with separate pointers.
Explore shallow copy in Python by copying content between two class instances, P1 and P2, showing shared memory for the attribute a and how updates reflect across both.
Explore deep copy in Python using copy.deepcopy to create an independent P4 from P3, where updates to P4 do not affect P3.
Explore interprocess communication in Python by using a queue to transmit data between functions and classes, with async producers and consumers, blocking put/get, and simple synchronization.
Explore data communication between producer and consumer classes using cocotb queues, implementing async write_data and read_data, exchanging 10 values with delays and parallel execution.
Learn to implement configurable delays in a PyUVM verification environment by adding a delay parameter to the producer and the consumer, using asynchronous timing for 10 random data items.
Explore the default behavior of a queue in PyUVM Series Part 3, where without maxsize the queue grows indefinitely, and the producer-consumer timing and qsize reveal the data flow.
Specify maxsize as 1 to create a bounded queue and observe blocking behavior: put waits when the queue is full while the consumer retrieves items, illustrating producer-consumer synchronization.
Explore how CocoTB events synchronize generator and driver to apply random stimuli to a DUT, coordinating queue data with the clock edge.
Learn how to run write and read tasks in parallel in a pyuvm testbench, sending data through drive.write, using a queue for synchronization, and testing multiple stimuli.
Use a driver with a count and a for loop to generate random data, sending it to the read task with put and synchronizing via an event for multiple transactions.
Explore how a producer and a consumer in two independent classes synchronize using a shared event and queue, exchanging random data across clock cycles in cocotb.
Learn to generate random values for 4-bit A and B in cocotb by extending the Randomized class, using add_rand with a 0–15 range, and calling randomize in the testbench.
Use the randomize_with method to constrain a single variable, A, so it only takes values 0–9 by enforcing A < 10; see generated values like 4, 9, or 0.
Demonstrate standalone constraints by restricting a to 0 to 10 and b to 10 to 15 in a pseudo-random generator, generating 10 random transactions and printing a and b.
Explore adding a combined constraint in PyUVM using addRand and addConstraint to keep A and B unequal across iterations, enforcing alphabetical variable order to avoid errors.
Override constraints on the fly with t.randomize and an overriding lambda a, b to enforce A + B equals five while A and B remain unequal across iterations.
Learn how to add constraints and specify a solving order using solve_order to generate interdependent random values for A, B, and C, ensuring they are not equal.
Implement a dependent constraint by tying A to a three-valued A_range (low, mid, high) and generate A using its range, via a constraint function and add_constraint.
Explore creating a user defined weighted distribution in PyUVM by constraining a variable B to 0, 1, or 2 with specified probabilities, then verify the distribution over multiple iterations.
Get an overview of the Python verification environment, outlining dynamic transaction classes and static components—generator, driver, monitor, and scoreboard—and how they generate, apply, sample, and compare stimuli with the DUT.
Define a transaction class to hold input and output port data, excluding clock and reset, with randomizable input ports and constraints; use a generator to randomize inputs for the driver.
Demonstrate the verification environment: driver applies random stimuli to DUT inputs via a generator and queue, while monitor samples responses for a scoreboard comparison against golden data.
Set up testbench top with generator, driver, monitor, and scoreboard. Configure two queues and an event; generate clock, apply reset via the driver, and run tasks in parallel until completion.
Generate transaction iteration via generator. Send random inputs through queue to driver, which applies them to DUT input port using DUT handler; monitor samples responses and scoreboard checks golden data.
Build the first link of the verification environment by combining the transaction, generator, and driver, using cocotb_coverage.crv to randomize constrained 4-bit inputs A and B for the DUT.
Introduce a generator class with an __init__ constructor, using a queue and event to generate random transactions via count, and send them to a driver for DUT operation, awaiting completion.
Create a driver that receives random transactions from a generator via a queue, applies them as stimuli to a DUT on a rising clock edge, synchronized by an event.
Build a cocotb verification environment with a monitor and scoreboard that sample a dut's 4-bit output Y after a two-clock delay, using the Value method, and compare against expected data.
Establish a shared queue between monitor and scoreboard and implement a transaction class with a DUT handler. Run sample_data and compare_data in parallel for 100 ns to verify results.
Design a verification environment for a 4-bit adder with a 5-bit output. Use A and B as inputs, hold A+B in YT, and route Y to YT on clock edge.
Define a transaction class that aggregates the dut input and output ports, use add_rand and add_constraint for inputs, and orchestrate a generator-scoreboard workflow with events and a data queue.
Explore how a driver receives stimuli from a generator, applies random data to the DUT using a handler, and how a monitor samples results for a scoreboard validation.
Build a testbench top with two queues (generator-driver, monitor-scoreboard) and an event. Run parallel with start_soon, clock 200 nanoseconds, and verify 1 and 8 produce 9 passes.
This comprehensive course is designed to empower software engineers, developers, and verification engineers with advanced Python programming skills for effective Object-Oriented Programming (OOP) and hardware verification tasks. Participants will delve into the fundamentals of Python and explore advanced concepts, including classes, inheritance, copy mechanisms, randomization, inter-process communication with queues, and task synchronization with events. The course will also provide hands-on experience in building a verification environment, encompassing generators, drivers, monitors, and scoreboards for robust Design Under Test (DUT) verification.
Key Topics Covered:
Object-Oriented Programming (OOP) in Python:
Understanding classes and objects
Encapsulation, inheritance, and polymorphism
Method overriding and operator overloading
Copy Mechanisms:
Shallow and deep copy in Python
Best practices for efficient copying
Copying complex data structures
Randomization Techniques:
Utilizing the 'random' module for pseudo-random number generation
Randomizing data for diverse test scenarios
Seed management for reproducibility
Inter-Process Communication:
Introduction to Python multiprocessing
Communication using queues
Synchronization and data exchange between processes
Task Synchronization:
Implementation of event-driven synchronization
Coordinating tasks with events
Avoiding race conditions and deadlocks
Verification Environment:
Designing a verification environment for a Design Under Test (DUT)
Developing generators for stimulus creation
Building robust drivers for interfacing with the DUT
Monitoring and analyzing DUT behavior with monitors
Scoreboarding techniques for result verification
Hands-On Projects:
Participants will engage in practical exercises and projects throughout the course, applying the learned concepts to real-world scenarios. This will include creating a complete verification environment for a sample DUT, incorporating OOP principles, copy mechanisms, randomization, and inter-process communication.
By the end of this course, participants will possess advanced Python skills, enabling them to design and implement efficient and scalable verification environments for hardware designs, while incorporating best practices in OOP and software development. This course is ideal for professionals working in fields such as hardware verification who want to enhance their Python proficiency for building Class based Verification environment in Python.