diff options
| author | Fuwn <[email protected]> | 2026-02-13 23:28:26 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-13 23:28:26 -0800 |
| commit | 04c8f6f4cf5a6070e6f446f8cb05367c3bfeb94f (patch) | |
| tree | 892709075dd91d0481a6132451c698ce4ec1fb07 | |
| parent | feat(lab_5): Add initial files (diff) | |
| download | cst456-04c8f6f4cf5a6070e6f446f8cb05367c3bfeb94f.tar.xz cst456-04c8f6f4cf5a6070e6f446f8cb05367c3bfeb94f.zip | |
feat(lab_5): Add markdown files
| -rw-r--r-- | lab_5/CST456 Lab5.md | 65 | ||||
| -rw-r--r-- | lab_5/image1.png | bin | 0 -> 6098 bytes | |||
| -rw-r--r-- | lab_5/image2.png | bin | 0 -> 50875 bytes |
3 files changed, 65 insertions, 0 deletions
diff --git a/lab_5/CST456 Lab5.md b/lab_5/CST456 Lab5.md new file mode 100644 index 0000000..9aa5b76 --- /dev/null +++ b/lab_5/CST456 Lab5.md @@ -0,0 +1,65 @@ +# CST456 Lab5 + +**CST456 – Lab 5** + +**Constrained Pseudo-random Testbench** + +**Objective** + +The objective of this lab is to implement a constrained pseudo-random testbench to test the operations and operands of a synchronous arithmetic and logic unit (ALU). The SRC directory contains the following System Verilog files: + + + +**Design Under Verification (DUV)** + +The ALU contains the following ports: + +| **Port Name** | **Signal Type** | **Direction** | **Number of Bits** | +| --- | --- | --- | --- | +| clk | Clock | Input | 1 | +| op_start | Control | Input | 1 | +| operation | Control | Input | 2 | +| operand_a | Data | Input | 8 | +| operand_b | Data | Input | 8 | +| result | Data | Output | 16 | + +At the rising edge of the clock, if op_start is asserted (== 1’b1) then the operation, operand_a, and operand_b signals are latched into the ALU. Exactly two clock cycles later the upper eight bits of the result are read from the result port. The lower eight bits of the result are read from the result port one clock cycle later. The op_start signal is ignored during the middle of an operation. The ALU supports the following operations: + +| **Name** | **Value** | **Description** | +| --- | --- | --- | +| ADD | 2’b00 | operand_a is added to operand_b. Only the lower nine bits of the 16-bit result are used. | +| MULT | 2’b01 | operand_a is multiplied with operand_b. This is an unsigned operation and all sixteen bits of the result are used. | +| OR | 2’b10 | operand_a is bitwise ORed with operand_b. Only the lower eight bits of the 16-bit result are used. | +| AND | 2’b11 | operand_a is bitwise ANDed with operand_b. Only the lower eight bits of the 16-bit result are used. | + +Figure 1 shows a timing diagram for the addition operation, where 255 + 255 = 510. + + + +**Figure 1 - Timing diagram for an addition operation.** + +**Generator** + +The generator is a class that contains the **stimulus** task. (**generator.sv** is given) + +**Scoreboard** + +The scoreboard class stores temporary test data. The scoreboard should include fields for the current operation, operands, and result. + +**Monitor** + +The monitor class passively observes the DUV signals and updates the scoreboard based on the stimuli applied to the DUV and the DUV's responses. The monitor class contains the check task. + +**Testbench** + +Edit the tb.sv file to create the testbench with the generator class, + +scoreboard class, monitor class, and interface. Use the + +`FAIL_UNLESS_EQUAL and `FAIL macros to compare the expected result + +with the tested result. + +**Lab Submission** + +Zip the entire contents of the lab directory and submit it to Canvas. diff --git a/lab_5/image1.png b/lab_5/image1.png Binary files differnew file mode 100644 index 0000000..f66b6a3 --- /dev/null +++ b/lab_5/image1.png diff --git a/lab_5/image2.png b/lab_5/image2.png Binary files differnew file mode 100644 index 0000000..63909a8 --- /dev/null +++ b/lab_5/image2.png |