problem_id stringlengths 7 27 | bundle_relpath stringlengths 25 47 | evaluation_title stringlengths 6 73 | release_level stringclasses 5
values | evaluated_level stringclasses 5
values | evaluation_problem_id stringlengths 3 3 | problem stringlengths 287 16.6k | config_yaml stringlengths 227 1.64k | testbench stringlengths 129 71.8k |
|---|---|---|---|---|---|---|---|---|
101_nand3_gate | bundles/L1_basic/101_nand3_gate | 3-Input NAND Gate | L1_basic | L1 | 101 | # Problem 101: 3-Input NAND Gate
## Description
Implement a 3-input NAND gate. The output should be the logical NAND of three input signals.
## Module Interface
```verilog
module nand3_gate(
input a,
input b,
input c,
output y
);
// Your code here
endmodule
```
## Specification
- Inputs: `a`, ... | problem_id: "101"
title: "3-Input NAND Gate"
level: 1
category: "basic_gates"
description: "Implement a 3-input NAND gate"
module_name: "nand3_gate"
ports:
a:
direction: "input"
width: "1"
b:
direction: "input"
width: "1"
c:
direction: "input"
width: "1"
y:
direction: "output"
w... | `timescale 1ns/1ps
module tb_nand3_gate;
reg a, b, c;
wire y;
// Instantiate the module under test
nand3_gate uut (
.a(a),
.b(b),
.c(c),
.y(y)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing 3-input NAND gate.... |
102_nor3_gate | bundles/L1_basic/102_nor3_gate | 3-Input NOR Gate | L1_basic | L1 | 102 | # Problem 102: 3-Input NOR Gate
## Description
Implement a 3-input NOR gate. The output should be the logical NOR of three input signals.
## Module Interface
```verilog
module nor3_gate(
input a,
input b,
input c,
output y
);
// Your code here
endmodule
```
## Specification
- Inputs: `a`, `b`,... | problem_id: "102"
title: "3-Input NOR Gate"
level: 1
category: "basic_gates"
description: "Implement a 3-input NOR gate"
module_name: "nor3_gate"
ports:
a:
direction: "input"
width: "1"
b:
direction: "input"
width: "1"
c:
direction: "input"
width: "1"
y:
direction: "output"
widt... | `timescale 1ns/1ps
module tb_nor3_gate;
reg a, b, c;
wire y;
// Instantiate the module under test
nor3_gate uut (
.a(a),
.b(b),
.c(c),
.y(y)
);
integer pass_count = 0;
integer fail_count = 0;
task check_result;
input expected;
input int... |
103_xnor3_gate | bundles/L1_basic/103_xnor3_gate | 3-Input XNOR Gate | L1_basic | L1 | 103 | # Problem 103: 3-Input XNOR Gate
## Description
Implement a 3-input XNOR gate. The output is 1 when an even number of inputs are 1 (including zero inputs being 1).
## Module Interface
```verilog
module xnor3_gate(
input a,
input b,
input c,
output y
);
// Your code here
endmodule
```
## Specifi... | problem_id: "103"
title: "3-Input XNOR Gate"
level: 1
category: "basic_gates"
description: "Implement a 3-input XNOR gate"
module_name: "xnor3_gate"
ports:
a:
direction: "input"
width: "1"
b:
direction: "input"
width: "1"
c:
direction: "input"
width: "1"
y:
direction: "output"
w... | `timescale 1ns/1ps
module tb_xnor3_gate;
reg a, b, c;
wire y;
// Instantiate the module under test
xnor3_gate uut (
.a(a),
.b(b),
.c(c),
.y(y)
);
integer pass_count = 0;
integer fail_count = 0;
reg expected;
initial begin
$display("Testing ... |
104_majority3 | bundles/L1_basic/104_majority3 | 3-Input Majority Voter | L1_basic | L1 | 104 | # Problem 104: 3-Input Majority Voter
## Description
Implement a 3-input majority voter circuit. The output is 1 when two or more of the three inputs are 1.
## Module Interface
```verilog
module majority3(
input a,
input b,
input c,
output y
);
// Your code here
endmodule
```
## Specification
... | problem_id: "104"
title: "3-Input Majority Voter"
level: 1
category: "basic_gates"
description: "Implement a 3-input majority voter circuit"
module_name: "majority3"
ports:
a:
direction: "input"
width: "1"
b:
direction: "input"
width: "1"
c:
direction: "input"
width: "1"
y:
directio... | `timescale 1ns/1ps
module tb_majority3;
reg a, b, c;
wire y;
// Instantiate the module under test
majority3 uut (
.a(a),
.b(b),
.c(c),
.y(y)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num;
reg [2:0] inputs;
reg expected;
... |
105_mux16to1 | bundles/L1_basic/105_mux16to1 | 16-to-1 Multiplexer | L1_basic | L1 | 105 | # Problem 105: 16-to-1 Multiplexer
## Description
Implement a 16-to-1 multiplexer. The 4-bit select signal chooses one of the 16 data input bits to route to the output.
## Module Interface
```verilog
module mux16to1(
input [15:0] in,
input [3:0] sel,
output y
);
// Your code here
endmodule
```
## S... | problem_id: "105"
title: "16-to-1 Multiplexer"
level: 1
category: "multiplexers"
description: "Implement a 16-to-1 multiplexer"
module_name: "mux16to1"
ports:
in:
direction: "input"
width: "16"
sel:
direction: "input"
width: "4"
y:
direction: "output"
width: "1"
testbench_file: "testbenc... | `timescale 1ns/1ps
module tb_mux16to1;
reg [15:0] in;
reg [3:0] sel;
wire y;
// Instantiate the module under test
mux16to1 uut (
.in(in),
.sel(sel),
.y(y)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
reg expected;
task c... |
106_demux1to8 | bundles/L1_basic/106_demux1to8 | 1-to-8 Demultiplexer | L1_basic | L1 | 106 | # Problem 106: 1-to-8 Demultiplexer
**Level**: 1 (Basic Combinational Logic)
**Category**: multiplexers
## Description
Design a 1-to-8 demultiplexer that routes a single input bit to one of 8 output lines based on a 3-bit select signal. All non-selected output lines should be driven to 0.
## Module Interface
```ve... | problem_id: '106'
title: 1-to-8 Demultiplexer
level: 1
category: multiplexers
description: 1-to-8 DEMUX routing input to one of 8 outputs based on 3-bit select
module_name: demux1to8
ports:
in:
direction: input
width: 1
sel:
direction: input
width: 3
y:
direction: output
width: 8
testbench... | `timescale 1ns/1ps
module tb_demux1to8;
reg in;
reg [2:0] sel;
wire [7:0] y;
// Instantiate the module under test
demux1to8 uut (
.in(in),
.sel(sel),
.y(y)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing demux1to8... |
107_addsub_16bit | bundles/L1_basic/107_addsub_16bit | 16-bit Adder/Subtractor | L1_basic | L1 | 107 | # Problem 107: 16-bit Adder/Subtractor
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a 16-bit adder/subtractor with a mode select input and a carry/borrow output. When the mode is add, the circuit computes `a + b`. When the mode is subtract, the circuit computes `a - b` usin... | problem_id: '107'
title: 16-bit Adder/Subtractor
level: 1
category: arithmetic
description: 16-bit adder/subtractor with carry/borrow output
module_name: addsub_16bit
ports:
a:
direction: input
width: 16
b:
direction: input
width: 16
sub:
direction: input
width: 1
result:
direction: ... | `timescale 1ns/1ps
module tb_addsub_16bit;
reg [15:0] a;
reg [15:0] b;
reg sub;
wire [15:0] result;
wire cout;
// Instantiate the module under test
addsub_16bit uut (
.a(a),
.b(b),
.sub(sub),
.result(result),
.cout(cout)
);
integer pass_coun... |
108_signed_comp_8bit | bundles/L1_basic/108_signed_comp_8bit | 8-bit Signed Comparator | L1_basic | L1 | 108 | # Problem 108: 8-bit Signed Comparator
**Level**: 1 (Basic Combinational Logic)
**Category**: comparators
## Description
Design an 8-bit signed comparator that compares two 8-bit inputs interpreted as signed two's complement numbers. The circuit produces three mutually exclusive outputs indicating whether `a` is les... | problem_id: '108'
title: 8-bit Signed Comparator
level: 1
category: comparators
description: Compare two 8-bit signed values producing lt, eq, gt outputs
module_name: signed_comp_8bit
ports:
a:
direction: input
width: 8
b:
direction: input
width: 8
lt:
direction: output
width: 1
eq:
... | `timescale 1ns/1ps
module tb_signed_comp_8bit;
reg [7:0] a;
reg [7:0] b;
wire lt;
wire eq;
wire gt;
// Instantiate the module under test
signed_comp_8bit uut (
.a(a),
.b(b),
.lt(lt),
.eq(eq),
.gt(gt)
);
integer pass_count = 0;
integer fa... |
109_unsigned_mult_8x8 | bundles/L1_basic/109_unsigned_mult_8x8 | 8x8 Unsigned Multiplier | L1_basic | L1 | 109 | # Problem 109: 8x8 Unsigned Multiplier
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design an 8-bit by 8-bit unsigned multiplier. The module takes two 8-bit unsigned inputs and produces their 16-bit unsigned product.
## Module Interface
```verilog
module unsigned_mult_8x8(
i... | problem_id: '109'
title: 8x8 Unsigned Multiplier
level: 1
category: arithmetic
description: 8-bit by 8-bit unsigned multiplier producing 16-bit product
module_name: unsigned_mult_8x8
ports:
a:
direction: input
width: 8
b:
direction: input
width: 8
product:
direction: output
width: 16
testb... | `timescale 1ns/1ps
module tb_unsigned_mult_8x8;
reg [7:0] a;
reg [7:0] b;
wire [15:0] product;
// Instantiate the module under test
unsigned_mult_8x8 uut (
.a(a),
.b(b),
.product(product)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
... |
110_popcount_16 | bundles/L1_basic/110_popcount_16 | 16-bit Population Count | L1_basic | L1 | 110 | # Problem 110: 16-bit Population Count
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a population count (popcount) circuit that counts the number of bits set to 1 in a 16-bit input. The output is a 5-bit value representing the count, which can range from 0 (no bits set... | problem_id: '110'
title: 16-bit Population Count
level: 1
category: bit_manipulation
description: Count the number of set bits in a 16-bit input
module_name: popcount_16
ports:
data:
direction: input
width: 16
count:
direction: output
width: 5
testbench_file: testbench.v
timeout_compile: 10
timeout_... | `timescale 1ns/1ps
module tb_popcount_16;
reg [15:0] data;
wire [4:0] count;
// Instantiate the module under test
popcount_16 uut (
.data(data),
.count(count)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing popcount_16...");
... |
111_find_first_one_8 | bundles/L1_basic/111_find_first_one_8 | 8-bit Find First Set Bit | L1_basic | L1 | 111 | # Problem 111: 8-bit Find First Set Bit
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that finds the position of the least-significant set bit (first '1' from the right) in an 8-bit input value.
## Module Interface
```verilog
module find_first... | problem_id: '111'
title: 8-bit Find First Set Bit
level: 1
category: bit_manipulation
description: Find position of least-significant set bit in 8-bit value
module_name: find_first_one_8
ports:
data:
direction: input
width: 8
position:
direction: output
width: 3
valid:
direction: output
wi... | `timescale 1ns/1ps
module tb_find_first_one_8;
reg [7:0] data;
wire [2:0] position;
wire valid;
// Instantiate the module under test
find_first_one_8 uut (
.data(data),
.position(position),
.valid(valid)
);
integer pass_count = 0;
integer fail_count = 0;
i... |
112_priority_encoder_16 | bundles/L1_basic/112_priority_encoder_16 | 16-to-4 Priority Encoder | L1_basic | L1 | 112 | # Problem 112: 16-to-4 Priority Encoder
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Design a 16-to-4 priority encoder that outputs the binary-encoded position of the highest-priority (most significant) active input bit.
## Module Interface
```verilog
module priority_enco... | problem_id: '112'
title: 16-to-4 Priority Encoder
level: 1
category: encoders_decoders
description: 16-to-4 priority encoder encoding highest-priority set bit
module_name: priority_encoder_16
ports:
in:
direction: input
width: 16
out:
direction: output
width: 4
valid:
direction: output
wid... | `timescale 1ns/1ps
module tb_priority_encoder_16;
reg [15:0] in;
wire [3:0] out;
wire valid;
// Instantiate the module under test
priority_encoder_16 uut (
.in(in),
.out(out),
.valid(valid)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
... |
113_bin_to_gray_8 | bundles/L1_basic/113_bin_to_gray_8 | 8-bit Binary to Gray Code | L1_basic | L1 | 113 | # Problem 113: 8-bit Binary to Gray Code Converter
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Design a combinational circuit that converts an 8-bit binary number to its Gray code equivalent.
## Module Interface
```verilog
module bin_to_gray_8(
input [7:0] bin_in,
... | problem_id: '113'
title: 8-bit Binary to Gray Code
level: 1
category: encoders_decoders
description: Convert 8-bit binary to Gray code
module_name: bin_to_gray_8
ports:
bin_in:
direction: input
width: 8
gray_out:
direction: output
width: 8
testbench_file: testbench.v
timeout_compile: 10
timeout_simu... | `timescale 1ns/1ps
module tb_bin_to_gray_8;
reg [7:0] bin_in;
wire [7:0] gray_out;
// Instantiate the module under test
bin_to_gray_8 uut (
.bin_in(bin_in),
.gray_out(gray_out)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing ... |
114_thermo_to_bin | bundles/L1_basic/114_thermo_to_bin | Thermometer to Binary Decoder | L1_basic | L1 | 114 | # Problem 114: 8-bit Thermometer to Binary Decoder
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Design a combinational circuit that converts an 8-bit thermometer-coded input to a 4-bit binary count of set bits.
## Module Interface
```verilog
module thermo_to_bin(
inpu... | problem_id: '114'
title: Thermometer to Binary Decoder
level: 1
category: encoders_decoders
description: Convert 8-bit thermometer code to binary count
module_name: thermo_to_bin
ports:
thermo:
direction: input
width: 8
bin_out:
direction: output
width: 4
testbench_file: testbench.v
timeout_compile:... | `timescale 1ns/1ps
module tb_thermo_to_bin;
reg [7:0] thermo;
wire [3:0] bin_out;
// Instantiate the module under test
thermo_to_bin uut (
.thermo(thermo),
.bin_out(bin_out)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing the... |
115_twos_comp_16 | bundles/L1_basic/115_twos_comp_16 | 16-bit Two's Complement Negate | L1_basic | L1 | 115 | # Problem 115: 16-bit Two's Complement Negate
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that computes the two's complement negation of a 16-bit input value.
## Module Interface
```verilog
module twos_comp_16(
input [15:0] in,
output [15:... | problem_id: '115'
title: 16-bit Two's Complement Negate
level: 1
category: arithmetic
description: 16-bit two's complement negation
module_name: twos_comp_16
ports:
in:
direction: input
width: 16
out:
direction: output
width: 16
testbench_file: testbench.v
timeout_compile: 10
timeout_simulate: 10
re... | `timescale 1ns/1ps
module tb_twos_comp_16;
reg [15:0] in;
wire [15:0] out;
// Instantiate the module under test
twos_comp_16 uut (
.in(in),
.out(out)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing twos_comp_16...");
... |
116_bcd_adder_2digit | bundles/L1_basic/116_bcd_adder_2digit | 2-Digit BCD Adder | L1_basic | L1 | 116 | # Problem 116: 2-Digit BCD Adder
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Implement a 2-digit BCD (Binary-Coded Decimal) adder. Each 8-bit input encodes two BCD digits: the upper nibble represents the tens digit and the lower nibble represents the ones digit. The module adds t... | problem_id: 116
title: 2-Digit BCD Adder
level: 1
category: arithmetic
description: Add two 2-digit BCD numbers with carry out
module_name: bcd_adder_2digit
ports:
a:
direction: input
width: 8
b:
direction: input
width: 8
sum:
direction: output
width: 8
cout:
direction: output
wi... | `timescale 1ns/1ps
module tb_bcd_adder_2digit;
reg [7:0] a;
reg [7:0] b;
wire [7:0] sum;
wire cout;
// Instantiate the module under test
bcd_adder_2digit uut (
.a(a),
.b(b),
.sum(sum),
.cout(cout)
);
integer pass_count = 0;
integer fail_count = 0;
... |
117_barrel_shifter_8 | bundles/L1_basic/117_barrel_shifter_8 | 8-bit Barrel Shifter | L1_basic | L1 | 117 | # Problem 117: 8-bit Barrel Shifter
**Level**: 1 (Basic Combinational Logic)
**Category**: shifters
## Description
Implement an 8-bit barrel shifter that can perform logical left or right shifts by a variable amount (0 to 7 positions). Vacated bit positions are filled with zeros.
## Module Interface
```verilog
mod... | problem_id: 117
title: 8-bit Barrel Shifter
level: 1
category: shifters
description: 8-bit barrel shifter with configurable direction
module_name: barrel_shifter_8
ports:
data:
direction: input
width: 8
shamt:
direction: input
width: 3
dir:
direction: input
width: 1
result:
direction... | `timescale 1ns/1ps
module tb_barrel_shifter_8;
reg [7:0] data;
reg [2:0] shamt;
reg dir;
wire [7:0] result;
// Instantiate the module under test
barrel_shifter_8 uut (
.data(data),
.shamt(shamt),
.dir(dir),
.result(result)
);
integer pass_count = 0;
... |
118_bit_interleave | bundles/L1_basic/118_bit_interleave | Bit Interleaver | L1_basic | L1 | 118 | # Problem 118: Bit Interleaver
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Implement a bit interleaver that takes two 8-bit inputs and produces a 16-bit output by interleaving their bits. Bits from input `a` occupy the odd positions (15, 13, 11, ..., 1) and bits from input ... | problem_id: 118
title: Bit Interleaver
level: 1
category: bit_manipulation
description: Interleave bits from two 8-bit inputs into a 16-bit output
module_name: bit_interleave
ports:
a:
direction: input
width: 8
b:
direction: input
width: 8
result:
direction: output
width: 16
testbench_file... | `timescale 1ns/1ps
module tb_bit_interleave;
reg [7:0] a;
reg [7:0] b;
wire [15:0] result;
// Instantiate the module under test
bit_interleave uut (
.a(a),
.b(b),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$dis... |
119_signed_mult_4x4 | bundles/L1_basic/119_signed_mult_4x4 | 4x4 Signed Multiplier | L1_basic | L1 | 119 | # Problem 119: 4x4 Signed Multiplier
## Description
Implement a 4-bit signed multiplier. Both inputs are 4-bit two's complement signed numbers (range -8 to +7), and the output is their 8-bit signed product.
## Module Interface
```verilog
module signed_mult_4x4(
input [3:0] a,
input [3:0] b,
output [7:0]... | problem_id: "119"
title: "4x4 Signed Multiplier"
level: 1
category: "arithmetic"
description: "Multiply two 4-bit signed numbers"
module_name: "signed_mult_4x4"
ports:
a:
direction: "input"
width: "4"
b:
direction: "input"
width: "4"
product:
direction: "output"
width: "8"
testbench_file... | `timescale 1ns/1ps
module tb_signed_mult_4x4;
reg [3:0] a, b;
wire [7:0] product;
signed_mult_4x4 uut (.a(a), .b(b), .product(product));
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
integer i, j;
reg signed [3:0] sa, sb;
reg signed [7:0] expected;
tas... |
120_ctz_16 | bundles/L1_basic/120_ctz_16 | 16-bit Count Trailing Zeros | L1_basic | L1 | 120 | # Problem 120: 16-bit Count Trailing Zeros
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Implement a combinational circuit that counts the number of trailing zero bits in a 16-bit input, starting from the least significant bit (bit 0) up to the most significant bit (bit 15). ... | problem_id: 120
title: 16-bit Count Trailing Zeros
level: 1
category: bit_manipulation
description: Count the number of trailing zeros in a 16-bit value
module_name: ctz_16
ports:
data:
direction: input
width: 16
count:
direction: output
width: 5
testbench_file: testbench.v
timeout_compile: 10
timeo... | `timescale 1ns/1ps
module tb_ctz_16;
reg [15:0] data;
wire [4:0] count;
// Instantiate the module under test
ctz_16 uut (
.data(data),
.count(count)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing ctz_16...");
// Tes... |
121_cla_adder_4bit | bundles/L1_basic/121_cla_adder_4bit | 4-bit Carry Lookahead Adder | L1_basic | L1 | 121 | # Problem 121: 4-bit Carry Lookahead Adder
## Description
Implement a 4-bit carry lookahead adder (CLA). Unlike a ripple carry adder where each carry depends on the previous stage, a CLA computes all carries simultaneously using generate (G) and propagate (P) signals, resulting in faster addition.
## Module Interfac... | problem_id: "121"
title: 4-bit Carry Lookahead Adder
level: 1
category: arithmetic
description: 4-bit carry lookahead adder with carry in and carry out
module_name: cla_adder_4bit
ports:
a:
direction: input
width: "4"
b:
direction: input
width: "4"
cin:
direction: input
width: "1"
sum:
... | `timescale 1ns/1ps
module tb_cla_adder_4bit;
reg [3:0] a;
reg [3:0] b;
reg cin;
wire [3:0] sum;
wire cout;
// Instantiate the module under test
cla_adder_4bit uut (
.a(a),
.b(b),
.cin(cin),
.sum(sum),
.cout(cout)
);
integer pass_count = 0;
... |
122_ones_comp_8 | bundles/L1_basic/122_ones_comp_8 | 8-bit Ones Complement | L1_basic | L1 | 122 | # Problem 122: 8-bit Ones Complement
## Description
Implement an 8-bit ones complement circuit. The ones complement of a binary number is obtained by inverting (flipping) every bit.
## Module Interface
```verilog
module ones_comp_8(
input [7:0] in_val,
output [7:0] out_val
);
// Your code here
endmodule... | problem_id: "122"
title: 8-bit Ones Complement
level: 1
category: arithmetic
description: 8-bit ones complement (bitwise inversion)
module_name: ones_comp_8
ports:
in_val:
direction: input
width: "8"
out_val:
direction: output
width: "8"
testbench_file: "testbench.v"
timeout_compile: 10
timeout_simu... | `timescale 1ns/1ps
module tb_ones_comp_8;
reg [7:0] in_val;
wire [7:0] out_val;
// Instantiate the module under test
ones_comp_8 uut (
.in_val(in_val),
.out_val(out_val)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task check;
i... |
123_even_parity_gen | bundles/L1_basic/123_even_parity_gen | 8-bit Even Parity Generator | L1_basic | L1 | 123 | # Problem 123: 8-bit Even Parity Generator
## Description
Implement an even parity generator for an 8-bit data input. The parity bit should be set such that the total number of 1s in the data plus the parity bit is even.
## Module Interface
```verilog
module even_parity_gen(
input [7:0] data,
output parity
... | problem_id: "123"
title: 8-bit Even Parity Generator
level: 1
category: bit_manipulation
description: Generate even parity bit for 8-bit data
module_name: even_parity_gen
ports:
data:
direction: input
width: "8"
parity:
direction: output
width: "1"
testbench_file: "testbench.v"
timeout_compile: 10
t... | `timescale 1ns/1ps
module tb_even_parity_gen;
reg [7:0] data;
wire parity;
// Instantiate the module under test
even_parity_gen uut (
.data(data),
.parity(parity)
);
integer pass_count = 0;
integer fail_count = 0;
// Storage for test vectors
reg [7:0] test_data [0... |
124_dual_comp_4bit | bundles/L1_basic/124_dual_comp_4bit | Dual 4-bit Comparator | L1_basic | L1 | 124 | # Problem 124: Dual 4-bit Comparator
## Description
Implement two independent 4-bit unsigned magnitude comparators in a single module. One comparator compares inputs `a` and `b`, and the other compares inputs `c` and `d`. Each comparator produces three mutually exclusive outputs: greater-than, equal, and less-than.
... | problem_id: "124"
title: Dual 4-bit Comparator
level: 1
category: comparators
description: Two independent 4-bit unsigned magnitude comparators
module_name: dual_comp_4bit
ports:
a:
direction: input
width: "4"
b:
direction: input
width: "4"
c:
direction: input
width: "4"
d:
direction... | `timescale 1ns/1ps
module tb_dual_comp_4bit;
reg [3:0] a, b, c, d;
wire ab_gt, ab_eq, ab_lt;
wire cd_gt, cd_eq, cd_lt;
// Instantiate the module under test
dual_comp_4bit uut (
.a(a),
.b(b),
.c(c),
.d(d),
.ab_gt(ab_gt),
.ab_eq(ab_eq),
.ab_lt(... |
125_bitwise_ternary | bundles/L1_basic/125_bitwise_ternary | 8-bit Bitwise Ternary Select | L1_basic | L1 | 125 | # Problem 125: 8-bit Bitwise Ternary Select
## Description
Implement a per-bit ternary selector. For each bit position i (0 to 7), a 2-bit select field chooses from one of three 8-bit inputs.
## Module Interface
```verilog
module bitwise_ternary(
input [7:0] a,
input [7:0] b,
input [7:0] c,
input [1... | problem_id: "125"
title: "8-bit Bitwise Ternary Select"
level: 1
category: "bit_manipulation"
description: "Per-bit ternary selection between three 8-bit inputs"
module_name: "bitwise_ternary"
ports:
a:
direction: "input"
width: "8"
b:
direction: "input"
width: "8"
c:
direction: "input"
w... | `timescale 1ns/1ps
module tb_bitwise_ternary;
reg [7:0] a, b, c;
reg [15:0] sel;
wire [7:0] result;
bitwise_ternary uut (.a(a), .b(b), .c(c), .sel(sel), .result(result));
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task check;
input [7:0] ta, tb, tc;... |
126_gray_counter_comb | bundles/L1_basic/126_gray_counter_comb | 4-bit Gray Code Counter Output | L1_basic | L1 | 126 | # Problem 126: 4-bit Gray Code Counter Output
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Design a combinational circuit that converts a 4-bit binary counter value to its corresponding Gray code output. Gray code is a binary numeral system where two successive values diffe... | problem_id: '126'
title: 4-bit Gray Code Counter Output
level: 1
category: encoders_decoders
description: Convert a 4-bit binary count to its Gray code equivalent
module_name: gray_counter_comb
ports:
binary_count:
direction: input
width: '4'
gray_count:
direction: output
width: '4'
testbench_file: ... | `timescale 1ns/1ps
module tb_gray_counter_comb;
reg [3:0] binary_count;
wire [3:0] gray_count;
// Instantiate the module under test
gray_counter_comb uut (
.binary_count(binary_count),
.gray_count(gray_count)
);
integer pass_count = 0;
integer fail_count = 0;
initial ... |
127_bin_to_onehot | bundles/L1_basic/127_bin_to_onehot | 4-bit Binary to One-Hot Decoder | L1_basic | L1 | 127 | # Problem 127: 4-bit Binary to One-Hot Decoder
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Design a combinational circuit that converts a 4-bit binary input into a 16-bit one-hot encoded output. Exactly one bit of the output should be set high, corresponding to the positio... | problem_id: '127'
title: 4-bit Binary to One-Hot Decoder
level: 1
category: encoders_decoders
description: Convert a 4-bit binary input to a 16-bit one-hot encoded output
module_name: bin_to_onehot
ports:
bin_in:
direction: input
width: '4'
onehot:
direction: output
width: '16'
testbench_file: testb... | `timescale 1ns/1ps
module tb_bin_to_onehot;
reg [3:0] bin_in;
wire [15:0] onehot;
// Instantiate the module under test
bin_to_onehot uut (
.bin_in(bin_in),
.onehot(onehot)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing bin_t... |
128_onehot_to_bin | bundles/L1_basic/128_onehot_to_bin | 16-bit One-Hot to Binary Encoder | L1_basic | L1 | 128 | # Problem 128: 16-bit One-Hot to Binary Encoder
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Design a combinational circuit that converts a 16-bit one-hot encoded input to a 4-bit binary output representing the position of the set bit. The circuit should also produce a vali... | problem_id: '128'
title: 16-bit One-Hot to Binary Encoder
level: 1
category: encoders_decoders
description: Convert a 16-bit one-hot input to its 4-bit binary position with validity check
module_name: onehot_to_bin
ports:
onehot:
direction: input
width: '16'
bin_out:
direction: output
width: '4'
v... | `timescale 1ns/1ps
module tb_onehot_to_bin;
reg [15:0] onehot;
wire [3:0] bin_out;
wire valid;
// Instantiate the module under test
onehot_to_bin uut (
.onehot(onehot),
.bin_out(bin_out),
.valid(valid)
);
integer pass_count = 0;
integer fail_count = 0;
ini... |
129_signed_sat_add_8 | bundles/L1_basic/129_signed_sat_add_8 | 8-bit Signed Saturating Add | L1_basic | L1 | 129 | # Problem 129: 8-bit Signed Saturating Add
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that adds two 8-bit signed (2's complement) numbers with saturation. Instead of wrapping around on overflow, the result should be clamped to the maximum or minimu... | problem_id: '129'
title: 8-bit Signed Saturating Add
level: 1
category: arithmetic
description: Add two 8-bit signed numbers with saturation on overflow
module_name: signed_sat_add_8
ports:
a:
direction: input
width: '8'
b:
direction: input
width: '8'
result:
direction: output
width: '8'
t... | `timescale 1ns/1ps
module tb_signed_sat_add_8;
reg [7:0] a;
reg [7:0] b;
wire [7:0] result;
// Instantiate the module under test
signed_sat_add_8 uut (
.a(a),
.b(b),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$... |
130_signed_abs_8 | bundles/L1_basic/130_signed_abs_8 | 8-bit Absolute Value (Signed) | L1_basic | L1 | 130 | # Problem 130: 8-bit Absolute Value (Signed)
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that computes the absolute value of an 8-bit signed (2's complement) number. The circuit must also detect the special overflow case when the input is -128, whic... | problem_id: '130'
title: 8-bit Absolute Value (Signed)
level: 1
category: arithmetic
description: Compute the absolute value of an 8-bit signed number with overflow detection
module_name: signed_abs_8
ports:
in_val:
direction: input
width: '8'
out_val:
direction: output
width: '8'
overflow:
di... | `timescale 1ns/1ps
module tb_signed_abs_8;
reg [7:0] in_val;
wire [7:0] out_val;
wire overflow;
// Instantiate the module under test
signed_abs_8 uut (
.in_val(in_val),
.out_val(out_val),
.overflow(overflow)
);
integer pass_count = 0;
integer fail_count = 0;
... |
131_bitwise_mux_8 | bundles/L1_basic/131_bitwise_mux_8 | 8-bit Bitwise Multiplexer | L1_basic | L1 | 131 | # Problem 131: 8-bit Bitwise Multiplexer
**Level**: 1 (Basic Combinational Logic)
**Category**: multiplexers
## Description
Implement an 8-bit bitwise multiplexer where each output bit is independently selected from one of two input sources. Unlike a standard multiplexer with a single select signal, this design uses... | problem_id: "131"
title: "8-bit Bitwise Multiplexer"
level: 1
category: "multiplexers"
description: "Implement an 8-bit bitwise multiplexer with per-bit select"
module_name: "bitwise_mux_8"
ports:
a:
direction: "input"
width: "8"
b:
direction: "input"
width: "8"
sel:
direction: "input"
wi... | `timescale 1ns/1ps
module tb_bitwise_mux_8;
reg [7:0] a, b, sel;
wire [7:0] result;
bitwise_mux_8 uut (
.a(a),
.b(b),
.sel(sel),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
reg [7:0] expected;
task check;
input [7:0] exp;... |
132_zero_extend_8to16 | bundles/L1_basic/132_zero_extend_8to16 | 8-bit Zero Extend to 16-bit | L1_basic | L1 | 132 | # Problem 132: 8-bit Zero Extend to 16-bit
**Level**: 1 (Basic Combinational Logic)
**Category**: data_conversion
## Description
Implement a zero-extension circuit that converts an 8-bit input to a 16-bit output by padding the upper 8 bits with zeros. This is a common operation when working with unsigned values that... | problem_id: "132"
title: "8-bit Zero Extend to 16-bit"
level: 1
category: "data_conversion"
description: "Zero-extend an 8-bit input to a 16-bit output"
module_name: "zero_extend_8to16"
ports:
in_val:
direction: "input"
width: "8"
out_val:
direction: "output"
width: "16"
testbench_file: "testbench... | `timescale 1ns/1ps
module tb_zero_extend_8to16;
reg [7:0] in_val;
wire [15:0] out_val;
zero_extend_8to16 uut (
.in_val(in_val),
.out_val(out_val)
);
integer pass_count = 0;
integer fail_count = 0;
task check;
input [15:0] expected;
begin
if (ou... |
133_sign_extend_8to16 | bundles/L1_basic/133_sign_extend_8to16 | 8-bit Sign Extend to 16-bit | L1_basic | L1 | 133 | # Problem 133: 8-bit Sign Extend to 16-bit
**Level**: 1 (Basic Combinational Logic)
**Category**: data_conversion
## Description
Implement a sign-extension circuit that converts an 8-bit signed input to a 16-bit signed output by replicating the most significant bit (sign bit) into the upper 8 bits. This preserves th... | problem_id: "133"
title: "8-bit Sign Extend to 16-bit"
level: 1
category: "data_conversion"
description: "Sign-extend an 8-bit input to a 16-bit output"
module_name: "sign_extend_8to16"
ports:
in_val:
direction: "input"
width: "8"
out_val:
direction: "output"
width: "16"
testbench_file: "testbench... | `timescale 1ns/1ps
module tb_sign_extend_8to16;
reg [7:0] in_val;
wire [15:0] out_val;
sign_extend_8to16 uut (
.in_val(in_val),
.out_val(out_val)
);
integer pass_count = 0;
integer fail_count = 0;
task check;
input [15:0] expected;
begin
if (ou... |
134_ripple_carry_4bit | bundles/L1_basic/134_ripple_carry_4bit | 4-bit Ripple Carry Adder | L1_basic | L1 | 134 | # Problem 134: 4-bit Ripple Carry Adder
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Implement a 4-bit ripple carry adder by chaining full adder logic. The carry output of each bit position ripples into the carry input of the next bit position. You should explicitly implement the ... | problem_id: "134"
title: "4-bit Ripple Carry Adder"
level: 1
category: "arithmetic"
description: "Implement a 4-bit ripple carry adder using full adder chain logic"
module_name: "ripple_carry_4bit"
ports:
a:
direction: "input"
width: "4"
b:
direction: "input"
width: "4"
cin:
direction: "input... | `timescale 1ns/1ps
module tb_ripple_carry_4bit;
reg [3:0] a, b;
reg cin;
wire [3:0] sum;
wire cout;
ripple_carry_4bit uut (
.a(a),
.b(b),
.cin(cin),
.sum(sum),
.cout(cout)
);
integer pass_count = 0;
integer fail_count = 0;
integer i, j, k;
... |
135_mag_comp_4bit_en | bundles/L1_basic/135_mag_comp_4bit_en | 4-bit Magnitude Comparator with Enable | L1_basic | L1 | 135 | # Problem 135: 4-bit Magnitude Comparator with Enable
**Level**: 1 (Basic Combinational Logic)
**Category**: comparators
## Description
Implement a 4-bit unsigned magnitude comparator with an enable input. When enabled, the circuit compares two 4-bit unsigned values and indicates their relative magnitude. When disab... | problem_id: "135"
title: "4-bit Magnitude Comparator with Enable"
level: 1
category: "comparators"
description: "Implement a 4-bit unsigned magnitude comparator with an enable input"
module_name: "mag_comp_4bit_en"
ports:
a:
direction: "input"
width: "4"
b:
direction: "input"
width: "4"
enable:
... | `timescale 1ns/1ps
module tb_mag_comp_4bit_en;
reg [3:0] a, b;
reg enable;
wire gt, eq, lt;
mag_comp_4bit_en uut (
.a(a),
.b(b),
.enable(enable),
.gt(gt),
.eq(eq),
.lt(lt)
);
integer pass_count = 0;
integer fail_count = 0;
task check;
... |
136_cond_negate_8 | bundles/L1_basic/136_cond_negate_8 | 8-bit Conditional Negate | L1_basic | L1 | 136 | # Problem 136: 8-bit Conditional Negate
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Implement an 8-bit conditional negation circuit. When the control signal is asserted, the output is the two's complement negation of the input. Otherwise, the input passes through unchanged.
## M... | problem_id: "136"
title: "8-bit Conditional Negate"
level: 1
category: "arithmetic"
description: "Conditionally negate an 8-bit value using two's complement"
module_name: "cond_negate_8"
ports:
in_val:
direction: "input"
width: "8"
negate:
direction: "input"
width: "1"
out_val:
direction: "ou... | `timescale 1ns/1ps
module tb_cond_negate_8;
reg [7:0] in_val;
reg negate;
wire [7:0] out_val;
// Instantiate the module under test
cond_negate_8 uut (
.in_val(in_val),
.negate(negate),
.out_val(out_val)
);
integer pass_count = 0;
integer fail_count = 0;
in... |
137_max_of_four | bundles/L1_basic/137_max_of_four | 8-bit Maximum of Four | L1_basic | L1 | 137 | # Problem 137: 8-bit Maximum of Four
**Level**: 1 (Basic Combinational Logic)
**Category**: comparators
## Description
Implement a circuit that finds the maximum value among four 8-bit unsigned inputs.
## Module Interface
```verilog
module max_of_four(
input [7:0] a,
input [7:0] b,
input [7:0] c,
i... | problem_id: "137"
title: "8-bit Maximum of Four"
level: 1
category: "comparators"
description: "Find the maximum value among four 8-bit unsigned inputs"
module_name: "max_of_four"
ports:
a:
direction: "input"
width: "8"
b:
direction: "input"
width: "8"
c:
direction: "input"
width: "8"
d... | `timescale 1ns/1ps
module tb_max_of_four;
reg [7:0] a, b, c, d;
wire [7:0] max_val;
// Instantiate the module under test
max_of_four uut (
.a(a),
.b(b),
.c(c),
.d(d),
.max_val(max_val)
);
integer pass_count = 0;
integer fail_count = 0;
initial ... |
138_min_of_four | bundles/L1_basic/138_min_of_four | 8-bit Minimum of Four | L1_basic | L1 | 138 | # Problem 138: 8-bit Minimum of Four
**Level**: 1 (Basic Combinational Logic)
**Category**: comparators
## Description
Implement a circuit that finds the minimum value among four 8-bit unsigned inputs.
## Module Interface
```verilog
module min_of_four(
input [7:0] a,
input [7:0] b,
input [7:0] c,
i... | problem_id: "138"
title: "8-bit Minimum of Four"
level: 1
category: "comparators"
description: "Find the minimum value among four 8-bit unsigned inputs"
module_name: "min_of_four"
ports:
a:
direction: "input"
width: "8"
b:
direction: "input"
width: "8"
c:
direction: "input"
width: "8"
d... | `timescale 1ns/1ps
module tb_min_of_four;
reg [7:0] a, b, c, d;
wire [7:0] min_val;
// Instantiate the module under test
min_of_four uut (
.a(a),
.b(b),
.c(c),
.d(d),
.min_val(min_val)
);
integer pass_count = 0;
integer fail_count = 0;
initial ... |
139_endian_swap_32 | bundles/L1_basic/139_endian_swap_32 | 32-bit Endian Swap | L1_basic | L1 | 139 | # Problem 139: 32-bit Endian Swap
**Level**: 1 (Basic Combinational Logic)
**Category**: data_conversion
## Description
Implement a 32-bit byte-order reversal circuit (endianness swap). The circuit rearranges the four bytes of a 32-bit input so that the most significant byte becomes the least significant byte and vi... | problem_id: "139"
title: "32-bit Endian Swap"
level: 1
category: "data_conversion"
description: "Reverse byte order of a 32-bit value (endianness swap)"
module_name: "endian_swap_32"
ports:
in_val:
direction: "input"
width: "32"
out_val:
direction: "output"
width: "32"
testbench_file: "testbench.v... | `timescale 1ns/1ps
module tb_endian_swap_32;
reg [31:0] in_val;
wire [31:0] out_val;
// Instantiate the module under test
endian_swap_32 uut (
.in_val(in_val),
.out_val(out_val)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing... |
140_priority_resolver_4 | bundles/L1_basic/140_priority_resolver_4 | 4-bit Priority Resolver | L1_basic | L1 | 140 | # Problem 140: 4-bit Priority Resolver
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Implement a 4-bit priority resolver that grants access to only the highest-priority active request. The output is a one-hot signal indicating which request is granted.
## Module Interface
... | problem_id: "140"
title: "4-bit Priority Resolver"
level: 1
category: "encoders_decoders"
description: "Grant only the highest-priority active request as a one-hot output"
module_name: "priority_resolver_4"
ports:
req:
direction: "input"
width: "4"
grant:
direction: "output"
width: "4"
testbench_f... | `timescale 1ns/1ps
module tb_priority_resolver_4;
reg [3:0] req;
wire [3:0] grant;
// Instantiate the module under test
priority_resolver_4 uut (
.req(req),
.grant(grant)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing priori... |
141_arith_rshift_8 | bundles/L1_basic/141_arith_rshift_8 | 8-bit Arithmetic Right Shift | L1_basic | L1 | 141 | # Problem 141: 8-bit Arithmetic Right Shift
**Level**: 1 (Basic Combinational Logic)
**Category**: shifters
## Description
Implement an 8-bit arithmetic right shift unit. Unlike a logical right shift which fills vacated MSBs with zeros, an arithmetic right shift fills vacated MSBs with copies of the original sign bi... | problem_id: "141"
title: "8-bit Arithmetic Right Shift"
level: 1
category: "shifters"
description: "Arithmetic right shift of an 8-bit value by a variable amount, preserving the sign bit"
module_name: "arith_rshift_8"
ports:
data:
direction: "input"
width: "8"
shamt:
direction: "input"
width: "3"
... | `timescale 1ns/1ps
module tb_arith_rshift_8;
reg [7:0] data;
reg [2:0] shamt;
wire [7:0] result;
// Instantiate the module under test
arith_rshift_8 uut (
.data(data),
.shamt(shamt),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
task c... |
142_shift_compare | bundles/L1_basic/142_shift_compare | 8-bit Logical vs Arithmetic Shift Right Comparator | L1_basic | L1 | 142 | # Problem 142: 8-bit Logical vs Arithmetic Shift Right Comparator
**Level**: 1 (Basic Combinational Logic)
**Category**: shifters
## Description
Implement a module that performs both a logical right shift and an arithmetic right shift on an 8-bit input value, and also outputs a flag indicating whether the two result... | problem_id: "142"
title: "8-bit Logical vs Arithmetic Shift Right Comparator"
level: 1
category: "shifters"
description: "Compute both logical and arithmetic right shifts and indicate whether they differ"
module_name: "shift_compare"
ports:
data:
direction: "input"
width: "8"
shamt:
direction: "input"
... | `timescale 1ns/1ps
module tb_shift_compare;
reg [7:0] data;
reg [2:0] shamt;
wire [7:0] logical_result;
wire [7:0] arith_result;
wire differs;
// Instantiate the module under test
shift_compare uut (
.data(data),
.shamt(shamt),
.logical_result(logical_result),
... |
143_bcd_correct_4bit | bundles/L1_basic/143_bcd_correct_4bit | 4-bit Adder with BCD Correction | L1_basic | L1 | 143 | # Problem 143: 4-bit Adder with BCD Correction
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Implement a BCD (Binary-Coded Decimal) correction module. Given a 5-bit binary sum (the raw result of adding two single BCD digits, potentially with a carry-in), produce a corrected 4-bit B... | problem_id: "143"
title: "4-bit Adder with BCD Correction"
level: 1
category: "arithmetic"
description: "Apply BCD correction to a 5-bit binary sum to produce a valid BCD digit and carry"
module_name: "bcd_correct_4bit"
ports:
binary_sum:
direction: "input"
width: "5"
bcd_digit:
direction: "output"
... | `timescale 1ns/1ps
module tb_bcd_correct_4bit;
reg [4:0] binary_sum;
wire [3:0] bcd_digit;
wire carry_out;
// Instantiate the module under test
bcd_correct_4bit uut (
.binary_sum(binary_sum),
.bcd_digit(bcd_digit),
.carry_out(carry_out)
);
integer pass_count = 0;
... |
144_bit_reverse_16 | bundles/L1_basic/144_bit_reverse_16 | 16-bit Bit Reversal | L1_basic | L1 | 144 | # Problem 144: 16-bit Bit Reversal
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Implement a module that reverses the order of all 16 bits in a 16-bit input. Bit 0 of the input becomes bit 15 of the output, bit 1 becomes bit 14, and so on.
## Module Interface
```verilog
mod... | problem_id: "144"
title: "16-bit Bit Reversal"
level: 1
category: "bit_manipulation"
description: "Reverse the bit order of a 16-bit input value"
module_name: "bit_reverse_16"
ports:
data:
direction: "input"
width: "16"
reversed:
direction: "output"
width: "16"
testbench_file: "testbench.v"
timeou... | `timescale 1ns/1ps
module tb_bit_reverse_16;
reg [15:0] data;
wire [15:0] reversed;
bit_reverse_16 uut (
.data(data),
.reversed(reversed)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task check;
input [15:0] in_data;
input [... |
145_hamming_categorize | bundles/L1_basic/145_hamming_categorize | 8-bit Hamming Weight Categorizer | L1_basic | L1 | 145 | # Problem 145: 8-bit Hamming Weight Categorizer
## Description
Implement a circuit that counts the number of set bits (Hamming weight / population count) in an 8-bit input and classifies the bit pattern.
## Module Interface
```verilog
module hamming_categorize(
input [7:0] data,
output [3:0] count,
outp... | problem_id: "145"
title: "8-bit Hamming Weight Categorizer"
level: 1
category: "bit_manipulation"
description: "Count set bits and classify an 8-bit pattern"
module_name: "hamming_categorize"
ports:
data:
direction: "input"
width: "8"
count:
direction: "output"
width: "4"
is_zero:
direction: ... | `timescale 1ns/1ps
module tb_hamming_categorize;
reg [7:0] data;
wire [3:0] count;
wire is_zero, is_one_hot, is_all_ones;
hamming_categorize uut (
.data(data),
.count(count),
.is_zero(is_zero),
.is_one_hot(is_one_hot),
.is_all_ones(is_all_ones)
);
integ... |
146_dual_adder_8 | bundles/L1_basic/146_dual_adder_8 | Dual 8-bit Adder | L1_basic | L1 | 146 | # Problem 146: Dual 8-bit Adder
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Implement a module containing two independent 8-bit unsigned adders. Each adder takes two 8-bit inputs and produces a 9-bit output that includes the carry bit as the MSB. The two adders must operate indep... | problem_id: "146"
title: "Dual 8-bit Adder"
level: 1
category: "arithmetic"
description: "Implement two independent 8-bit adders producing 9-bit results with carry"
module_name: "dual_adder_8"
ports:
a1:
direction: "input"
width: "8"
b1:
direction: "input"
width: "8"
a2:
direction: "input"
... | `timescale 1ns/1ps
module tb_dual_adder_8;
reg [7:0] a1, b1, a2, b2;
wire [8:0] sum1, sum2;
dual_adder_8 uut (
.a1(a1),
.b1(b1),
.a2(a2),
.b2(b2),
.sum1(sum1),
.sum2(sum2)
);
integer pass_count = 0;
integer fail_count = 0;
reg [8:0] exp_sum1... |
147_median_of_three | bundles/L1_basic/147_median_of_three | 8-bit Median of Three | L1_basic | L1 | 147 | # Problem 147: 8-bit Median of Three
**Level**: 1 (Basic Combinational Logic)
**Category**: comparators
## Description
Implement a combinational module that takes three 8-bit unsigned inputs and outputs the median (middle) value. Given three values, the median is the one that is neither the maximum nor the minimum. ... | problem_id: "147"
title: "8-bit Median of Three"
level: 1
category: "comparators"
description: "Find the median (middle value) of three 8-bit unsigned inputs"
module_name: "median_of_three"
ports:
a:
direction: "input"
width: "8"
b:
direction: "input"
width: "8"
c:
direction: "input"
widt... | `timescale 1ns/1ps
module tb_median_of_three;
reg [7:0] a, b, c;
wire [7:0] median;
median_of_three uut (
.a(a),
.b(b),
.c(c),
.median(median)
);
integer pass_count = 0;
integer fail_count = 0;
task check;
input [7:0] ta, tb, tc, expected;
... |
148_wallace_mult_4 | bundles/L1_basic/148_wallace_mult_4 | 4-bit Wallace Tree Multiplier | L1_basic | L1 | 148 | # Problem 148: 4-bit Wallace Tree Multiplier
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Implement a 4-bit unsigned multiplier that computes the 8-bit product of two 4-bit unsigned inputs. The problem is named after the Wallace tree multiplier architecture, but any correct implem... | problem_id: "148"
title: "4-bit Wallace Tree Multiplier"
level: 1
category: "arithmetic"
description: "Implement a 4-bit unsigned multiplier producing an 8-bit product"
module_name: "wallace_mult_4"
ports:
a:
direction: "input"
width: "4"
b:
direction: "input"
width: "4"
product:
direction: "... | `timescale 1ns/1ps
module tb_wallace_mult_4;
reg [3:0] a, b;
wire [7:0] product;
wallace_mult_4 uut (
.a(a),
.b(b),
.product(product)
);
integer pass_count = 0;
integer fail_count = 0;
reg [7:0] expected;
task check;
input [3:0] ta, tb;
input i... |
149_odd_parity_check | bundles/L1_basic/149_odd_parity_check | 8-bit Odd Parity Checker | L1_basic | L1 | 149 | # Problem 149: 8-bit Odd Parity Checker
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Implement an odd parity checker for a 9-bit word consisting of 8 data bits and 1 parity bit. In an odd parity scheme, the total number of 1-bits across all 9 bits (data + parity) should be o... | problem_id: "149"
title: "8-bit Odd Parity Checker"
level: 1
category: "bit_manipulation"
description: "Check whether a 9-bit word (8 data bits + 1 parity bit) has valid odd parity"
module_name: "odd_parity_check"
ports:
data_with_parity:
direction: "input"
width: "9"
error:
direction: "output"
wid... | `timescale 1ns/1ps
module tb_odd_parity_check;
reg [8:0] data_with_parity;
wire error;
odd_parity_check uut (
.data_with_parity(data_with_parity),
.error(error)
);
integer pass_count = 0;
integer fail_count = 0;
task check;
input [8:0] din;
input exp_err;
... |
150_mag_with_sign | bundles/L1_basic/150_mag_with_sign | 8-bit Magnitude with Sign | L1_basic | L1 | 150 | # Problem 150: 8-bit Magnitude with Sign
**Level**: 1 (Basic Combinational Logic)
**Category**: data_conversion
## Description
Implement a module that converts an 8-bit two's complement signed value into sign-magnitude representation. The output consists of a 1-bit sign flag and a 7-bit unsigned magnitude. Since a 7... | problem_id: "150"
title: "8-bit Magnitude with Sign"
level: 1
category: "data_conversion"
description: "Convert an 8-bit two's complement signed value to sign-magnitude representation"
module_name: "mag_with_sign"
ports:
twos_comp:
direction: "input"
width: "8"
magnitude:
direction: "output"
width:... | `timescale 1ns/1ps
module tb_mag_with_sign;
reg [7:0] twos_comp;
wire [6:0] magnitude;
wire sign;
mag_with_sign uut (
.twos_comp(twos_comp),
.magnitude(magnitude),
.sign(sign)
);
integer pass_count = 0;
integer fail_count = 0;
task check;
input [7:0] t... |
151_decoder_4to16_en | bundles/L1_basic/151_decoder_4to16_en | 4-to-16 Decoder with Enable | L1_basic | L1 | 151 | # Problem 151: 4-to-16 Decoder with Enable
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Implement a 4-to-16 decoder with an active-high enable input. When enabled, the decoder sets exactly one of the 16 output bits high based on the 4-bit input value. When disabled, all out... | problem_id: "151"
title: "4-to-16 Decoder with Enable"
level: 1
category: "encoders_decoders"
description: "Decode a 4-bit input to a 16-bit one-hot output with an active-high enable"
module_name: "decoder_4to16_en"
ports:
in_val:
direction: "input"
width: "4"
enable:
direction: "input"
width: "1"
... | `timescale 1ns/1ps
module tb_decoder_4to16_en;
reg [3:0] in_val;
reg enable;
wire [15:0] out_val;
// Instantiate the module under test
decoder_4to16_en uut (
.in_val(in_val),
.enable(enable),
.out_val(out_val)
);
integer pass_count = 0;
integer fail_count = 0;
... |
152_nibble_swap_8 | bundles/L1_basic/152_nibble_swap_8 | 8-bit Nibble Swap | L1_basic | L1 | 152 | # Problem 152: 8-bit Nibble Swap
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Implement a module that swaps the upper nibble (bits [7:4]) and lower nibble (bits [3:0]) of an 8-bit input value.
## Module Interface
```verilog
module nibble_swap_8(
input [7:0] data,
o... | problem_id: "152"
title: "8-bit Nibble Swap"
level: 1
category: "bit_manipulation"
description: "Swap the upper and lower nibbles of an 8-bit value"
module_name: "nibble_swap_8"
ports:
data:
direction: "input"
width: "8"
result:
direction: "output"
width: "8"
testbench_file: "testbench.v"
timeout_... | `timescale 1ns/1ps
module tb_nibble_swap_8;
reg [7:0] data;
wire [7:0] result;
// Instantiate the module under test
nibble_swap_8 uut (
.data(data),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing nibble_swap_... |
153_decoder_3to8_low | bundles/L1_basic/153_decoder_3to8_low | 3-to-8 Decoder (Active Low) | L1_basic | L1 | 153 | # Problem 153: 3-to-8 Decoder (Active Low)
**Level**: 1 (Basic Combinational Logic)
**Category**: encoders_decoders
## Description
Implement a 3-to-8 active-low decoder. The selected output bit is driven low (0) while all other output bits remain high (1).
## Module Interface
```verilog
module decoder_3to8_low(
... | problem_id: "153"
title: "3-to-8 Decoder (Active Low)"
level: 1
category: "encoders_decoders"
description: "Decode a 3-bit input to an 8-bit active-low output"
module_name: "decoder_3to8_low"
ports:
in_val:
direction: "input"
width: "3"
out_val:
direction: "output"
width: "8"
testbench_file: "test... | `timescale 1ns/1ps
module tb_decoder_3to8_low;
reg [2:0] in_val;
wire [7:0] out_val;
// Instantiate the module under test
decoder_3to8_low uut (
.in_val(in_val),
.out_val(out_val)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testi... |
154_clamp_8bit | bundles/L1_basic/154_clamp_8bit | 8-bit Clamp (Min/Max Bound) | L1_basic | L1 | 154 | # Problem 154: 8-bit Clamp (Min/Max Bound)
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Implement an 8-bit unsigned clamping circuit that constrains a value to lie within a specified range [min_val, max_val].
## Module Interface
```verilog
module clamp_8bit(
input [7:0] valu... | problem_id: "154"
title: "8-bit Clamp (Min/Max Bound)"
level: 1
category: "arithmetic"
description: "Clamp an unsigned 8-bit value to a specified minimum and maximum range"
module_name: "clamp_8bit"
ports:
value:
direction: "input"
width: "8"
min_val:
direction: "input"
width: "8"
max_val:
di... | `timescale 1ns/1ps
module tb_clamp_8bit;
reg [7:0] value;
reg [7:0] min_val;
reg [7:0] max_val;
wire [7:0] result;
// Instantiate the module under test
clamp_8bit uut (
.value(value),
.min_val(min_val),
.max_val(max_val),
.result(result)
);
integer pass... |
155_bitfield_extract | bundles/L1_basic/155_bitfield_extract | 8-bit Bitfield Extract | L1_basic | L1 | 155 | # Problem 155: 8-bit Bitfield Extract
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Implement a module that extracts a variable-width bitfield from an 8-bit data value. The extraction starts at a specified bit position and spans a given number of bits. The extracted bits are ... | problem_id: '155'
title: 8-bit Bitfield Extract
category: bit_manipulation
description: Extract a variable-width bitfield from an 8-bit value at a specified
position
module_name: bitfield_extract
ports:
data:
direction: input
width: '8'
start:
direction: input
width: '3'
width_m1:
direction:... | `timescale 1ns/1ps
module tb_bitfield_extract;
reg [7:0] data;
reg [2:0] start;
reg [2:0] width_m1;
wire [7:0] result;
// Instantiate the module under test
bitfield_extract uut (
.data(data),
.start(start),
.width_m1(width_m1),
.result(result)
);
intege... |
156_bitfield_insert | bundles/L1_basic/156_bitfield_insert | 8-bit Bitfield Insert | L1_basic | L1 | 156 | # Problem 156: 8-bit Bitfield Insert
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that inserts a variable-width bitfield from one 8-bit value into another 8-bit value at a specified bit position. The bits of the original value outside the inser... | problem_id: '156'
title: 8-bit Bitfield Insert
category: bit_manipulation
description: Insert a variable-width bitfield into an 8-bit value at a specified position
module_name: bitfield_insert
ports:
original:
direction: input
width: '8'
insert_val:
direction: input
width: '8'
start:
direction... | `timescale 1ns/1ps
module tb_bitfield_insert;
reg [7:0] original;
reg [7:0] insert_val;
reg [2:0] start;
reg [2:0] width_m1;
wire [7:0] result;
// Instantiate the module under test
bitfield_insert uut (
.original(original),
.insert_val(insert_val),
.start(start),
... |
157_div_by_3_16 | bundles/L1_basic/157_div_by_3_16 | 16-bit Unsigned Divider by Constant 3 | L1_basic | L1 | 157 | # Problem 157: 16-bit Unsigned Divider by Constant 3
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that divides a 16-bit unsigned integer by the constant 3, producing both the quotient and the remainder.
## Module Interface
```verilog
module div_by_... | problem_id: '157'
title: 16-bit Unsigned Divider by Constant 3
category: arithmetic
description: Divide a 16-bit unsigned number by the constant 3, producing quotient
and remainder
module_name: div_by_3_16
ports:
dividend:
direction: input
width: '16'
quotient:
direction: output
width: '16'
rema... | `timescale 1ns/1ps
module tb_div_by_3_16;
reg [15:0] dividend;
wire [15:0] quotient;
wire [1:0] remainder;
// Instantiate the module under test
div_by_3_16 uut (
.dividend(dividend),
.quotient(quotient),
.remainder(remainder)
);
integer pass_count = 0;
integer ... |
158_xor_checksum | bundles/L1_basic/158_xor_checksum | 8-bit XOR Checksum | L1_basic | L1 | 158 | # Problem 158: 8-bit XOR Checksum
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that computes the XOR checksum of four 8-bit input bytes. XOR checksums are widely used in communication protocols and data storage for simple error detection.
## M... | problem_id: '158'
title: 8-bit XOR Checksum
category: bit_manipulation
description: Compute the XOR checksum of four 8-bit input bytes
module_name: xor_checksum
ports:
byte0:
direction: input
width: '8'
byte1:
direction: input
width: '8'
byte2:
direction: input
width: '8'
byte3:
dire... | `timescale 1ns/1ps
module tb_xor_checksum;
reg [7:0] byte0;
reg [7:0] byte1;
reg [7:0] byte2;
reg [7:0] byte3;
wire [7:0] checksum;
// Instantiate the module under test
xor_checksum uut (
.byte0(byte0),
.byte1(byte1),
.byte2(byte2),
.byte3(byte3),
.c... |
159_cond_swap_8 | bundles/L1_basic/159_cond_swap_8 | 8-bit Conditional Swap | L1_basic | L1 | 159 | # Problem 159: 8-bit Conditional Swap
**Level**: 1 (Basic Combinational Logic)
**Category**: data_conversion
## Description
Design a combinational circuit that conditionally swaps two 8-bit values. When the swap control signal is low, the inputs pass through unchanged. When the swap signal is high, the two outputs a... | problem_id: '159'
title: 8-bit Conditional Swap
category: data_conversion
description: Conditionally swap two 8-bit values based on a control signal
module_name: cond_swap_8
ports:
a:
direction: input
width: '8'
b:
direction: input
width: '8'
swap:
direction: input
width: '1'
out_a:
... | `timescale 1ns/1ps
module tb_cond_swap_8;
reg [7:0] a;
reg [7:0] b;
reg swap;
wire [7:0] out_a;
wire [7:0] out_b;
// Instantiate the module under test
cond_swap_8 uut (
.a(a),
.b(b),
.swap(swap),
.out_a(out_a),
.out_b(out_b)
);
integer pass_... |
160_sat_sub_unsigned_8 | bundles/L1_basic/160_sat_sub_unsigned_8 | 8-bit Saturating Subtract (Unsigned) | L1_basic | L1 | 160 | # Problem 160: 8-bit Saturating Subtract (Unsigned)
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that performs unsigned saturating subtraction of two 8-bit values. Instead of wrapping around on underflow, the result is clamped to zero.
## Module Int... | problem_id: '160'
title: 8-bit Saturating Subtract (Unsigned)
category: arithmetic
description: Subtract two 8-bit unsigned values with saturation to zero on underflow
module_name: sat_sub_unsigned_8
ports:
a:
direction: input
width: '8'
b:
direction: input
width: '8'
result:
direction: output... | `timescale 1ns/1ps
module tb_sat_sub_unsigned_8;
reg [7:0] a;
reg [7:0] b;
wire [7:0] result;
// Instantiate the module under test
sat_sub_unsigned_8 uut (
.a(a),
.b(b),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
... |
161_weighted_sum_8 | bundles/L1_basic/161_weighted_sum_8 | 8-bit Weighted Sum | L1_basic | L1 | 161 | # Problem 161: 8-bit Weighted Sum
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that computes the weighted sum of three 8-bit unsigned inputs. The formula is: result = 2*a + 3*b + c. The output must be 16 bits wide to hold the maximum possible result ... | problem_id: "161"
title: "8-bit Weighted Sum"
level: 1
category: "arithmetic"
description: "Compute the weighted sum 2*a + 3*b + c for three 8-bit unsigned inputs"
module_name: "weighted_sum_8"
ports:
a:
direction: "input"
width: "8"
b:
direction: "input"
width: "8"
c:
direction: "input"
... | `timescale 1ns/1ps
module tb_weighted_sum_8;
reg [7:0] a;
reg [7:0] b;
reg [7:0] c;
wire [15:0] result;
weighted_sum_8 uut (
.a(a),
.b(b),
.c(c),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task chec... |
162_bit_palindrome_8 | bundles/L1_basic/162_bit_palindrome_8 | 8-bit Bit Palindrome Check | L1_basic | L1 | 162 | # Problem 162: 8-bit Bit Palindrome Check
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that checks whether an 8-bit input has a palindromic bit pattern. A bit pattern is a palindrome if it reads the same forwards and backwards, meaning bit[0] =... | problem_id: "162"
title: "8-bit Bit Palindrome Check"
level: 1
category: "bit_manipulation"
description: "Check if an 8-bit value has a palindromic bit pattern"
module_name: "bit_palindrome_8"
ports:
data:
direction: "input"
width: "8"
is_palindrome:
direction: "output"
width: "1"
testbench_file: ... | `timescale 1ns/1ps
module tb_bit_palindrome_8;
reg [7:0] data;
wire is_palindrome;
bit_palindrome_8 uut (
.data(data),
.is_palindrome(is_palindrome)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task check;
input [7:0] in_data;
... |
163_rotate_right_16 | bundles/L1_basic/163_rotate_right_16 | 16-bit Bitwise Rotate Right | L1_basic | L1 | 163 | # Problem 163: 16-bit Bitwise Rotate Right
**Level**: 1 (Basic Combinational Logic)
**Category**: shifters
## Description
Design a combinational circuit that performs a circular right rotation on a 16-bit value. The rotation amount is specified by a 4-bit input (0 to 15 positions). Bits that shift out from the right... | problem_id: "163"
title: "16-bit Bitwise Rotate Right"
level: 1
category: "shifters"
description: "Perform a circular right rotation on a 16-bit value by a variable amount"
module_name: "rotate_right_16"
ports:
data:
direction: "input"
width: "16"
n:
direction: "input"
width: "4"
result:
dire... | `timescale 1ns/1ps
module tb_rotate_right_16;
reg [15:0] data;
reg [3:0] n;
wire [15:0] result;
rotate_right_16 uut (
.data(data),
.n(n),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task check;
input [15... |
164_spread_bits | bundles/L1_basic/164_spread_bits | 8-bit Spread Bits | L1_basic | L1 | 164 | # Problem 164: 8-bit Spread Bits
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that takes a 4-bit input and "spreads" each bit into every other bit position of an 8-bit output, inserting zeros in between. Each input bit is placed at an odd bit p... | problem_id: "164"
title: "8-bit Spread Bits"
level: 1
category: "bit_manipulation"
description: "Spread 4 input bits into even bit positions of an 8-bit output with zeros in between"
module_name: "spread_bits"
ports:
data:
direction: "input"
width: "4"
result:
direction: "output"
width: "8"
testbe... | `timescale 1ns/1ps
module tb_spread_bits;
reg [3:0] data;
wire [7:0] result;
spread_bits uut (
.data(data),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task check;
input [3:0] in_data;
input [7:0] expected;
... |
165_compact_bits | bundles/L1_basic/165_compact_bits | 8-bit Compact Bits | L1_basic | L1 | 165 | # Problem 165: 8-bit Compact Bits
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that extracts every other bit from an 8-bit input, taking bits at even positions (0, 2, 4, 6), and compacts them into a 4-bit output. This is the inverse of the "spr... | problem_id: "165"
title: "8-bit Compact Bits"
level: 1
category: "bit_manipulation"
description: "Extract every other bit from even positions of an 8-bit input into a 4-bit output"
module_name: "compact_bits"
ports:
data:
direction: "input"
width: "8"
result:
direction: "output"
width: "4"
testben... | `timescale 1ns/1ps
module tb_compact_bits;
reg [7:0] data;
wire [3:0] result;
compact_bits uut (
.data(data),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
integer test_num = 0;
task check;
input [7:0] in_data;
input [3:0] expected... |
166_is_power_of_two | bundles/L1_basic/166_is_power_of_two | 8-bit Is Power of Two | L1_basic | L1 | 166 | # Problem 166: 8-bit Is Power of Two
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that determines whether an 8-bit unsigned input value is a non-zero power of two. A power of two has exactly one bit set in its binary representation.
## Module ... | problem_id: "166"
title: "8-bit Is Power of Two"
level: 1
category: "bit_manipulation"
description: "Determine if an 8-bit unsigned value is a non-zero power of two"
module_name: "is_power_of_two"
ports:
data:
direction: "input"
width: "8"
result:
direction: "output"
width: "1"
testbench_file: "te... | `timescale 1ns/1ps
module tb_is_power_of_two;
reg [7:0] data;
wire result;
// Instantiate the module under test
is_power_of_two uut (
.data(data),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing is_power_of_tw... |
167_next_pow2_8 | bundles/L1_basic/167_next_pow2_8 | 8-bit Next Power of Two | L1_basic | L1 | 167 | # Problem 167: 8-bit Next Power of Two
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that computes the smallest power of two that is greater than or equal to an 8-bit unsigned input value. Since the input can be up to 255, the output may need to be as... | problem_id: "167"
title: "8-bit Next Power of Two"
level: 1
category: "arithmetic"
description: "Compute the next power of two greater than or equal to an 8-bit unsigned input"
module_name: "next_pow2_8"
ports:
data:
direction: "input"
width: "8"
result:
direction: "output"
width: "9"
testbench_fi... | `timescale 1ns/1ps
module tb_next_pow2_8;
reg [7:0] data;
wire [8:0] result;
// Instantiate the module under test
next_pow2_8 uut (
.data(data),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing next_pow2_8...")... |
168_gcd_8bit | bundles/L1_basic/168_gcd_8bit | 8-bit GCD (Greatest Common Divisor) | L1_basic | L1 | 168 | # Problem 168: 8-bit GCD (Greatest Common Divisor)
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that computes the greatest common divisor (GCD) of two 8-bit unsigned input values. The circuit must produce the correct result purely combinationally (no... | problem_id: "168"
title: "8-bit GCD (Greatest Common Divisor)"
level: 1
category: "arithmetic"
description: "Compute the greatest common divisor of two 8-bit unsigned values using combinational logic"
module_name: "gcd_8bit"
ports:
a:
direction: "input"
width: "8"
b:
direction: "input"
width: "8"
... | `timescale 1ns/1ps
module tb_gcd_8bit;
reg [7:0] a;
reg [7:0] b;
wire [7:0] result;
// Instantiate the module under test
gcd_8bit uut (
.a(a),
.b(b),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
$display("Testing... |
169_overflow_detect_4 | bundles/L1_basic/169_overflow_detect_4 | 4-bit 2's Complement Overflow Detector | L1_basic | L1 | 169 | # Problem 169: 4-bit 2's Complement Overflow Detector
**Level**: 1 (Basic Combinational Logic)
**Category**: arithmetic
## Description
Design a combinational circuit that performs 4-bit signed (2's complement) addition or subtraction and detects signed overflow. The inputs and output are 4-bit 2's complement values ... | problem_id: "169"
title: "4-bit 2's Complement Overflow Detector"
level: 1
category: "arithmetic"
description: "Perform 4-bit signed addition or subtraction and detect signed overflow"
module_name: "overflow_detect_4"
ports:
a:
direction: "input"
width: "4"
b:
direction: "input"
width: "4"
sub:
... | `timescale 1ns/1ps
module tb_overflow_detect_4;
reg [3:0] a;
reg [3:0] b;
reg sub;
wire [3:0] result;
wire overflow;
// Instantiate the module under test
overflow_detect_4 uut (
.a(a),
.b(b),
.sub(sub),
.result(result),
.overflow(overflow)
);
... |
170_bit_scatter | bundles/L1_basic/170_bit_scatter | 8-bit Bit Scatter | L1_basic | L1 | 170 | # Problem 170: 8-bit Bit Scatter
**Level**: 1 (Basic Combinational Logic)
**Category**: bit_manipulation
## Description
Design a combinational circuit that scatters (deposits) the bits of a 4-bit data input into an 8-bit result at positions indicated by the set bits of an 8-bit mask. The lowest data bit goes to the ... | problem_id: "170"
title: "8-bit Bit Scatter"
level: 1
category: "bit_manipulation"
description: "Scatter the bits of a 4-bit input into positions specified by an 8-bit mask"
module_name: "bit_scatter"
ports:
data:
direction: "input"
width: "4"
mask:
direction: "input"
width: "8"
result:
direc... | `timescale 1ns/1ps
module tb_bit_scatter;
reg [3:0] data;
reg [7:0] mask;
wire [7:0] result;
// Instantiate the module under test
bit_scatter uut (
.data(data),
.mask(mask),
.result(result)
);
integer pass_count = 0;
integer fail_count = 0;
initial begin
... |
101_d_flip_flop | bundles/L2_sequential/101_d_flip_flop | D Flip-Flop | L2_sequential | L2 | 101 | # D Flip-Flop
**Level**: 2 (Sequential Logic)
**Category**: flip_flops
## Problem Description
Positive edge-triggered D flip-flop with synchronous reset
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always ... | problem_id: '101'
title: D Flip-Flop
level: 2
category: flip_flops
description: Positive edge-triggered D flip-flop with synchronous reset
module_name: d_flip_flop
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
d:
direction: input
width: 1
q:
direction: output
... | module tb_d_flip_flop;
reg clk, rst, d;
wire q;
d_flip_flop uut(.clk(clk), .rst(rst), .d(d), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; d = 0; #20; rst = 0;
d = 0; #10; if (q === 0) pass++; else fail++;
d = 1; #10... |
102_counter_4bit | bundles/L2_sequential/102_counter_4bit | 4-bit Binary Counter | L2_sequential | L2 | 102 | # 4-bit Binary Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Problem Description
4-bit up counter with synchronous reset
## Module Interface
```verilog
module counter_4bit(
input clk, input rst, output [3:0] count
);
```
## Specifications
**Inputs:**
- `clk`: 1-bit input
- `rst`: 1-bit in... | problem_id: '102'
title: 4-bit Binary Counter
level: 2
category: counters
description: 4-bit up counter with synchronous reset
module_name: counter_4bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
timeou... | module tb_counter_4bit;
reg clk, rst;
wire [3:0] count;
counter_4bit uut(.clk(clk), .rst(rst), .count(count));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
reg [3:0] expected;
initial begin
// Reset
rst = 1;
@(pose... |
102_d_ff_async_rst | bundles/L2_sequential/102_d_ff_async_rst | D FF with Async Reset | L2_sequential | L2 | 102 | # D FF with Async Reset
**Level**: 2 (Sequential Logic)
**Category**: flip_flops
## Problem Description
D flip-flop with asynchronous reset
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Foll... | problem_id: '102'
title: D FF with Async Reset
level: 2
category: flip_flops
description: D flip-flop with asynchronous reset
module_name: d_ff_async_rst
ports:
clk:
direction: input
width: 1
rst_n:
direction: input
width: 1
d:
direction: input
width: 1
q:
direction: output
width... | module tb_d_ff_async_rst;
reg clk, rst_n, d;
wire q;
d_ff_async_rst uut(.clk(clk), .rst_n(rst_n), .d(d), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst_n = 0; d = 1; #7; if (q === 0) pass++; else fail++;
rst_n = 1; #10; if (q === ... |
103_d_ff_enable | bundles/L2_sequential/103_d_ff_enable | D FF with Enable | L2_sequential | L2 | 103 | # D FF with Enable
**Level**: 2 (Sequential Logic)
**Category**: flip_flops
## Problem Description
D flip-flop with enable signal
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standar... | problem_id: '103'
title: D FF with Enable
level: 2
category: flip_flops
description: D flip-flop with enable signal
module_name: d_ff_enable
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
en:
direction: input
width: 1
d:
direction: input
width: 1
q:
di... | module tb_d_ff_enable;
reg clk, rst, en, d;
wire q;
d_ff_enable uut(.clk(clk), .rst(rst), .en(en), .d(d), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; en = 0; d = 0; #20; rst = 0;
d = 1; en = 0; #10; if (q === 0) pass++; el... |
103_shift_reg_siso | bundles/L2_sequential/103_shift_reg_siso | 4-bit SISO Shift Register | L2_sequential | L2 | 103 | # 4-bit SISO Shift Register
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Problem Description
4-bit Serial-In Serial-Out shift register
## Module Interface
```verilog
module shift_reg_siso(
input clk, input rst, input si, output so
);
```
## Specifications
**Inputs:**
- `clk`: 1-bit input
... | problem_id: '103'
title: 4-bit SISO Shift Register
level: 2
category: shift_registers
description: 4-bit Serial-In Serial-Out shift register
module_name: shift_reg_siso
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
si:
direction: input
width: 1
so:
direction: o... | module tb_shift_reg_siso;
reg clk, rst, si;
wire so;
shift_reg_siso uut(.clk(clk), .rst(rst), .si(si), .so(so));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
initial begin
rst = 1; si = 0; #20; rst = 0;
// Shift in 1010
... |
104_sequence_detector_101 | bundles/L2_sequential/104_sequence_detector_101 | Sequence Detector (101) | L2_sequential | L2 | 104 | # Sequence Detector (101)
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Problem Description
Moore FSM to detect sequence '101'
## Module Interface
```verilog
module sequence_detector_101(
input clk, input rst, input in, output detected
);
```
## Specifications
**Inputs:**
- `clk`: 1-bit input
- `rst`:... | problem_id: '104'
title: Sequence Detector (101)
level: 2
category: fsm
description: Moore FSM to detect sequence '101'
module_name: sequence_detector_101
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
in:
direction: input
width: 1
detected:
direction: output
... | module tb_sequence_detector_101;
reg clk, rst, in;
wire detected;
sequence_detector_101 uut(.clk(clk), .rst(rst), .in(in), .detected(detected));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
initial begin
rst = 1; in = 0; #20; rst = 0;... |
104_t_flip_flop | bundles/L2_sequential/104_t_flip_flop | T Flip-Flop | L2_sequential | L2 | 104 | # T Flip-Flop
**Level**: 2 (Sequential Logic)
**Category**: flip_flops
## Problem Description
Toggle flip-flop
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standard synchronous desig... | problem_id: '104'
title: T Flip-Flop
level: 2
category: flip_flops
description: Toggle flip-flop
module_name: t_flip_flop
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
t:
direction: input
width: 1
q:
direction: output
width: 1
testbench_file: testbench.v
ti... | module tb_t_flip_flop;
reg clk, rst, t;
wire q;
t_flip_flop uut(.clk(clk), .rst(rst), .t(t), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; t = 0; #20; rst = 0;
t = 1; #10; if (q === 1) pass++; else fail++;
#10; if (q... |
105_jk_flip_flop | bundles/L2_sequential/105_jk_flip_flop | JK Flip-Flop | L2_sequential | L2 | 105 | # JK Flip-Flop
**Level**: 2 (Sequential Logic)
**Category**: flip_flops
## Problem Description
JK flip-flop
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standard synchronous design p... | problem_id: '105'
title: JK Flip-Flop
level: 2
category: flip_flops
description: JK flip-flop
module_name: jk_flip_flop
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
j:
direction: input
width: 1
k:
direction: input
width: 1
q:
direction: output
wi... | module tb_jk_flip_flop;
reg clk, rst, j, k;
wire q;
jk_flip_flop uut(.clk(clk), .rst(rst), .j(j), .k(k), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; j = 0; k = 0; #20; rst = 0;
j = 1; k = 0; #10; if (q === 1) pass++; else ... |
105_seq_det_1101 | bundles/L2_sequential/105_seq_det_1101 | Sequence Detector 1101 | L2_sequential | L2 | 105 | # Problem 105: Sequence Detector 1101
## Description
Overlapping sequence detector for pattern 1101.
## Module Interface
```verilog
module seq_det_1101(
input clk,\n input rst,\n input in,\n output detected
);
// Your implementation here
endmodule
```
## Specification
Overlapping sequence detecto... | problem_id: '105'
title: Sequence Detector 1101
level: 2
category: fsm
description: Overlapping sequence detector for pattern 1101.
module_name: seq_det_1101
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
in:
direction: input
width: 1
detected:
direction: output... | `timescale 1ns/1ps
module tb;
reg clk, rst, in;
wire detected;
seq_det_1101 dut(.clk(clk), .rst(rst), .in(in), .detected(detected));
initial clk = 0;
always #5 clk = ~clk;
integer fail;
task send_bit; input b; begin in = b; @(posedge clk); #1; end endtask
initial begin
fail = 0; ... |
106_register_8bit | bundles/L2_sequential/106_register_8bit | 8-bit Register | L2_sequential | L2 | 106 | # 8-bit Register
**Level**: 2 (Sequential Logic)
**Category**: flip_flops
## Problem Description
8-bit parallel load register
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standard sy... | problem_id: '106'
title: 8-bit Register
level: 2
category: flip_flops
description: 8-bit parallel load register
module_name: register_8bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
d:
direction: input
width: 8
q:
direction: output
width: 8
testbench_fil... | module tb_register_8bit;
reg clk, rst;
reg [7:0] d;
wire [7:0] q;
register_8bit uut(.clk(clk), .rst(rst), .d(d), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; d = 8'h00; #20; rst = 0;
d = 8'hAA; #10; if (q === 8'hAA) pas... |
106_seq_det_1010_no | bundles/L2_sequential/106_seq_det_1010_no | Sequence Detector 1010 (Non-overlapping) | L2_sequential | L2 | 106 | # Problem 106: Sequence Detector 1010 (Non-overlapping)
## Description
Non-overlapping sequence detector for pattern 1010.
## Module Interface
```verilog
module seq_det_1010_no(
input clk,\n input rst,\n input in,\n output detected
);
// Your implementation here
endmodule
```
## Specification
Non... | problem_id: '106'
title: Sequence Detector 1010 (Non-overlapping)
level: 2
category: fsm
description: Non-overlapping sequence detector for pattern 1010.
module_name: seq_det_1010_no
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
in:
direction: input
width: 1
detect... | `timescale 1ns/1ps
module tb;
reg clk, rst, in;
wire detected;
seq_det_1010_no dut(.clk(clk), .rst(rst), .in(in), .detected(detected));
initial clk = 0;
always #5 clk = ~clk;
integer fail;
task send_bit; input b; begin in = b; @(posedge clk); #1; end endtask
initial begin
fail = ... |
107_traffic_light_moore | bundles/L2_sequential/107_traffic_light_moore | Moore FSM Traffic Light | L2_sequential | L2 | 107 | # Problem 107: Moore FSM Traffic Light
## Description
Simple 2-state traffic light controller (Moore machine). light: 00=red, 01=yellow, 10=green.
## Module Interface
```verilog
module traffic_light_moore(
input clk,\n input rst,\n input sensor,\n output [1:0] light
);
// Your implementation here
e... | problem_id: '107'
title: Moore FSM Traffic Light
level: 2
category: fsm
description: 'Simple 2-state traffic light controller (Moore machine). light: 00=red,
01=yellow, 10=green.'
module_name: traffic_light_moore
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
sensor:
di... | `timescale 1ns/1ps
module tb;
reg clk, rst, sensor;
wire [1:0] light;
traffic_light_moore dut(.clk(clk), .rst(rst), .sensor(sensor), .light(light));
initial clk = 0;
always #5 clk = ~clk;
integer fail;
initial begin
fail = 0; rst = 1; sensor = 0;
@(posedge clk); #1; @(posedge... |
108_edge_detector_mealy | bundles/L2_sequential/108_edge_detector_mealy | Mealy FSM Edge Detector | L2_sequential | L2 | 108 | # Problem 108: Mealy FSM Edge Detector
## Description
Rising edge detector using Mealy FSM.
## Module Interface
```verilog
module edge_detector_mealy(
input clk,\n input rst,\n input in,\n output edge
);
// Your implementation here
endmodule
```
## Specification
Rising edge detector using Mealy F... | problem_id: '108'
title: Mealy FSM Edge Detector
level: 2
category: fsm
description: Rising edge detector using Mealy FSM.
module_name: edge_detector_mealy
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
in:
direction: input
width: 1
edge:
direction: output
w... | `timescale 1ns/1ps
module tb;
reg clk, rst, in;
wire edge_out;
edge_detector_mealy dut(.clk(clk), .rst(rst), .in(in), .edge_out(edge_out));
initial clk = 0;
always #5 clk = ~clk;
integer fail;
initial begin
fail = 0; rst = 1; in = 0;
@(posedge clk); #1; @(posedge clk); #1; rs... |
109_vending_machine | bundles/L2_sequential/109_vending_machine | Vending Machine FSM | L2_sequential | L2 | 109 | # Problem 109: Vending Machine FSM
## Description
Vending machine FSM. coin: 00=none, 01=5, 10=10. Price=15. Output dispense when paid, change if overpaid.
## Module Interface
```verilog
module vending_machine(
input clk,\n input rst,\n input [1:0] coin,\n output dispense,\n output change
);
// ... | problem_id: '109'
title: Vending Machine FSM
level: 2
category: fsm
description: 'Vending machine FSM. coin: 00=none, 01=5, 10=10. Price=15. Output dispense
when paid, change if overpaid.'
module_name: vending_machine
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
coin:
... | `timescale 1ns/1ps
module tb;
reg clk, rst;
reg [1:0] coin;
wire dispense, change;
vending_machine dut(.clk(clk), .rst(rst), .coin(coin), .dispense(dispense), .change(change));
initial clk = 0;
always #5 clk = ~clk;
integer fail;
initial begin
fail = 0; rst = 1; coin = 0;
... |
111_counter_4bit | bundles/L2_sequential/111_counter_4bit | 4-bit Binary Counter | L2_sequential | L2 | 111 | # 4-bit Binary Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Problem Description
4-bit up counter
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standard synchronou... | problem_id: '111'
title: 4-bit Binary Counter
level: 2
category: counters
description: 4-bit up counter
module_name: counter_4bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
timeout_compile: 10
timeout_s... | module tb_counter_4bit;
reg clk, rst;
wire [3:0] count;
counter_4bit uut(.clk(clk), .rst(rst), .count(count));
initial clk = 0;
always #5 clk = ~clk;
integer pass, fail, i;
initial begin
pass = 0; fail = 0;
rst = 1;
@(posedge clk); #1;
@(posedge clk); #1;
... |
112_counter_down | bundles/L2_sequential/112_counter_down | 4-bit Down Counter | L2_sequential | L2 | 112 | # 4-bit Down Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Problem Description
4-bit down counter
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standard synchronou... | problem_id: '112'
title: 4-bit Down Counter
level: 2
category: counters
description: 4-bit down counter
module_name: counter_down
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
timeout_compile: 10
timeout_s... | module tb_counter_down;
reg clk, rst;
wire [3:0] count;
counter_down uut(.clk(clk), .rst(rst), .count(count));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; #20; rst = 0;
repeat(16) begin
#10; pass++;
end
... |
113_counter_updown | bundles/L2_sequential/113_counter_updown | Up/Down Counter | L2_sequential | L2 | 113 | # Up/Down Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Problem Description
4-bit up/down counter
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standard synchronou... | problem_id: '113'
title: Up/Down Counter
level: 2
category: counters
description: 4-bit up/down counter
module_name: counter_updown
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
up:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file:... | module tb_counter_updown;
reg clk, rst, up;
wire [3:0] count;
counter_updown uut(.clk(clk), .rst(rst), .up(up), .count(count));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; up = 1; #20; rst = 0;
repeat(5) begin #10; pass++; end
... |
114_counter_mod10 | bundles/L2_sequential/114_counter_mod10 | Mod-10 Counter (BCD) | L2_sequential | L2 | 114 | # Mod-10 Counter (BCD)
**Level**: 2 (Sequential Logic)
**Category**: counters
## Problem Description
BCD counter (0-9)
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standard synchrono... | problem_id: '114'
title: Mod-10 Counter (BCD)
level: 2
category: counters
description: BCD counter (0-9)
module_name: counter_mod10
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
timeout_compile: 10
timeout... | module tb_counter_mod10;
reg clk, rst;
wire [3:0] count;
counter_mod10 uut(.clk(clk), .rst(rst), .count(count));
initial clk = 0;
always #5 clk = ~clk;
integer pass, fail, i;
initial begin
pass = 0; fail = 0;
rst = 1;
@(posedge clk); #1;
@(posedge clk); #1;
... |
115_counter_with_load | bundles/L2_sequential/115_counter_with_load | Counter with Load | L2_sequential | L2 | 115 | # Counter with Load
**Level**: 2 (Sequential Logic)
**Category**: counters
## Problem Description
4-bit counter with parallel load
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow standa... | problem_id: '115'
title: Counter with Load
level: 2
category: counters
description: 4-bit counter with parallel load
module_name: counter_with_load
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:
direction: input
width: 1
data:
direction: input
width: 4... | module tb_counter_with_load;
reg clk, rst, load;
reg [3:0] data;
wire [3:0] count;
counter_with_load uut(.clk(clk), .rst(rst), .load(load), .data(data), .count(count));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; load = 0; data = 4'h0... |
116_gray_counter | bundles/L2_sequential/116_gray_counter | Gray Code Counter | L2_sequential | L2 | 116 | # Problem 116: Gray Code Counter
## Description
4-bit Gray code counter with synchronous reset.
## Module Interface
```verilog
module gray_counter(
input clk,\n input rst,\n output [3:0] count
);
// Your implementation here
endmodule
```
## Specification
4-bit Gray code counter with synchronous rese... | problem_id: '116'
title: Gray Code Counter
level: 2
category: counters
description: 4-bit Gray code counter with synchronous reset.
module_name: gray_counter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
t... | `timescale 1ns/1ps
module tb; reg clk,rst; wire [3:0] count;
gray_counter dut(.clk(clk),.rst(rst),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail,i; reg [3:0] exp, bin;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=1;i<=16;i=i+1) begin @(posedge clk);#1;
bin=i[3:0]; e... |
117_ring_counter | bundles/L2_sequential/117_ring_counter | Ring Counter 8-bit | L2_sequential | L2 | 117 | # Problem 117: Ring Counter 8-bit
## Description
8-bit ring counter with one-hot encoding.
## Module Interface
```verilog
module ring_counter(
input clk,\n input rst,\n output [7:0] count
);
// Your implementation here
endmodule
```
## Specification
8-bit ring counter with one-hot encoding.
## Requ... | problem_id: '117'
title: Ring Counter 8-bit
level: 2
category: counters
description: 8-bit ring counter with one-hot encoding.
module_name: ring_counter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 8
testbench_file: testbench.v
timeou... | `timescale 1ns/1ps
module tb; reg clk,rst; wire [7:0] count;
ring_counter dut(.clk(clk),.rst(rst),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail,i; reg [7:0] exp;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
exp=8'b00000001;
for(i=0;i<8;i=i+1) begin
exp={exp[0],exp[7:1]};... |
118_johnson_counter | bundles/L2_sequential/118_johnson_counter | Johnson Counter | L2_sequential | L2 | 118 | # Problem 118: Johnson Counter
## Description
4-bit Johnson counter.
## Module Interface
```verilog
module johnson_counter(
input clk,\n input rst,\n output [3:0] count
);
// Your implementation here
endmodule
```
## Specification
4-bit Johnson counter.
## Requirements
- Implement the module accor... | problem_id: '118'
title: Johnson Counter
level: 2
category: counters
description: 4-bit Johnson counter.
module_name: johnson_counter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
timeout_compile: 10
timeo... | `timescale 1ns/1ps
module tb; reg clk,rst; wire [3:0] count;
johnson_counter dut(.clk(clk),.rst(rst),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail,i; reg [3:0] exp;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
exp=4'b0000;
for(i=0;i<8;i=i+1) begin
exp={~exp[0],exp[3:1]};... |
119_counter_enable | bundles/L2_sequential/119_counter_enable | Counter with Enable | L2_sequential | L2 | 119 | # Problem 119: Counter with Enable
## Description
4-bit binary counter with enable signal.
## Module Interface
```verilog
module counter_enable(
input clk,\n input rst,\n input en,\n output [3:0] count
);
// Your implementation here
endmodule
```
## Specification
4-bit binary counter with enable ... | problem_id: '119'
title: Counter with Enable
level: 2
category: counters
description: 4-bit binary counter with enable signal.
module_name: counter_enable
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
en:
direction: input
width: 1
count:
direction: output
w... | `timescale 1ns/1ps
module tb; reg clk,rst,en; wire [3:0] count;
counter_enable dut(.clk(clk),.rst(rst),.en(en),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; en=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
en=1; @(posedge clk);#1; if(count!==1) fail=fail+1;
@(posedge cl... |
120_counter_mod_n | bundles/L2_sequential/120_counter_mod_n | Mod-N Counter | L2_sequential | L2 | 120 | # Problem 120: Mod-N Counter
## Description
4-bit modulo-12 counter.
## Module Interface
```verilog
module counter_mod_n(
input clk,\n input rst,\n output [3:0] count
);
// Your implementation here
endmodule
```
## Specification
4-bit modulo-12 counter.
## Requirements
- Implement the module accor... | problem_id: '120'
title: Mod-N Counter
level: 2
category: counters
description: 4-bit modulo-12 counter.
module_name: counter_mod_n
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
timeout_compile: 10
timeout... | `timescale 1ns/1ps
module tb; reg clk,rst; wire [3:0] count;
counter_mod_n dut(.clk(clk),.rst(rst),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail,i; reg [3:0] exp;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
exp=0;
for(i=0;i<24;i=i+1) begin
if(exp>=11) exp=0; else exp=ex... |
121_shift_reg_siso | bundles/L2_sequential/121_shift_reg_siso | 4-bit SISO Shift Register | L2_sequential | L2 | 121 | # 4-bit SISO Shift Register
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Problem Description
Serial-In Serial-Out shift register
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always bloc... | problem_id: '121'
title: 4-bit SISO Shift Register
level: 2
category: shift_registers
description: Serial-In Serial-Out shift register
module_name: shift_reg_siso
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
si:
direction: input
width: 1
so:
direction: output
... | module tb_shift_reg_siso;
reg clk, rst, si;
wire so;
shift_reg_siso uut(.clk(clk), .rst(rst), .si(si), .so(so));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; si = 0; #20; rst = 0;
si = 1; #10; si = 0; #10; si = 1; #10; si = 0; #10;... |
122_shift_reg_piso | bundles/L2_sequential/122_shift_reg_piso | 4-bit PISO Shift Register | L2_sequential | L2 | 122 | # 4-bit PISO Shift Register
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Problem Description
Parallel-In Serial-Out shift register
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always bl... | problem_id: '122'
title: 4-bit PISO Shift Register
level: 2
category: shift_registers
description: Parallel-In Serial-Out shift register
module_name: shift_reg_piso
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:
direction: input
width: 1
pi:
direction: inp... | module tb_shift_reg_piso;
reg clk, rst, load;
reg [3:0] pi;
wire so;
shift_reg_piso uut(.clk(clk), .rst(rst), .load(load), .pi(pi), .so(so));
initial clk = 0;
always #5 clk = ~clk;
integer pass = 0, fail = 0;
initial begin
rst = 1; load = 0; pi = 4'b0; #20; rst = 0;
load ... |
122_shift_reg_sipo | bundles/L2_sequential/122_shift_reg_sipo | 8-bit SIPO Shift Register | L2_sequential | L2 | 122 | # Problem 122: 8-bit SIPO Shift Register
## Description
8-bit Serial-In Parallel-Out shift register.
## Module Interface
```verilog
module shift_reg_sipo(
input clk,\n input rst,\n input si,\n output [7:0] po
);
// Your implementation here
endmodule
```
## Specification
8-bit Serial-In Parallel-O... | problem_id: '122'
title: 8-bit SIPO Shift Register
level: 2
category: shift_registers
description: 8-bit Serial-In Parallel-Out shift register.
module_name: shift_reg_sipo
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
si:
direction: input
width: 1
po:
direction... | `timescale 1ns/1ps
module tb; reg clk,rst,si; wire [7:0] po;
shift_reg_sipo dut(.clk(clk),.rst(rst),.si(si),.po(po));
initial clk=0; always #5 clk=~clk;
integer fail,i; reg [7:0] exp;
initial begin fail=0; rst=1; si=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
exp=0;
for(i=0;i<8;i=i+1) begin si=i[0]; exp={si,exp[7:1... |
123_shift_reg_piso | bundles/L2_sequential/123_shift_reg_piso | 8-bit PISO Shift Register | L2_sequential | L2 | 123 | # Problem 123: 8-bit PISO Shift Register
## Description
8-bit Parallel-In Serial-Out shift register.
## Module Interface
```verilog
module shift_reg_piso(
input clk,\n input rst,\n input load,\n input [7:0] pi,\n output so
);
// Your implementation here
endmodule
```
## Specification
8-bit Par... | problem_id: '123'
title: 8-bit PISO Shift Register
level: 2
category: shift_registers
description: 8-bit Parallel-In Serial-Out shift register.
module_name: shift_reg_piso
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:
direction: input
width: 1
pi:
directi... | `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [7:0] pi; wire so;
shift_reg_piso dut(.clk(clk),.rst(rst),.load(load),.pi(pi),.so(so));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; load=0; pi=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
pi=8'hA5; load=1; @(posedge clk);#1; load... |
124_shift_reg_pipo | bundles/L2_sequential/124_shift_reg_pipo | 8-bit PIPO Shift Register | L2_sequential | L2 | 124 | # Problem 124: 8-bit PIPO Shift Register
## Description
8-bit Parallel-In Parallel-Out shift register.
## Module Interface
```verilog
module shift_reg_pipo(
input clk,\n input rst,\n input [7:0] pi,\n output [7:0] po
);
// Your implementation here
endmodule
```
## Specification
8-bit Parallel-In ... | problem_id: '124'
title: 8-bit PIPO Shift Register
level: 2
category: shift_registers
description: 8-bit Parallel-In Parallel-Out shift register.
module_name: shift_reg_pipo
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
pi:
direction: input
width: 8
po:
directi... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [7:0] pi; wire [7:0] po;
shift_reg_pipo dut(.clk(clk),.rst(rst),.pi(pi),.po(po));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; pi=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
pi=8'hAB; @(posedge clk);#1; if(po!==8'hAB) fail=fail+1;
pi=8'... |
125_shift_reg_bidir | bundles/L2_sequential/125_shift_reg_bidir | Bidirectional Shift Register | L2_sequential | L2 | 125 | # Problem 125: Bidirectional Shift Register
## Description
8-bit bidirectional shift register (dir=0: left, dir=1: right).
## Module Interface
```verilog
module shift_reg_bidir(
input clk,\n input rst,\n input dir,\n input si,\n output [7:0] po
);
// Your implementation here
endmodule
```
## Sp... | problem_id: '125'
title: Bidirectional Shift Register
level: 2
category: shift_registers
description: '8-bit bidirectional shift register (dir=0: left, dir=1: right).'
module_name: shift_reg_bidir
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
dir:
direction: input
wi... | `timescale 1ns/1ps
module tb; reg clk,rst,dir,si; wire [7:0] po;
shift_reg_bidir dut(.clk(clk),.rst(rst),.dir(dir),.si(si),.po(po));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; dir=0; si=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
si=1; dir=0; @(posedge clk);#1; if(po!==8'h01) fail... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.