Class13-Notes
Page 1: Testbench Overview
Top Level Module: The name of the top-level module in this design is testbench.
Module Declaration:
module testbench ();Signal Declarations:
Registers:
reg reset, clock, enable;Wires:
wire [3:0] count_up;,wire [3:0] count_down;,wire z_up, z_down;
Page 2: Module Instantiation
Modules Instantiated: 2 modules are instantiated under the top level.
Instance Names:
counter1,counter2.
Local Signals: Possible local signals include:
z_flagcount_downcount_upz_up
Page 3: Course Information
Course Title: CSE664 Intro. To SoC Design
Lecture Number: Lecture 13
Institution: Engineering @ Syracuse
Page 4: Verilog Data Types
Verilog Data Types:
Reg:
Can be used for outputs in both combinational and sequential circuits.
Wire:
For implementing combinational circuit outputs.
Verilog Assignments:
Continuous Assignment:
assign x = a + b + c;(requiresxto be a wire type).Procedural Assignment:
Initial Procedure
Always Procedure
Destinations in always/initial procedures can only be reg type.
Assignment Types:
Blocking Assignment: Assigns values instantaneously.
Non-blocking Assignment: Assigns values after a delay (
<=).
Page 5: Blocking vs. Non-blocking Assignments
Observational Difference: The handling of assignments in procedures can differ dramatically under conditions of blocking vs. non-blocking.
Page 6: Non-blocking Assignment Behavior
Behavior of Non-blocking Assignments:
Example 1:
Initial state:
a = 0;On
posedge clk:a = 1;,b = a;,c = b;.
Example 2:
Initial state:
a = 0;On
posedge clk:a <= 1;,b <= a;,c <= b;.
Behavior can simplify computations (e.g., c = 1).
Page 7: Signals z_flag and z_reg
True or False Statements:
Z_reg Output: is the output of a register.
Z_flag Output: is the output of a NOR gate.
Assertion Timing: Z_reg is asserted earlier than z_flag; Z_flag is asserted earlier than z_reg.
High States During Reset: Z_flag is high during reset; Z_reg is not.
Page 8: Count-up / Count-down Logic
Module Constructor: Initializations for count-up and count-down conducted upon reset.
Conditional Logic:
If
enableis high, count-up increments and count-down decrements.
Requirement for Equal Flag: Must be high when count_down equals count_up.
Page 9: Equal Flag Design Examples
Correct Designs:
A, B, and C are all candidates for correct implementations of the equal flag, with possibilities for combinations.
Page 10: Combinational Logic Using Procedural Assignment
Sensitivity Check: All inputs must be included in the sensitivity list.
General Structure:
always @(in_1, in_2, …, in_n)implemented for combinational blocks.
Page 11: Reset Timing for count_up
Timing Reset to 0: Identifying exact timing when count_up resets can be derived from multiple choice questions; likely answers focus on ns after certain periods.
Page 12: Synchronous vs. Asynchronous Reset
Asynchronous Reset Logic: Implementing reset in the sensitivity list captures behavior correctly during clock pulses.
Page 13: Reset Active Logic
Synchronous Reset Design: Instructions for resetting count on clock edges, presence of active inputs to affect counting logic.
Page 14: Potential Contention in Design
Key Statements to Evaluate:
Conditions under which
count_upandcount_downoperate correctly and the risks of contention when both signals may simultaneously be updated.
Page 15: ModelSim Getting Started
Setup Environment: Create directory structure for files.
Initial Commands: Utilize
vlibandvlogfor library setup and file compilation.
Page 16: Running Simulation in ModelSim
Testing Structures: Top level testbench serves as primary focus for simulation.
Page 17: ModelSim User Interface Features
View Design Hierarchy: Use the instances pane for comprehensive signal management.
Page 18: Running Simulation and Observing Signals
Execution Tips: How to manage run duration for monitoring signal behavior.
Page 19: Observation Tasks in Simulation
Comparative Analysis: Evaluate signals from different module levels and resolve contention issues as they arise in testing.
Page 20: Modifying Designs in ModelSim
Experimentation Procedures: Steps for modifying design files and testing each design iteration in the software environment.