You cannot submit this assignment

You need to sign in and enrol to submit exercises.

Objectives

This exercise will introduce basic concepts of SystemVerilog as design language:

  1. Declaring modules in Verilog way
  2. Combinational design using SystemVerilog
  3. Simulation with a .do file

Instructions

The focus in this exercise is to get familiar with the structure and syntax of the SystemVerilog language with a basic combinational example design.

When the simulation environment has been tested it's time to start the first SystemVerilog design. Let's make an asynchronous adder.

  • Create a file adder.sv
  • Start by declaring a module called adder:
  • module adder (operand_a_in,operand_b_in,carry_out,result_out);
    • Include all the input and output ports of the module in the declaration
    • This design takes in two operands and adds them together to the result output
    • The signal carry_out is the ninth output bit

  • Declare ports as inputs or outputs:
  • // Inputs
    input [7:0] operand_a_in;
    input [7:0] operand_b_in;
    // Outputs
    output carry_out;
    output [7:0] result_out;
    
  • Add functionality
  • When ready, end the module with
  • endmodule: adder

Hints for functionality

  • Continuous signal assignment is done by the assign primitive:
assign signal_a = signal_b;
  • Assignments can be concatenated using {}, for example:
assign {bit_a, bit_b} = 2'b01;
is equal to
assign bit_a = 1'b0;
assign bit_b = 1'b1;
  • You can use boolean and arithmetic operations in the assignment
    • The basic arithmetic operators are pretty standard: +, - *, /, %, <<, >> etc

Now the adder should be ready to be simulated. To drive the inputs, you can use the adder.do file in your ex_systemverilog/sim folder.
  • Compile the design as you did for the hello module
  • Simulate with:
  • $ vsim -do sim/adder.do adder

(Helpful?) Tips / good practices / conventions

  • Between sessions you lose the "sourced" paths so if you get an error that the run script cannot find the compiler/simulator run the sourcing script as before
  • Always comment what you're doing in the code! Commenting in SystemVerilog works as in C/C++ i.e. // or /* ... */
  • Remember to indent the code and use descriptive variable/class names (as in the given code package or some other sensible way..), readibility is nice.
  • SystemVerilog resources:
    • SystemVerilog standard: doc/IEEE-1800-2012.pdf

Posting submission...

Earned points

0 / 0

Exercise info

Assignment category
SystemVerilog Intro
Your submissions
0
Deadline
Sunday, 8 February 2026, 23:58
Late submission deadline
Sunday, 22 February 2026, 23:59
Group size
1-3
Total number of submitters
0