Teach Remote lab lessons

Teach lesson

Find the missing stroke · Verilog

A display shows 0, 1 and 3 correctly, but its 2 is missing a stroke. Diagnose a single decoder bit and prove which digit it affects.

  • RealDigital BooleanBoard FPGA
  • 45 min
  • Upper secondary, technical college or first-year engineering
  • English
  • Electronics · Technology

Sign in with an educator account to prepare a class session. Students join with a class code.

Segment positions a through g with their D0_seg bit numbers. A zero lights the segment.
RealDigital BooleanBoard FPGA

Learning Outcomes

  • Decode an active-low segment pattern and separate shape from digit selection.

Student activity preview

Activity Content

Preview only. In a class session, students can fill in responses and submit their work to the teacher.

1

Predict

8 min

A display shows 0, 1 and 3 correctly, but its 2 is missing a stroke. Diagnose a single decoder bit and prove which digit it affects.

Each segment has its own wire. A zero lights a segment on this board. From bit 7 to bit 0 the byte is decimal point, g, f, e, d, c, b, a. Segment a is the top stroke. For a 2, light a, b, d, e and g. A separate active-low digit enable selects where the shape appears. LED8 reports the command for segment a; LED1 and LED0 echo the input.

Write the eight command bits for 2 with the decimal point off. Which bit changes if the top stroke is missing?

2

Build and test

30 min

Starting circuit

Repair just the entry that defines the shape for input 10. Keep the digit enables fixed so that your comparison has one changing variable.

A literal such as 8'hF9 is eight bits written as two hexadecimal digits.

Start with this complete file. The marked line is the part to change.

module leds_mirror(
    input wire [15:0] sw,
    output wire [15:0] led,
    output wire [3:0] D0_a, D1_a,
    output wire [7:0] D0_seg, D1_seg
);

// Output bits from left to right: decimal point, g, f, e, d, c, b, a.
function [7:0] segments;
    input [1:0] value;
    begin
        case (value)
            2'd0: segments = 8'hC0;
            2'd1: segments = 8'hF9;
            2'd2: segments = 8'hA5; // *
            2'd3: segments = 8'hB0;
        endcase
    end
endfunction
assign D0_a = 4'b1110;       // Select digit 0 in the first bank.
assign D0_seg = segments(sw[1:0]);
assign D1_a = 4'b1111;       // Blank the unused bank.
assign D1_seg = 8'hFF;
// LED8 indicates whether the decoder commands the top stroke on.
assign led = {7'd0, ~D0_seg[0], 6'd0, sw[1:0]};

endmodule
  1. Open the editable Boolean Board lab. Paste the starting circuit into the main file (leds_mirror.v) and keep leds_mirror as the top-level design.

  2. Derive the replacement byte from the segment order. Change only the marked decoder entry.

  3. Check that the interface is Standard. Wait for the edit to save, choose Synthesize, wait for success, then choose Upload to FPGA. The board can open directly. If the board picker stays open, choose Upload now under Boolean Board. If it reports temporary unavailability, wait briefly and retry there. Your saved HDL stays in the editor. Find the numbered switches and the board camera.

  4. Wait for the camera to refresh after each change. Select 01, 10 and 11 with SW1 SW0. For each one read the physical digit, then check LED8. If the strokes bloom together, compare the same digit position in the 01 and 10 views. Record what you can see there and what LED8 tells you separately.

  5. After your last reading, leave the board and return to this activity. Choose Attach saved code and check that a file appears. Select Mark practice as done and confirm. After filling in your bench notes and explanation, choose Submit work and confirm your submission.

Available in a class session

Reading the board

Segment positions a through g with their D0_seg bit numbers. A zero lights the segment.

Trace the missing stroke to its bit before editing the decoder.

Optional starter for camera glare

If the active digit looks like a bright patch, download this version of the starter. Paste its contents into the same main HDL file, apply your decoder repair again, then synthesize and upload. SW1 and SW0 still choose the digit. With SW3 off, compare SW2 off (full brightness) with SW2 on (one eighth). Choose the view where the lit strokes stand out from the unlit outlines. LED8 still reports the top-stroke command.

Optional starter for camera glare

camera-starter.v

Bench notes

Write the displayed digit and LED8 (on/off) in each row. Label any uncertain camera reading.

Test Observed output

Tested source

Capture the project you synthesized using the activity's code snapshot control.

3

Defend your result

7 min

Use your readings for 1 and 2 to explain what LED8 tells you. If all shapes were correct but one position too far left, which output would you investigate?

Turn this preview into a live class session

Continue to LabsLand Teach to use this lesson with your students and review the access available to your account.