S7.3.1 Baud Divider from the System Clock

EasyImplement12 minIcarus Verilog · serverReview the topic

Program the terminal count for a tick generator before a board changes its system clock.

Hardware context: ap_soc serial peripherals. Console and flash bring-up

A local UART counts system edges starting at zero. On the edge seeing TOP it emits a sample tick and restarts from zero.

This worksheet uses named constants. The first three entries show how to record your decisions.

Signals in the Timeline

SignalWidthRole
question8input of each check
Full specification

All rates are exercise values. UART sends one bit per symbol. A receiver using M samples per bit needs M ticks in each bit period. The BOARD entries divide exactly. The final ticket has its own rounding rule.

EntryYour decision
BOARD_016 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
BOARD_132 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
BOARD_248 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
BOARD_324 MHz, 3 Mbaud, 1 tick(s) per bit. Enter TOP.
BOARD_464 MHz, 2 Mbaud, 8 tick(s) per bit. Enter TOP.
BOARD_596 MHz, 3 Mbaud, 16 tick(s) per bit. Enter TOP.
BOARD_680 MHz, 1 Mbaud, 16 tick(s) per bit. Enter TOP.
BOARD_7128 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
BOARD_8255 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
BOARD_916 MHz, 1 Mbaud, 16 tick(s) per bit. Enter TOP.
BOARD_10256 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
ROUNDED_TOPClock 50 MHz, RATE in Mbaud, one tick per bit. Round periods per bit to nearest integer, ties upward. Enter TOP.

Examples

Example 1

BOARD 0
Input
16 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
Output
TOP = 15

Each tick takes 16 clock periods. Count zero as the first state.

Example 2

BOARD 1
Input
32 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
Output
TOP = 31

Each tick takes 32 clock periods. Count zero as the first state.

Example 3

BOARD 2
Input
48 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
Output
TOP = 47

Each tick takes 48 clock periods. Count zero as the first state.

Constraints and Contract

  • Keep the parameter and named constants. Use the numeric codes and units on this page.
  • For ROUNDED_TOP, enter a constant expression using RATE. Only this entry changes with the parameter. The supported integer range is 1 through 8, inclusive.

Hints

Hint 1

Use the sample rate when the receiver oversamples.

Hint 2

Divide the system rate by the required tick rate.

Hint 3

Label the first period zero.

What the grader checks: Each check compares the full eight-bit answer. Parameter trials change one condition and keep the other decisions fixed.

16 checks on Icarus Verilog · server. Run the examples first, then check the full regression. Full checks use the server judge. Downloads contain your source only; samples require the simulation service. A passing result establishes the tested cases, not a proof for all possible inputs.

See all 2 problems on this path

Report a problem with this page

Your code SystemVerilogSaved locally
Ln 1, Col 1Tab indents · Ctrl/⌘ + Enter runs samples
Not run yet

BOARD 0

Input
16 MHz, 1 Mbaud, 1 tick(s) per bit. Enter TOP.
Expected output
TOP = 15

Each tick takes 16 clock periods. Count zero as the first state.

Run samples executes all 3 public checks. Check all tests runs 16 checks on the server.

Icarus Verilog · server