This problem set closes the Data Types, Operators & Parameters chapter. Each article's practice exercise and drills cover one idea; these 7 problems mix the whole chapter, so part of the work is deciding which idea applies.

Most problems hand you code to extend, fix or review rather than a blank file. Each one runs in ChipVerify Lab, and when your design fails, the grader explains what went wrong and which article covers it.

7 problems | Beginner Level

What You'll Learn

  • Keep additions and comparisons signed when they mix negative values
  • Size intermediate results so nothing overflows before it is used
  • Choose between shifting and dividing when you halve a signed value
  • Pack fields with concatenation and widen signed values correctly
  • Write modules whose widths and limits all follow a parameter

What You'll Build

Across the set you build the front end of a sensor interface. Each raw reading gets a per-channel calibration trim and a rounding bit, is clamped to the output width with a saturation flag, and is reported in a status word.

Each problem adds or hardens one piece, and the last problem puts them together into a unit that works for 8-bit and 12-bit sensors.

OutputMeaningBuilt in
yThe calibrated, clamped readingProblems 1 to 4
satSaturation flagProblems 4 and 6
wordStatus word with channel, flag and readingProblem 5

The Problems

Work through the problems in order: later problems reuse what you built in earlier ones. Each starts with a short spec and, for the first few, a testbench you can run before you submit.

1

Calibrate a readingFix

A calibration adder passes its bench test. Make it right for every reading and trim before it ships.

Practise: Signed values in an addition
Builds on: Verilog Arithmetic Operators, Verilog Data Types

Open in ChipVerify Lab →
2

Add a rounding bitConstrain

Add a 1-bit rounding term to the calibrated reading without changing its port.

Practise: Mixing a 1-bit value into a signed sum
Builds on: Verilog Arithmetic Operators, Verilog Data Types

Open in ChipVerify Lab →
3

Average two readingsExtend

Average two signed readings, rounding down, for every pair of inputs.

Practise: Intermediate widths and signed rounding
Builds on: Verilog Arithmetic Operators, Verilog Operators

Open in ChipVerify Lab →
4

Review the generated clampReview

An AI assistant wrote a clamp and a testbench that passes. Review both before the code is merged.

Practise: Reviewing generated RTL and its testbench
Builds on: Verilog Operators, Verilog Arithmetic Operators

Open in ChipVerify Lab →
5

Pack the status wordExtend

Pack a reading and its flags into a status word, then unpack it on a wider bus.

Practise: Concatenation, replication and sign extension
Builds on: Verilog Concatenation, Verilog Scalar and Vector

Open in ChipVerify Lab →
6

Make it work at any widthFix

A saturating adder works at 8 bits. Make it work for the 12-bit sensor too.

Practise: Deriving widths and limits from a parameter
Builds on: Verilog Parameters, Verilog Arithmetic Operators

Open in ChipVerify Lab →
7

The sample unitWrite

Combine the trim table, calibration, clamp and status word into one parameterized unit.

Practise: Putting the chapter together
Builds on: Verilog Data Types, Verilog Scalar and Vector, Verilog Operators, Verilog Arithmetic Operators, Verilog Concatenation, Verilog Arrays and Memories, Verilog Parameters

Open in ChipVerify Lab →

How Your Solution Is Graded

Every problem has a visible testbench that you can run and edit. When you submit, a hidden grading testbench checks every input value or thousands of random ones, at more than one width for the parameterized problems, and the design is synthesized to check that it contains no latches.

When a check fails, the console ends with a short list of what to look into. Each item explains the mistake in terms of the hardware and names the article section that covers it.

Before You Start

The problems use the ideas from the articles in this chapter, especially signed arithmetic, bit widths, concatenation and parameters. If a problem stops you, the article it builds on is the place to look.

After This Chapter

The sample unit is combinational apart from its trim table. The Sequential Logic chapter shows how to register its output and add a valid flag, so the front end can run at a fixed clock rate.

Did you find what you were looking for?

Quiz

No quiz questions available for this article.

Cron Job Starts