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. State Machines

Instructions

  • Start by declaring a new module fsm and add a synchronous always_ff block as you did in the synchronous adder
    • The module should have a clock and asynchronous active-low reset inputs, but you can decide the rest of the inputs and outputs yourself
  • Add enumerated variables for the current and next state, for exmple:
  • typedef enum int unsigned { IDLE = 1, WRITE = 2, ACK = 4} state_t; // verbose: one-hot encoding
    state_t state, next_state;
    
    // OR:
    enum { IDLE, WRITE, ACK } state, next_state; // less verbose
    
    • Decide the states yourself
    • Note that enumeration is a SystemVerilog addition: not supported by Verilog compilers
  • You can declare your state machine in 1-3 procedures:
    • A single always_ff block: for simple state machines, but bigger FSMs get complex
    • always_ff for state transitions + always_comb for next state and ouput logic: usually preferred
    • always_ff for state transitions + separate always_comb blocks for next state and ouput logic
  • a case structure is very useful for next state logic

Experiment with your code.

  • Finally: write a simple testbench for simulating your state machine

Exercise returns

None

(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