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 |
|---|---|---|---|---|---|---|---|---|
126_shift_reg_universal | bundles/L2_sequential/126_shift_reg_universal | Universal Shift Register | L2_sequential | L2 | 126 | # Problem 126: Universal Shift Register
## Description
8-bit universal shift register with modes: 00=hold, 01=shift_left, 10=shift_right, 11=load.
## Module Interface
```verilog
module shift_reg_universal(
input clk,\n input rst,\n input [1:0] mode,\n input si,\n input [7:0] pi,\n output [7:0] po... | problem_id: '126'
title: Universal Shift Register
level: 2
category: shift_registers
description: '8-bit universal shift register with modes: 00=hold, 01=shift_left, 10=shift_right,
11=load.'
module_name: shift_reg_universal
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
mo... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [1:0] mode; reg si; reg [7:0] pi; wire [7:0] po;
shift_reg_universal dut(.clk(clk),.rst(rst),.mode(mode),.si(si),.pi(pi),.po(po));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; mode=0; si=0; pi=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;... |
127_bcd_counter_up | bundles/L2_sequential/127_bcd_counter_up | BCD Up Counter | L2_sequential | L2 | 127 | # Problem 127: BCD Up Counter
## Description
BCD counter counts 0-9 repeatedly.
## Module Interface
```verilog
module bcd_counter_up(
input clk,\n input rst,\n output [3:0] count
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specification
- Use synthesizable V... | problem_id: '127'
title: BCD Up Counter
level: 2
category: counters
description: BCD counter counts 0-9 repeatedly.
module_name: bcd_counter_up
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
testbench_file: testbench.v
timeout_compile... | `timescale 1ns/1ps
module tb; reg clk,rst; wire [3:0] count;
bcd_counter_up dut(.clk(clk),.rst(rst),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=0;i<20;i=i+1) begin @(posedge clk);#1;
if(count!==((i+1)%10)) fail=fail... |
128_counter_mod6 | bundles/L2_sequential/128_counter_mod6 | Mod-6 Counter | L2_sequential | L2 | 128 | # Problem 128: Mod-6 Counter
## Description
Modulo-6 counter.
## Module Interface
```verilog
module counter_mod6(
input clk,\n input rst,\n output [2:0] count
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specification
- Use synthesizable Verilog/SystemVerilog... | problem_id: '128'
title: Mod-6 Counter
level: 2
category: counters
description: Modulo-6 counter.
module_name: counter_mod6
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 3
testbench_file: testbench.v
timeout_compile: 10
timeout_simulat... | `timescale 1ns/1ps
module tb; reg clk,rst; wire [2:0] count;
counter_mod6 dut(.clk(clk),.rst(rst),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=0;i<12;i=i+1) begin @(posedge clk);#1;
if(count!==((i+1)%6)) fail=fail+1;... |
129_decade_counter_tc | bundles/L2_sequential/129_decade_counter_tc | Decade Counter with Terminal Count | L2_sequential | L2 | 129 | # Problem 129: Decade Counter with Terminal Count
## Description
Decade counter (0-9) with terminal count output.
## Module Interface
```verilog
module decade_counter_tc(
input clk,\n input rst,\n output [3:0] count,\n output tc
);
// Your implementation here
endmodule
```
## Requirements
- Imple... | problem_id: '129'
title: Decade Counter with Terminal Count
level: 2
category: counters
description: Decade counter (0-9) with terminal count output.
module_name: decade_counter_tc
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
count:
direction: output
width: 4
tc:
... | `timescale 1ns/1ps
module tb; reg clk,rst; wire [3:0] count; wire tc;
decade_counter_tc dut(.clk(clk),.rst(rst),.count(count),.tc(tc));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=0;i<20;i=i+1) begin @(posedge clk);#1;
if(count!==(... |
130_serial_adder_fsm | bundles/L2_sequential/130_serial_adder_fsm | Serial Adder FSM | L2_sequential | L2 | 130 | # Problem 130: Serial Adder FSM
## Description
Serial adder FSM that adds two numbers bit by bit.
## Module Interface
```verilog
module serial_adder_fsm(
input clk,\n input rst,\n input a,\n input b,\n output sum,\n output carry
);
// Your implementation here
endmodule
```
## Requirements
-... | problem_id: '130'
title: Serial Adder FSM
level: 2
category: fsm
description: Serial adder FSM that adds two numbers bit by bit.
module_name: serial_adder_fsm
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
a:
direction: input
width: 1
b:
direction: input
wid... | `timescale 1ns/1ps
module tb; reg clk,rst,a,b; wire sum,carry;
serial_adder_fsm dut(.clk(clk),.rst(rst),.a(a),.b(b),.sum(sum),.carry(carry));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; a=0; b=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
a=1; b=1; @(posedge clk);#1; if(sum!==0) fail... |
131_pattern_11011 | bundles/L2_sequential/131_pattern_11011 | Pattern Detector 11011 | L2_sequential | L2 | 131 | # Problem 131: Pattern Detector 11011
## Description
Detect overlapping pattern 11011.
## Module Interface
```verilog
module pattern_11011(
input clk,\n input rst,\n input in,\n output found
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specification
- Use ... | problem_id: '131'
title: Pattern Detector 11011
level: 2
category: fsm
description: Detect overlapping pattern 11011.
module_name: pattern_11011
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
in:
direction: input
width: 1
found:
direction: output
width: 1
te... | `timescale 1ns/1ps
module tb; reg clk,rst,in; wire found;
pattern_11011 dut(.clk(clk),.rst(rst),.in(in),.found(found));
initial clk=0; always #5 clk=~clk;
integer fail;
task sb; input b; begin in=b; @(posedge clk);#1; end endtask
initial begin fail=0; rst=1; in=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
sb(1);sb(1... |
131_sequence_detector_101 | bundles/L2_sequential/131_sequence_detector_101 | Sequence Detector (101) | L2_sequential | L2 | 131 | # Sequence Detector (101)
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Problem Description
Moore FSM to detect sequence '101'
## Specifications
See config.yaml for port specifications.
## Notes
- Sequential circuit with clock/reset
- Use non-blocking assignments (<=) in clocked always blocks
- Follow sta... | problem_id: '131'
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 = 0, fail = 0;
initial begin
rst = 1; in = 0; #20; rst = 0;
in = 1; #10; in = 0... |
132_abro_detector | bundles/L2_sequential/132_abro_detector | ABRO Sequence Detector | L2_sequential | L2 | 132 | # Problem 132: ABRO Sequence Detector
## Description
Detect A then B then O (any order for A and B, then must see O).
## Module Interface
```verilog
module abro_detector(
input clk,\n input rst,\n input a,\n input b,\n output out
);
// Your implementation here
endmodule
```
## Requirements
- I... | problem_id: '132'
title: ABRO Sequence Detector
level: 2
category: fsm
description: Detect A then B then O (any order for A and B, then must see O).
module_name: abro_detector
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
a:
direction: input
width: 1
b:
directi... | `timescale 1ns/1ps
module tb; reg clk,rst,a,b; wire out;
abro_detector dut(.clk(clk),.rst(rst),.a(a),.b(b),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; a=0; b=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
a=1; b=0; @(posedge clk);#1; a=0; if(out) fail=fail+1;
b=1; @(posedg... |
133_door_lock_fsm | bundles/L2_sequential/133_door_lock_fsm | Door Lock FSM | L2_sequential | L2 | 133 | # Problem 133: Door Lock FSM
## Description
3-digit combination lock FSM (code: 1-2-3).
## Module Interface
```verilog
module door_lock_fsm(
input clk,\n input rst,\n input [3:0] code,\n input enter,\n output unlock
);
// Your implementation here
endmodule
```
## Requirements
- Implement accor... | problem_id: '133'
title: Door Lock FSM
level: 2
category: fsm
description: '3-digit combination lock FSM (code: 1-2-3).'
module_name: door_lock_fsm
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
code:
direction: input
width: 4
enter:
direction: input
width: ... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [3:0] code; reg enter; wire unlock;
door_lock_fsm dut(.clk(clk),.rst(rst),.code(code),.enter(enter),.unlock(unlock));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; code=0; enter=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
code=4; enter=1... |
134_elevator_fsm | bundles/L2_sequential/134_elevator_fsm | Elevator Controller FSM | L2_sequential | L2 | 134 | # Problem 134: Elevator Controller FSM
## Description
Simple 4-floor elevator controller.
## Module Interface
```verilog
module elevator_fsm(
input clk,\n input rst,\n input [2:0] request,\n output [1:0] current_floor,\n output moving
);
// Your implementation here
endmodule
```
## Requirements... | problem_id: '134'
title: Elevator Controller FSM
level: 2
category: fsm
description: Simple 4-floor elevator controller.
module_name: elevator_fsm
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
request:
direction: input
width: 3
current_floor:
direction: output
... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [2:0] request; wire [1:0] current_floor; wire moving;
elevator_fsm dut(.clk(clk),.rst(rst),.request(request),.current_floor(current_floor),.moving(moving));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; request=0; @(posedge clk);#1; @(posedg... |
135_washing_machine | bundles/L2_sequential/135_washing_machine | Washing Machine FSM | L2_sequential | L2 | 135 | # Problem 135: Washing Machine FSM
## Description
Washing machine with states: idle, fill, wash, rinse, spin, done.
## Module Interface
```verilog
module washing_machine(
input clk,\n input rst,\n input start,\n input [1:0] mode,\n output [2:0] state,\n output done
);
// Your implementation h... | problem_id: '135'
title: Washing Machine FSM
level: 2
category: fsm
description: 'Washing machine with states: idle, fill, wash, rinse, spin, done.'
module_name: washing_machine
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
start:
direction: input
width: 1
mode:
... | `timescale 1ns/1ps
module tb; reg clk,rst,start; reg [1:0] mode; wire [2:0] state; wire done;
washing_machine dut(.clk(clk),.rst(rst),.start(start),.mode(mode),.state(state),.done(done));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; start=0; mode=0; @(posedge clk);#1; @(posedge clk);#... |
136_parking_meter | bundles/L2_sequential/136_parking_meter | Parking Meter FSM | L2_sequential | L2 | 136 | # Problem 136: Parking Meter FSM
## Description
Parking meter: 5 cents = 10min, 10 cents = 20min.
## Module Interface
```verilog
module parking_meter(
input clk,\n input rst,\n input [1:0] coin,\n output [3:0] time_left,\n output expired
);
// Your implementation here
endmodule
```
## Requireme... | problem_id: '136'
title: Parking Meter FSM
level: 2
category: fsm
description: 'Parking meter: 5 cents = 10min, 10 cents = 20min.'
module_name: parking_meter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
coin:
direction: input
width: 2
time_left:
direction: out... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [1:0] coin; wire [3:0] time_left; wire expired;
parking_meter dut(.clk(clk),.rst(rst),.coin(coin),.time_left(time_left),.expired(expired));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; coin=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
co... |
137_moore_0110 | bundles/L2_sequential/137_moore_0110 | Moore Machine 0110 Detector | L2_sequential | L2 | 137 | # Problem 137: Moore Machine 0110 Detector
## Description
Moore machine to detect sequence 0110 (non-overlapping).
## Module Interface
```verilog
module moore_0110(
input clk,\n input rst,\n input in,\n output out
);
// Your implementation here
endmodule
```
## Requirements
- Implement according ... | problem_id: '137'
title: Moore Machine 0110 Detector
level: 2
category: fsm
description: Moore machine to detect sequence 0110 (non-overlapping).
module_name: moore_0110
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
in:
direction: input
width: 1
out:
direction:... | `timescale 1ns/1ps
module tb; reg clk,rst,in; wire out;
moore_0110 dut(.clk(clk),.rst(rst),.in(in),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail;
task sb; input b; begin in=b; @(posedge clk);#1; end endtask
initial begin fail=0; rst=1; in=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
// Feed 0,1,1,0
sb... |
138_mealy_101 | bundles/L2_sequential/138_mealy_101 | Mealy Machine 101 Detector | L2_sequential | L2 | 138 | # Problem 138: Mealy Machine 101 Detector
## Description
Mealy machine to detect sequence 101 (overlapping).
## Module Interface
```verilog
module mealy_101(
input clk,\n input rst,\n input in,\n output out
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to spec... | problem_id: '138'
title: Mealy Machine 101 Detector
level: 2
category: fsm
description: Mealy machine to detect sequence 101 (overlapping).
module_name: mealy_101
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
in:
direction: input
width: 1
out:
direction: output... | `timescale 1ns/1ps
module tb; reg clk,rst,in; wire out;
mealy_101 dut(.clk(clk),.rst(rst),.in(in),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail;
task sb; input b; begin in=b; @(posedge clk);#1; end endtask
initial begin fail=0; rst=1; in=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
sb(1);sb(0);sb(1); i... |
139_arbiter_4way | bundles/L2_sequential/139_arbiter_4way | Arbiter FSM 4-way | L2_sequential | L2 | 139 | # Problem 139: Arbiter FSM 4-way
## Description
Round-robin arbiter for 4 requesters.
## Module Interface
```verilog
module arbiter_4way(
input clk,\n input rst,\n input [3:0] req,\n output [3:0] grant
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specifica... | problem_id: '139'
title: Arbiter FSM 4-way
level: 2
category: fsm
description: Round-robin arbiter for 4 requesters.
module_name: arbiter_4way
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
req:
direction: input
width: 4
grant:
direction: output
width: 4
tes... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [3:0] req; wire [3:0] grant;
arbiter_4way dut(.clk(clk),.rst(rst),.req(req),.grant(grant));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; req=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
req=4'b1010; @(posedge clk);#1; if(grant!==4'b0010)... |
140_prescaler | bundles/L2_sequential/140_prescaler | Prescaler Counter | L2_sequential | L2 | 140 | # Problem 140: Prescaler Counter
## Description
Clock prescaler with configurable division ratio (2-128).
## Module Interface
```verilog
module prescaler(
input clk,\n input rst,\n input [2:0] div,\n output clk_out
);
// Your implementation here
endmodule
```
## Requirements
- Implement according... | problem_id: '140'
title: Prescaler Counter
level: 2
category: counters
description: Clock prescaler with configurable division ratio (2-128).
module_name: prescaler
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
div:
direction: input
width: 3
clk_out:
direction:... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [2:0] div; wire clk_out;
prescaler dut(.clk(clk),.rst(rst),.div(div),.clk_out(clk_out));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; div=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=0;i<20;i=i+1) @(posedge clk);#1;
// Just verif... |
141_div_by_3 | bundles/L2_sequential/141_div_by_3 | Frequency Divider by 3 | L2_sequential | L2 | 141 | # Problem 141: Frequency Divider by 3
## Description
Divide input clock by 3 with 50% duty cycle.
## Module Interface
```verilog
module div_by_3(
input clk,\n input rst,\n output clk_out
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specification
- Use synthes... | problem_id: '141'
title: Frequency Divider by 3
level: 2
category: counters
description: Divide input clock by 3 with 50% duty cycle.
module_name: div_by_3
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
clk_out:
direction: output
width: 1
testbench_file: testbench.v
t... | `timescale 1ns/1ps
module tb; reg clk,rst; wire clk_out;
div_by_3 dut(.clk(clk),.rst(rst),.clk_out(clk_out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
repeat(12) @(posedge clk);#1;
if(fail==0)$display("TEST PASSED");else $display("TEST FA... |
142_div_by_5 | bundles/L2_sequential/142_div_by_5 | Frequency Divider by 5 | L2_sequential | L2 | 142 | # Problem 142: Frequency Divider by 5
## Description
Divide input clock by 5.
## Module Interface
```verilog
module div_by_5(
input clk,\n input rst,\n output clk_out
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specification
- Use synthesizable Verilog/Syste... | problem_id: '142'
title: Frequency Divider by 5
level: 2
category: counters
description: Divide input clock by 5.
module_name: div_by_5
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
clk_out:
direction: output
width: 1
testbench_file: testbench.v
timeout_compile: 10
t... | `timescale 1ns/1ps
module tb; reg clk,rst; wire clk_out;
div_by_5 dut(.clk(clk),.rst(rst),.clk_out(clk_out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
repeat(20) @(posedge clk);#1;
if(fail==0)$display("TEST PASSED");else $display("TEST FA... |
143_event_counter | bundles/L2_sequential/143_event_counter | Event Counter | L2_sequential | L2 | 143 | # Problem 143: Event Counter
## Description
Count rising edges of event signal.
## Module Interface
```verilog
module event_counter(
input clk,\n input rst,\n input event,\n output [7:0] count
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specification
- Us... | problem_id: '143'
title: Event Counter
level: 2
category: counters
description: Count rising edges of event signal.
module_name: event_counter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
event:
direction: input
width: 1
count:
direction: output
width: 8
t... | `timescale 1ns/1ps
module tb; reg clk,rst,event_in; wire [7:0] count;
event_counter dut(.clk(clk),.rst(rst),.event_in(event_in),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; event_in=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
event_in=1; @(posedge clk);#1; event_in=0... |
144_pulse_width_counter | bundles/L2_sequential/144_pulse_width_counter | Pulse Width Counter | L2_sequential | L2 | 144 | # Problem 144: Pulse Width Counter
## Description
Measure pulse width in clock cycles.
## Module Interface
```verilog
module pulse_width_counter(
input clk,\n input rst,\n input pulse,\n output [7:0] width
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to speci... | problem_id: '144'
title: Pulse Width Counter
level: 2
category: counters
description: Measure pulse width in clock cycles.
module_name: pulse_width_counter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
pulse:
direction: input
width: 1
width:
direction: output
... | `timescale 1ns/1ps
module tb; reg clk,rst,pulse; wire [7:0] width;
pulse_width_counter dut(.clk(clk),.rst(rst),.pulse(pulse),.width(width));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; pulse=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
pulse=1; @(posedge clk);#1; @(posedge clk);#1; ... |
145_lfsr_16 | bundles/L2_sequential/145_lfsr_16 | 16-bit LFSR | L2_sequential | L2 | 145 | # Problem 145: 16-bit LFSR
## Description
16-bit Linear Feedback Shift Register (maximal length).
## Module Interface
```verilog
module lfsr_16(
input clk,\n input rst,\n input [15:0] seed,\n input load,\n output [15:0] out
);
// Your implementation here
endmodule
```
## Requirements
- Impleme... | problem_id: '145'
title: 16-bit LFSR
level: 2
category: shift_registers
description: 16-bit Linear Feedback Shift Register (maximal length).
module_name: lfsr_16
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
seed:
direction: input
width: 16
load:
direction: inp... | `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [15:0] seed; wire [15:0] out;
lfsr_16 dut(.clk(clk),.rst(rst),.seed(seed),.load(load),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; load=0; seed=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
if(out===0) fail=fail+1; // S... |
146_crc_gen | bundles/L2_sequential/146_crc_gen | CRC Generator | L2_sequential | L2 | 146 | # Problem 146: CRC Generator
## Description
8-bit CRC generator (polynomial: x^8 + x^2 + x + 1).
## Module Interface
```verilog
module crc_gen(
input clk,\n input rst,\n input [7:0] data,\n input valid,\n output [7:0] crc
);
// Your implementation here
endmodule
```
## Requirements
- Implement... | problem_id: '146'
title: CRC Generator
level: 2
category: shift_registers
description: '8-bit CRC generator (polynomial: x^8 + x^2 + x + 1).'
module_name: crc_gen
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data:
direction: input
width: 8
valid:
direction: in... | `timescale 1ns/1ps
module tb; reg clk,rst,valid; reg [7:0] data; wire [7:0] crc;
crc_gen dut(.clk(clk),.rst(rst),.data(data),.valid(valid),.crc(crc));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; valid=0; data=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
data=8'h31; valid=1; @(posedg... |
147_scan_chain | bundles/L2_sequential/147_scan_chain | Scan Chain 8-bit | L2_sequential | L2 | 147 | # Problem 147: Scan Chain 8-bit
## Description
8-bit scan chain for DFT.
## Module Interface
```verilog
module scan_chain(
input clk,\n input scan_en,\n input scan_in,\n input [7:0] data_in,\n output scan_out,\n output [7:0] data_out
);
// Your implementation here
endmodule
```
## Requiremen... | problem_id: '147'
title: Scan Chain 8-bit
level: 2
category: shift_registers
description: 8-bit scan chain for DFT.
module_name: scan_chain
ports:
clk:
direction: input
width: 1
scan_en:
direction: input
width: 1
scan_in:
direction: input
width: 1
data_in:
direction: input
width:... | `timescale 1ns/1ps
module tb; reg clk,scan_en,scan_in; reg [7:0] data_in; wire scan_out; wire [7:0] data_out;
scan_chain dut(.clk(clk),.scan_en(scan_en),.scan_in(scan_in),.data_in(data_in),.scan_out(scan_out),.data_out(data_out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; scan_en=0; scan_in... |
148_multicycle_shift | bundles/L2_sequential/148_multicycle_shift | Multi-Cycle Shift Register | L2_sequential | L2 | 148 | # Problem 148: Multi-Cycle Shift Register
## Description
Shift register that shifts by variable amount (0-7) per cycle.
## Module Interface
```verilog
module multicycle_shift(
input clk,\n input rst,\n input [2:0] shift_amt,\n input [7:0] din,\n output [7:0] dout
);
// Your implementation here
e... | problem_id: '148'
title: Multi-Cycle Shift Register
level: 2
category: shift_registers
description: Shift register that shifts by variable amount (0-7) per cycle.
module_name: multicycle_shift
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
shift_amt:
direction: input
... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [2:0] shift_amt; reg [7:0] din; wire [7:0] dout;
multicycle_shift dut(.clk(clk),.rst(rst),.shift_amt(shift_amt),.din(din),.dout(dout));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; shift_amt=0; din=0; @(posedge clk);#1; @(posedge clk);#1; r... |
149_barrel_shift_reg | bundles/L2_sequential/149_barrel_shift_reg | Barrel Shift Register | L2_sequential | L2 | 149 | # Problem 149: Barrel Shift Register
## Description
Barrel shifter with rotate option.
## Module Interface
```verilog
module barrel_shift_reg(
input clk,\n input rst,\n input [2:0] shift,\n input rotate,\n input [7:0] din,\n output [7:0] dout
);
// Your implementation here
endmodule
```
## R... | problem_id: '149'
title: Barrel Shift Register
level: 2
category: shift_registers
description: Barrel shifter with rotate option.
module_name: barrel_shift_reg
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
shift:
direction: input
width: 3
rotate:
direction: inp... | `timescale 1ns/1ps
module tb; reg clk,rst,rotate; reg [2:0] shift; reg [7:0] din; wire [7:0] dout;
barrel_shift_reg dut(.clk(clk),.rst(rst),.shift(shift),.rotate(rotate),.din(din),.dout(dout));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; shift=0; rotate=0; din=0; @(posedge clk);#1; @(p... |
150_priority_shift | bundles/L2_sequential/150_priority_shift | Priority Shift Register | L2_sequential | L2 | 150 | # Problem 150: Priority Shift Register
## Description
Load highest priority bit first, then shift out.
## Module Interface
```verilog
module priority_shift(
input clk,\n input rst,\n input [7:0] pri_in,\n input load,\n output shift_out
);
// Your implementation here
endmodule
```
## Requirement... | problem_id: '150'
title: Priority Shift Register
level: 2
category: shift_registers
description: Load highest priority bit first, then shift out.
module_name: priority_shift
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
pri_in:
direction: input
width: 8
load:
d... | `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [7:0] pri_in; wire shift_out;
priority_shift dut(.clk(clk),.rst(rst),.pri_in(pri_in),.load(load),.shift_out(shift_out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; load=0; pri_in=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
pri_in... |
151_dff_preset | bundles/L2_sequential/151_dff_preset | D FF with Async Preset | L2_sequential | L2 | 151 | # Problem 151: D FF with Async Preset
## Description
D flip-flop with asynchronous preset.
## Module Interface
```verilog
module dff_preset(
input clk,\n input preset,\n input d,\n output q
);
// Your implementation here
endmodule
```
## Requirements
- Implement according to specification
- Use s... | problem_id: '151'
title: D FF with Async Preset
level: 2
category: flip_flops
description: D flip-flop with asynchronous preset.
module_name: dff_preset
ports:
clk:
direction: input
width: 1
preset:
direction: input
width: 1
d:
direction: input
width: 1
q:
direction: output
width... | `timescale 1ns/1ps
module tb; reg clk,preset,d; wire q;
dff_preset dut(.clk(clk),.preset(preset),.d(d),.q(q));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; preset=1; d=0; @(posedge clk);#1;
if(q!==1) begin fail=fail+1; $display("F1"); end
preset=0; d=0; @(posedge clk);#1;
if(q!==0) begin fail... |
152_dff_sync_rst_en | bundles/L2_sequential/152_dff_sync_rst_en | D FF with Sync Reset and Enable | L2_sequential | L2 | 152 | # Problem 152: D FF with Sync Reset and Enable
## Description
D flip-flop with synchronous reset and enable.
## Module Interface
```verilog
module dff_sync_rst_en(
input clk,\n input rst,\n input en,\n input d,\n output q
);
// Your implementation here
endmodule
```
## Requirements
- Implement... | problem_id: '152'
title: D FF with Sync Reset and Enable
level: 2
category: flip_flops
description: D flip-flop with synchronous reset and enable.
module_name: dff_sync_rst_en
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
en:
direction: input
width: 1
d:
direct... | `timescale 1ns/1ps
module tb; reg clk,rst,en,d; wire q;
dff_sync_rst_en dut(.clk(clk),.rst(rst),.en(en),.d(d),.q(q));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; en=0; d=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
en=1; d=1; @(posedge clk);#1; if(q!==1) fail=fail+1;
en=0; d=0; @(po... |
153_reg_loadable | bundles/L2_sequential/153_reg_loadable | Loadable 8-bit Register | L2_sequential | L2 | 153 | # Problem 153: Loadable 8-bit Register
## Description
8-bit register with load enable.
## Module Interface
```verilog
module reg_loadable(
input clk,\n input rst,\n input load,\n input [7:0] din,\n output [7:0] dout
);
// Your implementation here
endmodule
```
## Requirements
- Implement accor... | problem_id: '153'
title: Loadable 8-bit Register
level: 2
category: flip_flops
description: 8-bit register with load enable.
module_name: reg_loadable
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:
direction: input
width: 1
din:
direction: input
width:... | `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [7:0] din; wire [7:0] dout;
reg_loadable dut(.clk(clk),.rst(rst),.load(load),.din(din),.dout(dout));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; load=0; din=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
din=8'hAB; load=1; @(posedge ... |
154_reg_byte_en | bundles/L2_sequential/154_reg_byte_en | Register with Byte Enable | L2_sequential | L2 | 154 | # Problem 154: Register with Byte Enable
## Description
32-bit register with 4 byte-enable signals.
## Module Interface
```verilog
module reg_byte_en(
input clk,\n input rst,\n input [3:0] be,\n input [31:0] din,\n output [31:0] dout
);
// Your implementation here
endmodule
```
## Requirements
... | problem_id: '154'
title: Register with Byte Enable
level: 2
category: flip_flops
description: 32-bit register with 4 byte-enable signals.
module_name: reg_byte_en
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
be:
direction: input
width: 4
din:
direction: input
... | `timescale 1ns/1ps
module tb; reg clk,rst; reg [3:0] be; reg [31:0] din; wire [31:0] dout;
reg_byte_en dut(.clk(clk),.rst(rst),.be(be),.din(din),.dout(dout));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; be=0; din=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
din=32'hDEADBEEF; be=4'b0... |
155_prog_counter | bundles/L2_sequential/155_prog_counter | Programmable Counter | L2_sequential | L1 | 155 | # Programmable Counter
## Description
Programmable counter with loadable maximum value and terminal count.
## Module Interface
```verilog
module prog_counter (
input clk, input rst, input load, input [7:0] max_val, output [7:0] count, output tc
);
```
## Port Specification
- `clk`: input/1
... | problem_id: 155
title: Programmable Counter
difficulty: L2
module_name: prog_counter
description: Programmable counter with loadable maximum value and terminal count.
ports:
clk: input/1
rst: input/1
load: input/1
max_val: input/8
count: output/8
tc: output/1
testbench: testbench.v
timeout: 10
test_cases: 1... | `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [7:0] max_val; wire [7:0] count; wire tc;
prog_counter dut(.clk(clk),.rst(rst),.load(load),.max_val(max_val),.count(count),.tc(tc));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; load=0; max_val=4; @(posedge clk);#1; @(posedge clk);#1... |
156_bcd_updown | bundles/L2_sequential/156_bcd_updown | BCD Up-Down Counter | L2_sequential | L1 | 156 | # BCD Up-Down Counter
## Description
BCD counter with up/down control.
## Module Interface
```verilog
module bcd_updown (
input clk, input rst, input up, output [3:0] count
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `up`: input/1
- `count`: output/4
## Functionality
This cou... | problem_id: 156
title: BCD Up-Down Counter
difficulty: L2
module_name: bcd_updown
description: BCD counter with up/down control.
ports:
clk: input/1
rst: input/1
up: input/1
count: output/4
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,up; wire [3:0] count;
bcd_updown dut(.clk(clk),.rst(rst),.up(up),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; up=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=0;i<10;i=i+1) begin @(posedge clk);#1;
if(count!==((i+1)%1... |
157_freq_div_n | bundles/L2_sequential/157_freq_div_n | Frequency Divider N | L2_sequential | L1 | 157 | # Frequency Divider N
## Description
Programmable frequency divider by N.
## Module Interface
```verilog
module freq_div_n (
input clk, input rst, input [7:0] n, output clk_out
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `n`: input/8
- `clk_out`: output/1
## Functionality
Imp... | problem_id: 157
title: Frequency Divider N
difficulty: L2
module_name: freq_div_n
description: Programmable frequency divider by N.
ports:
clk: input/1
rst: input/1
n: input/8
clk_out: output/1
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst; reg [7:0] n; wire clk_out;
freq_div_n dut(.clk(clk),.rst(rst),.n(n),.clk_out(clk_out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; n=4; @(posedge clk);#1; @(posedge clk);#1; rst=0;
repeat(20) @(posedge clk);#1;
if(fail==0)$display("TEST PASSE... |
158_dual_clk_counter | bundles/L2_sequential/158_dual_clk_counter | Dual Clock Counter | L2_sequential | L1 | 158 | # Dual Clock Counter
## Description
Counter with two clock inputs and selection.
## Module Interface
```verilog
module dual_clk_counter (
input clk1, input clk2, input rst, input sel, output [7:0] count
);
```
## Port Specification
- `clk1`: input/1
- `clk2`: input/1
- `rst`: input/1
- `sel`: i... | problem_id: 158
title: Dual Clock Counter
difficulty: L2
module_name: dual_clk_counter
description: Counter with two clock inputs and selection.
ports:
clk1: input/1
clk2: input/1
rst: input/1
sel: input/1
count: output/8
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk1,clk2,rst,sel; wire [7:0] count;
dual_clk_counter dut(.clk1(clk1),.clk2(clk2),.rst(rst),.sel(sel),.count(count));
initial clk1=0; always #5 clk1=~clk1;
initial clk2=0; always #7 clk2=~clk2;
integer fail;
initial begin fail=0; rst=1; sel=0; @(posedge clk1);#1; @(posedge clk1);#1; rs... |
159_cascade_counter | bundles/L2_sequential/159_cascade_counter | Cascadable Counter 8-bit | L2_sequential | L1 | 159 | # Cascadable Counter 8-bit
## Description
8-bit counter with carry-out for cascading.
## Module Interface
```verilog
module cascade_counter (
input clk, input rst, input en, output [7:0] count, output cout
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `en`: input/1
- `count`:... | problem_id: 159
title: Cascadable Counter 8-bit
difficulty: L2
module_name: cascade_counter
description: 8-bit counter with carry-out for cascading.
ports:
clk: input/1
rst: input/1
en: input/1
count: output/8
cout: output/1
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,en; wire [7:0] count; wire cout;
cascade_counter dut(.clk(clk),.rst(rst),.en(en),.count(count),.cout(cout));
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; repeat(5) @(posedge clk);#1;
if(co... |
160_event_rate_counter | bundles/L2_sequential/160_event_rate_counter | Event Rate Counter | L2_sequential | L1 | 160 | # Event Rate Counter
## Description
Count events within a gate period.
## Module Interface
```verilog
module event_rate_counter (
input clk, input rst, input event, input gate, output [15:0] count
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `event`: input/1
- `gate`: input/... | problem_id: 160
title: Event Rate Counter
difficulty: L2
module_name: event_rate_counter
description: Count events within a gate period.
ports:
clk: input/1
rst: input/1
event: input/1
gate: input/1
count: output/16
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,event_in,gate; wire [15:0] count;
event_rate_counter dut(.clk(clk),.rst(rst),.event_in(event_in),.gate(gate),.count(count));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; event_in=0; gate=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
gate=1; ev... |
171_circular_shift | bundles/L2_sequential/171_circular_shift | Circular Shift Register | L2_sequential | L1 | 171 | # Circular Shift Register
## Description
8-bit circular shift register.
## Module Interface
```verilog
module circular_shift (
input clk, input rst, input load, input [7:0] data, output [7:0] out
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `load`: input/1
- `data`: input/8
... | problem_id: 171
title: Circular Shift Register
difficulty: L2
module_name: circular_shift
description: 8-bit circular shift register.
ports:
clk: input/1
rst: input/1
load: input/1
data: input/8
out: output/8
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [7:0] data; wire [7:0] out;
circular_shift dut(.clk(clk),.rst(rst),.load(load),.data(data),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; load=0; data=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
data=8'h01; load=1; @(pose... |
172_prog_delay | bundles/L2_sequential/172_prog_delay | Programmable Delay Line | L2_sequential | L1 | 172 | # Programmable Delay Line
## Description
Programmable delay line (1-8 clock cycles).
## Module Interface
```verilog
module prog_delay (
input clk, input rst, input [2:0] delay, input in, output out
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `delay`: input/3
- `in`: input/1... | problem_id: 172
title: Programmable Delay Line
difficulty: L2
module_name: prog_delay
description: Programmable delay line (1-8 clock cycles).
ports:
clk: input/1
rst: input/1
delay: input/3
in: input/1
out: output/1
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,in; reg [2:0] delay; wire out;
prog_delay dut(.clk(clk),.rst(rst),.delay(delay),.in(in),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; in=0; delay=2; @(posedge clk);#1; @(posedge clk);#1; rst=0;
in=1; @(posedge clk);#1; in=0; @(posedge... |
173_lfsr8_fib | bundles/L2_sequential/173_lfsr8_fib | LFSR 8-bit Fibonacci | L2_sequential | L1 | 173 | # LFSR 8-bit Fibonacci
## Description
8-bit Fibonacci LFSR with loadable seed.
## Module Interface
```verilog
module lfsr8_fib (
input clk, input rst, input [7:0] seed, input load, output [7:0] out
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `seed`: input/8
- `load`: input/... | problem_id: 173
title: LFSR 8-bit Fibonacci
difficulty: L2
module_name: lfsr8_fib
description: 8-bit Fibonacci LFSR with loadable seed.
ports:
clk: input/1
rst: input/1
seed: input/8
load: input/1
out: output/8
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [7:0] seed; wire [7:0] out;
lfsr8_fib dut(.clk(clk),.rst(rst),.seed(seed),.load(load),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; load=0; seed=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=0;i<10;i=i+1) @(posedge... |
174_lfsr8_galois | bundles/L2_sequential/174_lfsr8_galois | LFSR 8-bit Galois | L2_sequential | L1 | 174 | # LFSR 8-bit Galois
## Description
8-bit Galois LFSR with loadable seed.
## Module Interface
```verilog
module lfsr8_galois (
input clk, input rst, input [7:0] seed, input load, output [7:0] out
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `seed`: input/8
- `load`: input/1
-... | problem_id: 174
title: LFSR 8-bit Galois
difficulty: L2
module_name: lfsr8_galois
description: 8-bit Galois LFSR with loadable seed.
ports:
clk: input/1
rst: input/1
seed: input/8
load: input/1
out: output/8
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,load; reg [7:0] seed; wire [7:0] out;
lfsr8_galois dut(.clk(clk),.rst(rst),.seed(seed),.load(load),.out(out));
initial clk=0; always #5 clk=~clk;
integer fail,i;
initial begin fail=0; rst=1; load=0; seed=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
for(i=0;i<10;i=i+1) @(pose... |
181_uart_tx_fsm | bundles/L2_sequential/181_uart_tx_fsm | UART TX FSM | L2_sequential | L1 | 181 | # UART TX FSM
## Description
UART transmitter FSM (8N1 format).
## Module Interface
```verilog
module uart_tx_fsm (
input clk, input rst, input start, input [7:0] data, output tx, output busy
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `start`: input/1
- `data`: input/8... | problem_id: 181
title: UART TX FSM
difficulty: L2
module_name: uart_tx_fsm
description: UART transmitter FSM (8N1 format).
ports:
clk: input/1
rst: input/1
start: input/1
data: input/8
tx: output/1
busy: output/1
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,start; reg [7:0] data; wire tx,busy;
uart_tx_fsm dut(.clk(clk),.rst(rst),.start(start),.data(data),.tx(tx),.busy(busy));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; start=0; data=0; @(posedge clk);#1; @(posedge clk);#1; rst=0;
if(tx!==1) fail=f... |
182_uart_rx_fsm | bundles/L2_sequential/182_uart_rx_fsm | UART RX FSM | L2_sequential | L1 | 182 | # UART RX FSM
## Description
UART receiver FSM (8N1 format).
## Module Interface
```verilog
module uart_rx_fsm (
input clk, input rst, input rx, output [7:0] data, output valid
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `rx`: input/1
- `data`: output/8
- `valid`: output/1
... | problem_id: 182
title: UART RX FSM
difficulty: L2
module_name: uart_rx_fsm
description: UART receiver FSM (8N1 format).
ports:
clk: input/1
rst: input/1
rx: input/1
data: output/8
valid: output/1
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,rx; wire [7:0] data; wire valid;
uart_rx_fsm dut(.clk(clk),.rst(rst),.rx(rx),.data(data),.valid(valid));
initial clk=0; always #5 clk=~clk;
integer fail,i;
reg [7:0] tx_data;
initial begin fail=0; rst=1; rx=1; @(posedge clk);#1; @(posedge clk);#1; rst=0;
tx_data=8'hA5; rx=0; @(... |
183_i2c_master_fsm | bundles/L2_sequential/183_i2c_master_fsm | I2C Master FSM | L2_sequential | L1 | 183 | # I2C Master FSM
## Description
I2C master controller FSM.
## Module Interface
```verilog
module i2c_master_fsm (
input clk, input rst, input start, input rw, input [6:0] addr, output scl, inout sda, output ack
);
```
## Port Specification
- `clk`: input/1
- `rst`: input/1
- `start`... | problem_id: 183
title: I2C Master FSM
difficulty: L2
module_name: i2c_master_fsm
description: I2C master controller FSM.
ports:
clk: input/1
rst: input/1
start: input/1
rw: input/1
addr: input/7
scl: output/1
sda: inout/1
ack: output/1
testbench: testbench.v
timeout: 10
test_cases: 100
| `timescale 1ns/1ps
module tb; reg clk,rst,start,rw; reg [6:0] addr; wire scl; wire sda; wire ack;
reg sda_drive; assign sda = sda_drive ? 1'b0 : 1'bz;
i2c_master_fsm dut(.clk(clk),.rst(rst),.start(start),.rw(rw),.addr(addr),.scl(scl),.sda(sda),.ack(ack));
initial clk=0; always #5 clk=~clk;
integer fail;
pullup(sda);
in... |
184_spi_mode0_fsm | bundles/L2_sequential/184_spi_mode0_fsm | SPI Mode 0 FSM | L2_sequential | L1 | 184 | # SPI Mode 0 FSM
## Description
SPI master FSM (Mode 0: CPOL=0, CPHA=0).
## Module Interface
```verilog
module spi_mode0_fsm (
input clk, input rst, input start, input [7:0] mosi_data, input miso, output sclk, output mosi, output ss, output done
);
```
## Port Specification
- `c... | problem_id: 184
title: SPI Mode 0 FSM
difficulty: L2
module_name: spi_mode0_fsm
description: 'SPI master FSM (Mode 0: CPOL=0, CPHA=0).'
ports:
clk: input/1
rst: input/1
start: input/1
mosi_data: input/8
miso: input/1
sclk: output/1
mosi: output/1
ss: output/1
done: output/1
testbench: testbench.v
time... | `timescale 1ns/1ps
module tb; reg clk,rst,start,miso; reg [7:0] mosi_data; wire sclk,mosi,ss,done;
spi_mode0_fsm dut(.clk(clk),.rst(rst),.start(start),.mosi_data(mosi_data),.miso(miso),.sclk(sclk),.mosi(mosi),.ss(ss),.done(done));
initial clk=0; always #5 clk=~clk;
integer fail;
initial begin fail=0; rst=1; start=0; mi... |
185_sr_ff_enable | bundles/L2_sequential/185_sr_ff_enable | SR Flip-Flop with Enable | L2_sequential | L2 | 185 | # Problem 185: SR Flip-Flop with Enable
## Description
Design an SR (Set-Reset) flip-flop with a synchronous reset and an enable input. When the enable signal is inactive, the flip-flop holds its current state regardless of S and R inputs.
## Module Interface
```verilog
module sr_ff_enable (
input clk,
inpu... | problem_id: '185'
title: SR Flip-Flop with Enable
level: 2
category: flip_flops
description: SR flip-flop with synchronous reset and enable
module_name: sr_ff_enable
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
en:
direction: input
width: 1
s:
direction: input... | `timescale 1ns/1ps
module tb_sr_ff_enable;
reg clk, rst, en, s, r;
wire q;
integer pass_count = 0;
integer fail_count = 0;
sr_ff_enable uut(.clk(clk), .rst(rst), .en(en), .s(s), .r(r), .q(q));
initial clk = 0;
always #5 clk = ~clk;
task check(input expected_q);
begin
... |
186_toggle_ff | bundles/L2_sequential/186_toggle_ff | Toggle Flip-Flop | L2_sequential | L2 | 186 | # Problem 186: Toggle Flip-Flop
## Description
Design a toggle (T) flip-flop with synchronous reset. When the toggle input is asserted, the output inverts on each clock edge. When the toggle input is deasserted, the output holds.
## Module Interface
```verilog
module toggle_ff (
input clk,
input rst,
in... | problem_id: '186'
title: Toggle Flip-Flop
level: 2
category: flip_flops
description: Toggle flip-flop with synchronous reset
module_name: toggle_ff
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
t:
direction: input
width: 1
q:
direction: output
width: 1
test... | `timescale 1ns/1ps
module tb_toggle_ff;
reg clk, rst, t;
wire q;
integer pass_count = 0;
integer fail_count = 0;
toggle_ff uut(.clk(clk), .rst(rst), .t(t), .q(q));
initial clk = 0;
always #5 clk = ~clk;
task check(input expected_q);
begin
@(posedge clk); #1;
i... |
187_counter_8bit_load | bundles/L2_sequential/187_counter_8bit_load | 8-bit Up Counter with Synchronous Load | L2_sequential | L2 | 187 | # Problem 187: 8-bit Up Counter with Synchronous Load
## Description
Design an 8-bit up counter with synchronous reset, parallel load capability, and count enable. The counter supports loading an arbitrary value and counting up from that value when enabled.
## Module Interface
```verilog
module counter_8bit_load (
... | problem_id: '187'
title: 8-bit Up Counter with Synchronous Load
level: 2
category: counters
description: 8-bit up counter with synchronous reset, parallel load, and enable
module_name: counter_8bit_load
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:
direction: input... | `timescale 1ns/1ps
module tb_counter_8bit_load;
reg clk, rst, load, enable;
reg [7:0] data_in;
wire [7:0] count;
integer pass_count = 0;
integer fail_count = 0;
counter_8bit_load uut(.clk(clk), .rst(rst), .load(load),
.data_in(data_in), .enable(enable), .count(count))... |
188_down_counter_tc | bundles/L2_sequential/188_down_counter_tc | 8-bit Down Counter with Terminal Count | L2_sequential | L2 | 188 | # Problem 188: 8-bit Down Counter with Terminal Count
## Description
Design an 8-bit down counter with a synchronous reset and a terminal count output. The counter resets to 255 and counts down when enabled. The terminal count signal indicates when the counter has reached zero and is enabled.
## Module Interface
``... | problem_id: '188'
title: 8-bit Down Counter with Terminal Count
level: 2
category: counters
description: 8-bit down counter with terminal count output
module_name: down_counter_tc
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
enable:
direction: input
width: 1
count... | `timescale 1ns/1ps
module tb_down_counter_tc;
reg clk, rst, enable;
wire [7:0] count;
wire tc;
integer pass_count = 0;
integer fail_count = 0;
down_counter_tc uut(.clk(clk), .rst(rst), .enable(enable),
.count(count), .tc(tc));
initial clk = 0;
always #5 clk = ~... |
189_bidir_counter_4bit | bundles/L2_sequential/189_bidir_counter_4bit | 4-bit Bidirectional Counter | L2_sequential | L2 | 189 | # Problem 189: 4-bit Bidirectional Counter
## Description
Design a 4-bit bidirectional (up/down) counter with synchronous reset, enable, and direction control. The counter can count up or down depending on the direction input.
## Module Interface
```verilog
module bidir_counter_4bit (
input clk,
input rst,
... | problem_id: '189'
title: 4-bit Bidirectional Counter
level: 2
category: counters
description: 4-bit bidirectional counter with direction control
module_name: bidir_counter_4bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
enable:
direction: input
width: 1
dir:
... | `timescale 1ns/1ps
module tb_bidir_counter_4bit;
reg clk, rst, enable, dir;
wire [3:0] count;
integer pass_count = 0;
integer fail_count = 0;
bidir_counter_4bit uut(.clk(clk), .rst(rst), .enable(enable),
.dir(dir), .count(count));
initial clk = 0;
always #5 clk ... |
190_mod_n_counter | bundles/L2_sequential/190_mod_n_counter | Modulo-N Counter (N=12) | L2_sequential | L2 | 190 | # Problem 190: Modulo-N Counter (N=12)
## Description
Design a modulo-12 counter that counts from 0 to 11 and wraps back to 0. A one-cycle wrap pulse is generated when the counter transitions from 11 to 0.
## Module Interface
```verilog
module mod_n_counter (
input clk,
input rst,
input enable,
outp... | problem_id: '190'
title: Modulo-N Counter (N=12)
level: 2
category: counters
description: Modulo-12 counter with wrap pulse output
module_name: mod_n_counter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
enable:
direction: input
width: 1
count:
direction: outpu... | `timescale 1ns/1ps
module tb_mod_n_counter;
reg clk, rst, enable;
wire [3:0] count;
wire wrap;
integer pass_count = 0;
integer fail_count = 0;
integer i;
mod_n_counter uut(.clk(clk), .rst(rst), .enable(enable),
.count(count), .wrap(wrap));
initial clk = 0;
al... |
191_pulse_generator | bundles/L2_sequential/191_pulse_generator | Pulse Generator (Rising Edge to Pulse) | L2_sequential | L2 | 191 | # Problem 191: Pulse Generator (Rising Edge to Pulse)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a pulse generator that detects the rising edge of an input signal and produces a single-cycle high pulse on the output. The output should be high for exactly one clock cycle each... | problem_id: '191'
title: Pulse Generator (Rising Edge to Pulse)
level: 2
category: sequential_logic
description: Detect rising edge of signal_in and generate a single-cycle pulse on pulse_out
module_name: pulse_generator
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
signal_i... | `timescale 1ns/1ps
module tb_pulse_generator;
reg clk, rst, signal_in;
wire pulse_out;
pulse_generator uut(.clk(clk), .rst(rst), .signal_in(signal_in), .pulse_out(pulse_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
initial begin
... |
192_falling_edge_det | bundles/L2_sequential/192_falling_edge_det | Falling Edge Detector | L2_sequential | L2 | 192 | # Problem 192: Falling Edge Detector
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a falling edge detector that monitors an input signal and produces a single-cycle high pulse on the output whenever the input transitions from 1 to 0.
## Module Interface
```verilog
module fall... | problem_id: '192'
title: Falling Edge Detector
level: 2
category: sequential_logic
description: Detect falling edge of signal_in and generate a single-cycle pulse on edge_out
module_name: falling_edge_det
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
signal_in:
direction... | `timescale 1ns/1ps
module tb_falling_edge_det;
reg clk, rst, signal_in;
wire edge_out;
falling_edge_det uut(.clk(clk), .rst(rst), .signal_in(signal_in), .edge_out(edge_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
initial begin
... |
193_shift_reg_load_4 | bundles/L2_sequential/193_shift_reg_load_4 | 4-bit Shift Register with Parallel Load | L2_sequential | L2 | 193 | # Problem 193: 4-bit Shift Register with Parallel Load
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Description
Design a 4-bit shift register that supports parallel loading and right-shifting with a serial input. When load is active, the register loads the parallel input data. When shift_en is ac... | problem_id: '193'
title: 4-bit Shift Register with Parallel Load
level: 2
category: shift_registers
description: 4-bit shift register with parallel load, right shift, and serial I/O
module_name: shift_reg_load_4
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:
directi... | `timescale 1ns/1ps
module tb_shift_reg_load_4;
reg clk, rst, load, shift_en, serial_in;
reg [3:0] parallel_in;
wire serial_out;
wire [3:0] parallel_out;
shift_reg_load_4 uut(
.clk(clk), .rst(rst), .load(load), .shift_en(shift_en),
.serial_in(serial_in), .parallel_in(parallel_in),
... |
194_accumulator_8bit | bundles/L2_sequential/194_accumulator_8bit | 8-bit Accumulator | L2_sequential | L2 | 194 | # Problem 194: 8-bit Accumulator
**Level**: 2 (Sequential Logic)
**Category**: arithmetic_sequential
## Description
Design an 8-bit accumulator that adds an 8-bit input value to a running 16-bit sum on each enabled clock cycle. The wider output register prevents overflow for many addition cycles.
## Module Interfac... | problem_id: '194'
title: 8-bit Accumulator
level: 2
category: arithmetic_sequential
description: 8-bit accumulator with enable that sums input values into a 16-bit register
module_name: accumulator_8bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
enable:
direction: inp... | `timescale 1ns/1ps
module tb_accumulator_8bit;
reg clk, rst, enable;
reg [7:0] data_in;
wire [15:0] accum;
accumulator_8bit uut(.clk(clk), .rst(rst), .enable(enable), .data_in(data_in), .accum(accum));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count... |
195_lfsr4_fibonacci | bundles/L2_sequential/195_lfsr4_fibonacci | 4-bit LFSR (Fibonacci) | L2_sequential | L2 | 195 | # Problem 195: 4-bit LFSR (Fibonacci)
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Description
Design a 4-bit Linear Feedback Shift Register (LFSR) using the Fibonacci configuration. The feedback is generated by XORing bits 3 and 2, and the result is fed into bit 0 as the register shifts left.
#... | problem_id: '195'
title: 4-bit LFSR (Fibonacci)
level: 2
category: shift_registers
description: 4-bit Linear Feedback Shift Register with Fibonacci configuration using XOR taps at bits 3 and 2
module_name: lfsr4_fibonacci
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
q:
... | `timescale 1ns/1ps
module tb_lfsr4_fibonacci;
reg clk, rst;
wire [3:0] q;
lfsr4_fibonacci uut(.clk(clk), .rst(rst), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
// Expected sequence starting from seed 4'b0001:
// Cycle 0 (after... |
196_seq_generator | bundles/L2_sequential/196_seq_generator | Sequence Generator (1-2-4-8-4-2 repeat) | L2_sequential | L2 | 196 | # Problem 196: Sequence Generator (1-2-4-8-4-2 repeat)
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a sequence generator that outputs a bouncing pattern of values: 1, 2, 4, 8, 4, 2, and then repeats. This creates a "ping-pong" or "bounce" pattern where a single bit appears to shift left an... | problem_id: '196'
title: Sequence Generator (1-2-4-8-4-2 repeat)
level: 2
category: fsm
description: Sequence generator that outputs a bouncing pattern 1-2-4-8-4-2 repeating
module_name: seq_generator
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
value:
direction: output... | `timescale 1ns/1ps
module tb_seq_generator;
reg clk, rst;
wire [3:0] value;
seq_generator uut(.clk(clk), .rst(rst), .value(value));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
// Expected sequence: 1, 2, 4, 8, 4, 2, 1, 2, 4, 8, 4, 2, ...
... |
197_shift_reg_left_8 | bundles/L2_sequential/197_shift_reg_left_8 | 8-bit Loadable Shift Register (Left) | L2_sequential | L2 | 197 | # Problem 197: 8-bit Loadable Shift Register (Left)
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Description
Design an 8-bit shift register that supports parallel loading and left shifting with a serial input. The most significant bit is available as a serial output, allowing data to be shifted o... | problem_id: '197'
title: 8-bit Loadable Shift Register (Left)
level: 2
category: shift_registers
description: 8-bit shift register with parallel load and left shift with serial input and output
module_name: shift_reg_left_8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:... | `timescale 1ns/1ps
module tb_shift_reg_left_8;
reg clk, rst, load, shift_en, serial_in;
reg [7:0] parallel_in;
wire serial_out;
wire [7:0] parallel_out;
shift_reg_left_8 uut(
.clk(clk), .rst(rst), .load(load), .shift_en(shift_en),
.serial_in(serial_in), .parallel_in(parallel_in),
... |
198_pwm_counter_8 | bundles/L2_sequential/198_pwm_counter_8 | PWM Counter (8-bit) | L2_sequential | L2 | 198 | # Problem 198: PWM Counter (8-bit)
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design an 8-bit PWM (Pulse Width Modulation) generator. A free-running 8-bit counter increments every clock cycle, and the PWM output is high when the counter value is less than the duty cycle input. This produce... | problem_id: '198'
title: PWM Counter (8-bit)
level: 2
category: counters
description: 8-bit PWM generator with configurable duty cycle using a free-running counter
module_name: pwm_counter_8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
duty:
direction: input
width: ... | `timescale 1ns/1ps
module tb_pwm_counter_8;
reg clk, rst;
reg [7:0] duty;
wire pwm_out;
pwm_counter_8 uut(.clk(clk), .rst(rst), .duty(duty), .pwm_out(pwm_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
integer high_count;
intege... |
199_debounce_4cycle | bundles/L2_sequential/199_debounce_4cycle | Debounce Filter (4-cycle) | L2_sequential | L2 | 199 | # Problem 199: Debounce Filter (4-cycle)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a digital debounce filter that requires the input signal to be stable for 4 consecutive clock cycles before the output changes to match the input. This filters out short glitches and bouncing... | problem_id: '199'
title: Debounce Filter (4-cycle)
level: 2
category: sequential_logic
description: Digital debounce filter that requires 4 consecutive stable clock cycles before changing output
module_name: debounce_4cycle
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
noisy... | `timescale 1ns/1ps
module tb_debounce_4cycle;
reg clk, rst, noisy_in;
wire clean_out;
debounce_4cycle uut(.clk(clk), .rst(rst), .noisy_in(noisy_in), .clean_out(clean_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
// Trace of reference ... |
200_sat_counter_4bit | bundles/L2_sequential/200_sat_counter_4bit | 4-bit Up/Down Saturating Counter | L2_sequential | L2 | 200 | # Problem 200: 4-bit Up/Down Saturating Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design a 4-bit saturating counter with separate up and down control inputs. Unlike a wrapping counter, a saturating counter clamps at its maximum value (15) when counting up and at its minimum value ... | problem_id: '200'
title: 4-bit Up/Down Saturating Counter
level: 2
category: counters
description: 4-bit counter that saturates at 0 and 15 with independent up and down controls
module_name: sat_counter_4bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
up:
direction: in... | `timescale 1ns/1ps
module tb_sat_counter_4bit;
reg clk, rst, up, down;
wire [3:0] count;
sat_counter_4bit uut(.clk(clk), .rst(rst), .up(up), .down(down), .count(count));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
integer i;
initial b... |
201_seq_det_110 | bundles/L2_sequential/201_seq_det_110 | Sequence Detector FSM (Pattern 110) | L2_sequential | L2 | 201 | # Problem 201: Sequence Detector FSM (Pattern "110")
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a finite state machine that detects the bit pattern "110" in a serial input stream. The detector should allow overlapping sequences, meaning after detecting "110", it should be ready to detect... | problem_id: '201'
title: Sequence Detector FSM (Pattern 110)
level: 2
category: fsm
description: Mealy-style FSM to detect overlapping pattern 110 in a serial bit stream
module_name: seq_det_110
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data_in:
direction: input
... | `timescale 1ns/1ps
module tb_seq_det_110;
reg clk, rst, data_in;
wire detected;
seq_det_110 uut(.clk(clk), .rst(rst), .data_in(data_in), .detected(detected));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
// Task to apply one bit and wait fo... |
202_pattern_lock | bundles/L2_sequential/202_pattern_lock | Moore FSM 3-bit Pattern Lock | L2_sequential | L2 | 202 | # Problem 202: Moore FSM: 3-bit Pattern Lock
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a Moore FSM that implements a combination lock. The lock expects a specific sequence of three 2-bit key inputs: first `2'b01`, then `2'b10`, then `2'b11`. When all three keys are entered correctly in ... | problem_id: '202'
title: Moore FSM 3-bit Pattern Lock
level: 2
category: fsm
description: Moore FSM that unlocks when the correct 3-key sequence 01, 10, 11 is entered in order
module_name: pattern_lock
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
key_in:
direction: inpu... | `timescale 1ns/1ps
module tb_pattern_lock;
reg clk, rst;
reg [1:0] key_in;
wire unlocked;
pattern_lock uut(.clk(clk), .rst(rst), .key_in(key_in), .unlocked(unlocked));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
task apply_key(input [1... |
203_duty_cycle_meas | bundles/L2_sequential/203_duty_cycle_meas | Duty Cycle Measurement | L2_sequential | L2 | 203 | # Problem 203: Duty Cycle Measurement
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design a circuit that measures the duty cycle of an input signal by counting the number of clock cycles the signal spends high and low during one complete period. A period is defined as the interval from one r... | problem_id: '203'
title: Duty Cycle Measurement
level: 2
category: counters
description: Measures the high and low cycle counts of an input signal over one full period
module_name: duty_cycle_meas
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
signal_in:
direction: input
... | `timescale 1ns/1ps
module tb_duty_cycle_meas;
reg clk, rst, signal_in;
wire [7:0] high_count, low_count;
wire period_done;
duty_cycle_meas uut(
.clk(clk), .rst(rst), .signal_in(signal_in),
.high_count(high_count), .low_count(low_count), .period_done(period_done)
);
initial cl... |
204_prog_timer_8bit | bundles/L2_sequential/204_prog_timer_8bit | 8-bit Programmable Timer | L2_sequential | L2 | 204 | # Problem 204: 8-bit Programmable Timer
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design an 8-bit programmable countdown timer. When `start` is pulsed, the timer loads the `period` value and begins counting down by one each clock cycle. While counting, `running` is asserted. When the coun... | problem_id: '204'
title: 8-bit Programmable Timer
level: 2
category: counters
description: Countdown timer with programmable period that pulses expired when the count reaches zero
module_name: prog_timer_8bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
start:
direction... | `timescale 1ns/1ps
module tb_prog_timer_8bit;
reg clk, rst, start;
reg [7:0] period;
wire expired, running;
prog_timer_8bit uut(
.clk(clk), .rst(rst), .start(start), .period(period),
.expired(expired), .running(running)
);
initial clk = 0;
always #5 clk = ~clk;
integ... |
205_bit_stuffer | bundles/L2_sequential/205_bit_stuffer | Mealy FSM Bit Stuffer | L2_sequential | L2 | 205 | # Problem 205: Mealy FSM: Bit Stuffer (Insert 0 After Five 1s)
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a bit-stuffing FSM used in protocols such as HDLC. The circuit monitors an incoming serial bit stream and inserts a `0` bit after every five consecutive `1` bits. During the cycle wh... | problem_id: '205'
title: Mealy FSM Bit Stuffer
level: 2
category: fsm
description: Inserts a 0 bit after every five consecutive 1s in a serial data stream
module_name: bit_stuffer
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data_in:
direction: input
width: 1
data... | `timescale 1ns/1ps
module tb_bit_stuffer;
reg clk, rst, data_in, data_valid;
wire data_out, out_valid, stuffed;
bit_stuffer uut(
.clk(clk), .rst(rst), .data_in(data_in), .data_valid(data_valid),
.data_out(data_out), .out_valid(out_valid), .stuffed(stuffed)
);
initial clk = 0;
... |
206_par_to_ser_8 | bundles/L2_sequential/206_par_to_ser_8 | 8-bit Parallel-to-Serial Converter | L2_sequential | L2 | 206 | # Problem 206: 8-bit Parallel-to-Serial Converter
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Description
Design an 8-bit parallel-to-serial converter. When `load` is pulsed, the 8-bit `data_in` is latched into an internal shift register and the converter begins shifting out bits serially, MSB f... | problem_id: '206'
title: 8-bit Parallel-to-Serial Converter
level: 2
category: shift_registers
description: Latches an 8-bit parallel input and shifts it out serially MSB first
module_name: par_to_ser_8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
load:
direction: input... | `timescale 1ns/1ps
module tb_par_to_ser_8;
reg clk, rst, load;
reg [7:0] data_in;
wire serial_out, busy, done;
par_to_ser_8 uut(
.clk(clk), .rst(rst), .load(load), .data_in(data_in),
.serial_out(serial_out), .busy(busy), .done(done)
);
initial clk = 0;
always #5 clk = ~cl... |
207_ser_to_par_8 | bundles/L2_sequential/207_ser_to_par_8 | 8-bit Serial-to-Parallel Converter | L2_sequential | L2 | 207 | # Problem 207: 8-bit Serial-to-Parallel Converter
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Description
Design an 8-bit serial-to-parallel converter. When `start` is pulsed, the circuit begins capturing bits from `serial_in` on each subsequent clock cycle, MSB first. After 8 bits have been rec... | problem_id: '207'
title: 8-bit Serial-to-Parallel Converter
level: 2
category: shift_registers
description: Captures 8 serial input bits MSB first and outputs the assembled byte with a done pulse
module_name: ser_to_par_8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
serial_... | `timescale 1ns/1ps
module tb_ser_to_par_8;
reg clk, rst, serial_in, start;
wire [7:0] data_out;
wire done;
ser_to_par_8 uut(
.clk(clk), .rst(rst), .serial_in(serial_in), .start(start),
.data_out(data_out), .done(done)
);
initial clk = 0;
always #5 clk = ~clk;
integer... |
208_running_max_8 | bundles/L2_sequential/208_running_max_8 | 8-bit Running Maximum Tracker | L2_sequential | L2 | 208 | # Problem 208: 8-bit Running Maximum Tracker
**Level**: 2 (Sequential Logic)
**Category**: arithmetic_sequential
## Description
Design an 8-bit running maximum tracker that records the largest value observed in a stream of input data. When a valid sample arrives that is greater than the current maximum, the stored m... | problem_id: '208'
title: 8-bit Running Maximum Tracker
level: 2
category: arithmetic_sequential
description: Track the running maximum of a sequence of 8-bit input values with valid strobe
module_name: running_max_8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data_in:
... | `timescale 1ns/1ps
module tb_running_max_8;
reg clk, rst, valid;
reg [7:0] data_in;
wire [7:0] max_val;
running_max_8 uut(.clk(clk), .rst(rst), .data_in(data_in), .valid(valid), .max_val(max_val));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0... |
209_running_min_8 | bundles/L2_sequential/209_running_min_8 | 8-bit Running Minimum Tracker | L2_sequential | L2 | 209 | # Problem 209: 8-bit Running Minimum Tracker
**Level**: 2 (Sequential Logic)
**Category**: arithmetic_sequential
## Description
Design an 8-bit running minimum tracker that records the smallest value observed in a stream of input data. When a valid sample arrives that is less than the current minimum, the stored min... | problem_id: '209'
title: 8-bit Running Minimum Tracker
level: 2
category: arithmetic_sequential
description: Track the running minimum of a sequence of 8-bit input values with valid strobe
module_name: running_min_8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data_in:
... | `timescale 1ns/1ps
module tb_running_min_8;
reg clk, rst, valid;
reg [7:0] data_in;
wire [7:0] min_val;
running_min_8 uut(.clk(clk), .rst(rst), .data_in(data_in), .valid(valid), .min_val(min_val));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0... |
210_branch_predictor_2bit | bundles/L2_sequential/210_branch_predictor_2bit | 2-bit Saturating Branch Predictor | L2_sequential | L2 | 210 | # Problem 210: 2-bit Saturating Branch Predictor
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a classic 2-bit saturating counter branch predictor. This is a fundamental component in CPU pipeline design that predicts whether a branch instruction will be taken or not taken, based on recent b... | problem_id: '210'
title: 2-bit Saturating Branch Predictor
level: 2
category: fsm
description: Classic 2-bit saturating counter branch predictor FSM
module_name: branch_predictor_2bit
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
update:
direction: input
width: 1
t... | `timescale 1ns/1ps
module tb_branch_predictor_2bit;
reg clk, rst, update, taken;
wire prediction;
wire [1:0] state;
branch_predictor_2bit uut(.clk(clk), .rst(rst), .update(update), .taken(taken),
.prediction(prediction), .state(state));
initial clk = 0;
always #... |
211_clk_div2 | bundles/L2_sequential/211_clk_div2 | Clock Divider by 2 with 50% Duty Cycle | L2_sequential | L2 | 211 | # Problem 211: Clock Divider by 2 with 50% Duty Cycle
**Level**: 2 (Sequential Logic)
**Category**: clock_dividers
## Description
Design a clock divider that divides the input clock frequency by 2, producing an output clock with a 50% duty cycle. The output toggles on every rising edge of the input clock.
## Module... | problem_id: '211'
title: Clock Divider by 2 with 50% Duty Cycle
level: 2
category: clock_dividers
description: Divide clock frequency by 2 by toggling output on each rising edge
module_name: clk_div2
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
clk_out:
direction: outpu... | `timescale 1ns/1ps
module tb_clk_div2;
reg clk, rst;
wire clk_out;
clk_div2 uut(.clk(clk), .rst(rst), .clk_out(clk_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
reg prev_clk_out;
integer toggle_count;
initial begin
// ... |
212_clk_div_n | bundles/L2_sequential/212_clk_div_n | Clock Divider by N (N=6) with 50% Duty Cycle | L2_sequential | L2 | 212 | # Problem 212: Clock Divider by N (N=6) with 50% Duty Cycle
**Level**: 2 (Sequential Logic)
**Category**: clock_dividers
## Description
Design a clock divider that divides the input clock frequency by 6, producing an output clock with a 50% duty cycle. A counter counts from 0 to 5 and the output is determined by the... | problem_id: '212'
title: Clock Divider by N (N=6) with 50% Duty Cycle
level: 2
category: clock_dividers
description: Divide clock frequency by 6 with 50% duty cycle using a modulo-6 counter
module_name: clk_div_n
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
clk_out:
dir... | `timescale 1ns/1ps
module tb_clk_div_n;
reg clk, rst;
wire clk_out;
clk_div_n uut(.clk(clk), .rst(rst), .clk_out(clk_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
integer i;
// Expected pattern for counter 0-5: clk_out = 1,1,1,0,0... |
213_event_counter_thresh | bundles/L2_sequential/213_event_counter_thresh | Event Counter with Threshold | L2_sequential | L2 | 213 | # Problem 213: Event Counter with Threshold
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design an 8-bit event counter that counts occurrences of an input event signal and asserts an exceeded flag when the count reaches or exceeds a programmable threshold. The counter saturates at 255 to pre... | problem_id: '213'
title: Event Counter with Threshold
level: 2
category: counters
description: Count events and assert an exceeded flag when count reaches or exceeds a programmable threshold
module_name: event_counter_thresh
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
even... | `timescale 1ns/1ps
module tb_event_counter_thresh;
reg clk, rst, event_in;
reg [7:0] threshold;
wire [7:0] count;
wire exceeded;
event_counter_thresh uut(.clk(clk), .rst(rst), .event_in(event_in),
.threshold(threshold), .count(count), .exceeded(exceeded));
initi... |
214_watchdog_timer | bundles/L2_sequential/214_watchdog_timer | Watchdog Timer (8-bit) | L2_sequential | L2 | 214 | # Problem 214: Watchdog Timer (8-bit)
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design an 8-bit watchdog timer that counts down from a programmable timeout value. If the timer reaches zero without being "kicked" (refreshed), it asserts an expired flag that stays high until the timer is ki... | problem_id: '214'
title: Watchdog Timer (8-bit)
level: 2
category: counters
description: 8-bit countdown watchdog timer that asserts expired when it reaches zero without being kicked
module_name: watchdog_timer
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
kick:
directio... | `timescale 1ns/1ps
module tb_watchdog_timer;
reg clk, rst, kick;
reg [7:0] timeout_val;
wire expired;
watchdog_timer uut(.clk(clk), .rst(rst), .kick(kick),
.timeout_val(timeout_val), .expired(expired));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0... |
215_freq_div3_50duty | bundles/L2_sequential/215_freq_div3_50duty | Frequency Divider by 3 (50% Duty Cycle) | L2_sequential | L2 | 215 | # Problem 215: Frequency Divider by 3 (50% Duty Cycle)
**Level**: 2 (Sequential Logic)
**Category**: clock_dividers
## Description
Design a frequency divider that divides the input clock frequency by 3 and produces an output clock with approximately 50% duty cycle. The classic technique uses a mod-3 counter with fli... | problem_id: '215'
title: Frequency Divider by 3 (50% Duty Cycle)
level: 2
category: clock_dividers
description: Divide clock frequency by 3 with approximately 50% duty cycle using both clock edges
module_name: freq_div3_50duty
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
cl... | `timescale 1ns/1ps
module tb_freq_div3_50duty;
reg clk, rst;
wire clk_out;
freq_div3_50duty uut(.clk(clk), .rst(rst), .clk_out(clk_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
task check_val;
input expected;
input [25... |
216_ring_counter_8 | bundles/L2_sequential/216_ring_counter_8 | 8-bit Ring Counter | L2_sequential | L2 | 216 | # Problem 216: 8-bit Ring Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design an 8-bit ring counter. A ring counter circulates a single '1' bit through all 8 positions in a walking-one pattern. On reset, the counter initializes to `8'b00000001` (only bit 0 is set). Each clock cycle, ... | problem_id: '216'
title: 8-bit Ring Counter
level: 2
category: counters
description: 8-bit ring counter that shifts a single 1 through all bit positions in a circular pattern
module_name: ring_counter_8
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
q:
direction: outp... | `timescale 1ns/1ps
module tb_ring_counter_8;
reg clk, rst;
wire [7:0] q;
ring_counter_8 uut(.clk(clk), .rst(rst), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
task check;
input [7:0] expected;
input [255:0] msg;
... |
217_johnson_counter_8 | bundles/L2_sequential/217_johnson_counter_8 | 8-bit Johnson Counter | L2_sequential | L2 | 217 | # Problem 217: 8-bit Johnson Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design an 8-bit Johnson counter (also known as a twisted ring counter or switch-tail counter). A Johnson counter shifts all bits right by one position each clock cycle, with the complement of the LSB fed back i... | problem_id: '217'
title: 8-bit Johnson Counter
level: 2
category: counters
description: 8-bit Johnson (twisted ring) counter that produces a 16-state sequence
module_name: johnson_counter_8
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
q:
direction: output
width:... | `timescale 1ns/1ps
module tb_johnson_counter_8;
reg clk, rst;
wire [7:0] q;
johnson_counter_8 uut(.clk(clk), .rst(rst), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
task check;
input [7:0] expected;
input [255:0] msg... |
218_stopwatch_bcd | bundles/L2_sequential/218_stopwatch_bcd | BCD Stopwatch Counter (0-99) | L2_sequential | L2 | 218 | # Problem 218: BCD Stopwatch Counter (0-99)
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design a two-digit BCD stopwatch counter that counts from 00 to 99. The counter has enable and clear controls, and produces a one-cycle overflow pulse when the count wraps from 99 back to 00.
## Module ... | problem_id: '218'
title: BCD Stopwatch Counter (0-99)
level: 2
category: counters
description: Two-digit BCD stopwatch counter with enable, clear, and overflow detection
module_name: stopwatch_bcd
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
enable:
direction: input... | `timescale 1ns/1ps
module tb_stopwatch_bcd;
reg clk, rst, enable, clear;
wire [3:0] tens, ones;
wire overflow;
stopwatch_bcd uut(.clk(clk), .rst(rst), .enable(enable),
.clear(clear), .tens(tens), .ones(ones),
.overflow(overflow));
initial clk = 0;
... |
219_valid_ready_latch | bundles/L2_sequential/219_valid_ready_latch | Valid/Ready Data Latch with Acknowledge | L2_sequential | L2 | 219 | # Problem 219: Valid/Ready Data Latch with Acknowledge
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a handshake protocol latch that captures incoming data using a valid/ready handshake and releases it upon receiving an acknowledge signal.
## Module Interface
```verilog
modul... | problem_id: '219'
title: Valid/Ready Data Latch with Acknowledge
level: 2
category: sequential_logic
description: Handshake protocol latch that captures data on valid/ready handshake and releases on acknowledge
module_name: valid_ready_latch
ports:
clk:
direction: input
width: '1'
rst:
direction: input
... | `timescale 1ns/1ps
module tb_valid_ready_latch;
reg clk, rst;
reg [7:0] data_in;
reg valid_in, ack;
wire [7:0] data_out;
wire valid_out, ready;
valid_ready_latch uut(.clk(clk), .rst(rst), .data_in(data_in),
.valid_in(valid_in), .ack(ack),
.d... |
220_gray_up_counter_4 | bundles/L2_sequential/220_gray_up_counter_4 | 4-bit Gray Code Up Counter | L2_sequential | L2 | 220 | # Problem 220: 4-bit Gray Code Up Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design a 4-bit up counter that outputs values in Gray code. Internally maintain a 4-bit binary counter and convert it to Gray code for the output.
## Module Interface
```verilog
module gray_up_counter_4(... | problem_id: '220'
title: 4-bit Gray Code Up Counter
level: 2
category: counters
description: 4-bit up counter that outputs Gray code by converting an internal binary counter
module_name: gray_up_counter_4
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
enable:
directio... | `timescale 1ns/1ps
module tb_gray_up_counter_4;
reg clk, rst, enable;
wire [3:0] gray_out;
gray_up_counter_4 uut(.clk(clk), .rst(rst), .enable(enable), .gray_out(gray_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
// Expected Gray code... |
221_double_buffer | bundles/L2_sequential/221_double_buffer | Double-Buffer Register | L2_sequential | L2 | 221 | # Problem 221: Double-Buffer Register
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a double-buffered 8-bit register with two internal registers (front and back). Data is written to the back buffer and becomes visible on the output only after a swap operation exchanges the fron... | problem_id: '221'
title: Double-Buffer Register
level: 2
category: sequential_logic
description: Double-buffered 8-bit register with front/back buffers, write, and swap operations
module_name: double_buffer
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
data_in:
direc... | `timescale 1ns/1ps
module tb_double_buffer;
reg clk, rst;
reg [7:0] data_in;
reg write_en, swap;
wire [7:0] data_out;
double_buffer uut(.clk(clk), .rst(rst), .data_in(data_in),
.write_en(write_en), .swap(swap), .data_out(data_out));
initial clk = 0;
always #5 clk = ... |
222_moving_avg_4 | bundles/L2_sequential/222_moving_avg_4 | 8-bit Moving Average Filter (4-sample) | L2_sequential | L2 | 222 | # Problem 222: 8-bit Moving Average Filter (4-sample)
**Level**: 2 (Sequential Logic)
**Category**: arithmetic_sequential
## Description
Design an 8-bit moving average filter that computes the average of the last 4 valid samples using a sliding window. The output is the integer division (truncation) of the sum of th... | problem_id: '222'
title: 8-bit Moving Average Filter (4-sample)
level: 2
category: arithmetic_sequential
description: 8-bit moving average filter over a sliding window of 4 samples with integer division
module_name: moving_avg_4
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1... | `timescale 1ns/1ps
module tb_moving_avg_4;
reg clk, rst, valid;
reg [7:0] data_in;
wire [7:0] avg_out;
moving_avg_4 uut(.clk(clk), .rst(rst), .data_in(data_in), .valid(valid), .avg_out(avg_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
... |
223_peak_detector | bundles/L2_sequential/223_peak_detector | Peak Detector (8-bit) | L2_sequential | L2 | 223 | # Problem 223: Peak Detector (8-bit)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design an 8-bit peak detector that identifies local peaks in a data stream. A local peak occurs when the data was rising and then begins to fall. The detector tracks whether the data is rising or fallin... | problem_id: '223'
title: Peak Detector (8-bit)
level: 2
category: sequential_logic
description: 8-bit peak detector that identifies local peaks in a data stream
module_name: peak_detector
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
data_in:
direction: input
wid... | `timescale 1ns/1ps
module tb_peak_detector;
reg clk, rst, valid;
reg [7:0] data_in;
wire [7:0] peak_val;
wire peak_detected;
peak_detector uut(.clk(clk), .rst(rst), .data_in(data_in), .valid(valid),
.peak_val(peak_val), .peak_detected(peak_detected));
initial clk = 0;
... |
224_ber_counter | bundles/L2_sequential/224_ber_counter | Bit Error Rate Counter | L2_sequential | L2 | 224 | # Problem 224: Bit Error Rate Counter
**Level**: 2 (Sequential Logic)
**Category**: counters
## Description
Design a bit error rate (BER) counter that compares an expected bit stream against a received bit stream and counts the total number of bits compared and the number of bit errors.
## Module Interface
```veri... | problem_id: '224'
title: Bit Error Rate Counter
level: 2
category: counters
description: Bit error rate counter that tracks total bits compared and error count
module_name: ber_counter
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
expected:
direction: input
width... | `timescale 1ns/1ps
module tb_ber_counter;
reg clk, rst, expected, received, valid;
wire [15:0] error_count;
wire [15:0] total_count;
ber_counter uut(.clk(clk), .rst(rst), .expected(expected), .received(received),
.valid(valid), .error_count(error_count), .total_count(total_count)... |
225_round_robin_arb_4 | bundles/L2_sequential/225_round_robin_arb_4 | 4-bit Round-Robin Arbiter | L2_sequential | L2 | 225 | # Problem 225: 4-bit Round-Robin Arbiter
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a 4-bit round-robin arbiter. The arbiter receives 4 request lines and grants access to one requester at a time using one-hot encoding. The last granted requester gets the lowest priority, ensuring fair ac... | problem_id: '225'
title: 4-bit Round-Robin Arbiter
level: 2
category: fsm
description: 4-bit round-robin arbiter with one-hot grant output and fair scheduling
module_name: round_robin_arb_4
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
req:
direction: input
width... | `timescale 1ns/1ps
module tb_round_robin_arb_4;
reg clk, rst;
reg [3:0] req;
wire [3:0] grant;
round_robin_arb_4 uut(.clk(clk), .rst(rst), .req(req), .grant(grant));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
initial begin
// ... |
226_morse_sos | bundles/L2_sequential/226_morse_sos | Morse Code Generator (SOS) | L2_sequential | L2 | 226 | # Problem 226: Morse Code Generator (SOS)
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a Morse code generator that outputs the SOS distress signal. When the `start` input is pulsed, the module outputs the complete SOS pattern on `morse_out` with proper Morse timing, and asserts `busy` duri... | problem_id: '226'
title: Morse Code Generator (SOS)
level: 2
category: fsm
description: Morse code generator that outputs SOS pattern with proper timing
module_name: morse_sos
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
start:
direction: input
width: '1'
mors... | `timescale 1ns/1ps
module tb_morse_sos;
reg clk, rst, start;
wire morse_out, busy;
morse_sos uut(.clk(clk), .rst(rst), .start(start), .morse_out(morse_out), .busy(busy));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
// Expected SOS pattern ... |
227_nshot_pulse | bundles/L2_sequential/227_nshot_pulse | N-Shot Pulse Generator (N=4) | L2_sequential | L2 | 227 | # Problem 227: N-Shot Pulse Generator (N=4)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design an N-shot pulse generator with N=4. On a rising edge of the trigger input, the module outputs exactly 4 consecutive clock cycles where `pulse_out` is high. The `active` signal indicates th... | problem_id: '227'
title: N-Shot Pulse Generator (N=4)
level: 2
category: sequential_logic
description: Pulse generator that outputs exactly 4 clock cycles of pulse on trigger
module_name: nshot_pulse
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
trigger:
direction: i... | `timescale 1ns/1ps
module tb_nshot_pulse;
reg clk, rst, trigger;
wire pulse_out, active;
nshot_pulse uut(.clk(clk), .rst(rst), .trigger(trigger), .pulse_out(pulse_out), .active(active));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
initial ... |
228_hysteresis_comp | bundles/L2_sequential/228_hysteresis_comp | 8-bit Hysteresis Comparator | L2_sequential | L2 | 228 | # Problem 228: 8-bit Hysteresis Comparator
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design an 8-bit comparator with hysteresis. The output goes high when the input crosses above the high threshold and goes low when it crosses below the low threshold. Between the two thresholds, t... | problem_id: '228'
title: 8-bit Hysteresis Comparator
level: 2
category: sequential_logic
description: 8-bit comparator with hysteresis using configurable high and low thresholds
module_name: hysteresis_comp
ports:
clk:
direction: input
width: '1'
rst:
direction: input
width: '1'
data_in:
direc... | `timescale 1ns/1ps
module tb_hysteresis_comp;
reg clk, rst;
reg [7:0] data_in, high_thresh, low_thresh;
wire output_level;
hysteresis_comp uut(.clk(clk), .rst(rst), .data_in(data_in),
.high_thresh(high_thresh), .low_thresh(low_thresh),
.output_level(o... |
229_pipeline_reg_2stage | bundles/L2_sequential/229_pipeline_reg_2stage | Pipeline Register (2-stage) | L2_sequential | L2 | 229 | # Problem 229: Pipeline Register (2-stage)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a two-stage pipeline register. Data and a valid signal take exactly 2 clock cycles to propagate from input to output. Stage 1 latches data_in and valid_in on each rising clock edge. Stage 2... | problem_id: '229'
title: Pipeline Register (2-stage)
level: 2
category: sequential_logic
description: Two-stage pipeline register that propagates 8-bit data and valid signal with 2-cycle latency
module_name: pipeline_reg_2stage
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
d... | `timescale 1ns/1ps
module tb_pipeline_reg_2stage;
reg clk, rst;
reg [7:0] data_in;
reg valid_in;
wire [7:0] data_out;
wire valid_out;
pipeline_reg_2stage uut(.clk(clk), .rst(rst), .data_in(data_in),
.valid_in(valid_in), .data_out(data_out),
... |
230_sync_fifo_4x8 | bundles/L2_sequential/230_sync_fifo_4x8 | Synchronous FIFO (4-deep, 8-bit) | L2_sequential | L2 | 230 | # Problem 230: Synchronous FIFO (4-deep, 8-bit)
**Level**: 2 (Sequential Logic)
**Category**: memory
## Description
Design a synchronous FIFO (First-In First-Out) buffer with 4 entries, each 8 bits wide. The FIFO supports simultaneous read and write operations, and provides full, empty, and count status signals.
##... | problem_id: '230'
title: Synchronous FIFO (4-deep, 8-bit)
level: 2
category: memory
description: 4-entry synchronous FIFO with 8-bit data width, full/empty flags, and entry count
module_name: sync_fifo_4x8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
wr_en:
direction: i... | `timescale 1ns/1ps
module tb_sync_fifo_4x8;
reg clk, rst, wr_en, rd_en;
reg [7:0] data_in;
wire [7:0] data_out;
wire full, empty;
wire [2:0] count;
sync_fifo_4x8 uut(.clk(clk), .rst(rst), .wr_en(wr_en), .rd_en(rd_en),
.data_in(data_in), .data_out(data_out),
... |
231_synchronizer_2ff | bundles/L2_sequential/231_synchronizer_2ff | Two-Process Synchronizer (2-FF) | L2_sequential | L2 | 231 | # Problem 231: Two-Process Synchronizer (2-FF)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a classic 2-flip-flop synchronizer used for clock domain crossing. An asynchronous single-bit input is sampled through two cascaded flip-flops clocked by the destination domain clock. T... | problem_id: '231'
title: Two-Process Synchronizer (2-FF)
level: 2
category: sequential_logic
description: Classic 2-flip-flop synchronizer for clock domain crossing of a single-bit asynchronous input
module_name: synchronizer_2ff
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
... | `timescale 1ns/1ps
module tb_synchronizer_2ff;
reg clk, rst;
reg async_in;
wire sync_out;
synchronizer_2ff uut(.clk(clk), .rst(rst), .async_in(async_in),
.sync_out(sync_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count ... |
232_majority_filter_3 | bundles/L2_sequential/232_majority_filter_3 | Majority Vote Filter (3-sample) | L2_sequential | L2 | 232 | # Problem 232: Majority Vote Filter (3-sample)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a majority vote filter that samples a single-bit input and outputs the majority value of the last 3 samples. This is useful for filtering glitches on noisy digital signals. If 2 or more... | problem_id: '232'
title: Majority Vote Filter (3-sample)
level: 2
category: sequential_logic
description: Glitch filter that outputs the majority vote of the last 3 sampled input values
module_name: majority_filter_3
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data_in:
... | `timescale 1ns/1ps
module tb_majority_filter_3;
reg clk, rst;
reg data_in;
wire data_out;
majority_filter_3 uut(.clk(clk), .rst(rst), .data_in(data_in),
.data_out(data_out));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count ... |
233_traffic_light_simple | bundles/L2_sequential/233_traffic_light_simple | Traffic Light Controller (Simple) | L2_sequential | L2 | 233 | # Problem 233: Traffic Light Controller (Simple)
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a simple traffic light controller implemented as a finite state machine. The light cycles through three states: GREEN for 8 clock cycles, YELLOW for 3 clock cycles, and RED for 10 clock cycles, th... | problem_id: '233'
title: Traffic Light Controller (Simple)
level: 2
category: fsm
description: Simple FSM traffic light cycling through GREEN (8 cycles), YELLOW (3 cycles), RED (10 cycles)
module_name: traffic_light_simple
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
red:
... | `timescale 1ns/1ps
module tb_traffic_light_simple;
reg clk, rst;
wire red, yellow, green;
traffic_light_simple uut(.clk(clk), .rst(rst), .red(red),
.yellow(yellow), .green(green));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_c... |
234_fibonacci_counter | bundles/L2_sequential/234_fibonacci_counter | Fibonacci Sequence Counter | L2_sequential | L2 | 234 | # Problem 234: Fibonacci Sequence Counter
**Level**: 2 (Sequential Logic)
**Category**: arithmetic_sequential
## Description
Design a sequential circuit that generates the Fibonacci sequence: 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, ... The circuit outputs the current Fibonacci number and advances to the next... | problem_id: '234'
title: Fibonacci Sequence Counter
level: 2
category: arithmetic_sequential
description: Sequential circuit that generates Fibonacci numbers (1,1,2,3,5,8,...) with overflow detection
module_name: fibonacci_counter
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
... | `timescale 1ns/1ps
module tb_fibonacci_counter;
reg clk, rst, enable;
wire [7:0] fib_val;
wire overflow;
fibonacci_counter uut(.clk(clk), .rst(rst), .enable(enable),
.fib_val(fib_val), .overflow(overflow));
initial clk = 0;
always #5 clk = ~clk;
integer pass_co... |
235_mealy_1001 | bundles/L2_sequential/235_mealy_1001 | Mealy FSM Sequence Detector 1001 | L2_sequential | L2 | 235 | # Problem 235: Mealy FSM Sequence Detector "1001"
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a Mealy FSM that detects the bit sequence "1001" on a serial input. The output `detected` should be asserted high for one clock cycle when the sequence is detected. Overlapping detection is allow... | problem_id: '235'
title: Mealy FSM Sequence Detector 1001
level: 2
category: fsm
description: Mealy FSM that detects the bit sequence 1001 with overlapping detection allowed
module_name: mealy_1001
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data_in:
direction: input
... | `timescale 1ns/1ps
module tb_mealy_1001;
reg clk, rst, data_in;
wire detected;
mealy_1001 uut(.clk(clk), .rst(rst), .data_in(data_in), .detected(detected));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
task check;
input exp_detected... |
236_vending_fsm | bundles/L2_sequential/236_vending_fsm | Moore FSM Vending Machine (Simple) | L2_sequential | L2 | 236 | # Problem 236: Moore FSM Vending Machine (Simple)
**Level**: 2 (Sequential Logic)
**Category**: fsm
## Description
Design a Moore FSM vending machine. The machine accepts 5-cent (nickel) and 10-cent (dime) coins. An item costs 15 cents. When the total inserted reaches or exceeds 15 cents, `dispense` goes high for on... | problem_id: '236'
title: Moore FSM Vending Machine (Simple)
level: 2
category: fsm
description: Moore FSM vending machine that accepts nickels and dimes, dispenses item at 15 cents with change
module_name: vending_fsm
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
coin_5:
... | `timescale 1ns/1ps
module tb_vending_fsm;
reg clk, rst, coin_5, coin_10;
wire dispense, change;
vending_fsm uut(.clk(clk), .rst(rst), .coin_5(coin_5), .coin_10(coin_10),
.dispense(dispense), .change(change));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0... |
237_lfsr16_maxlen | bundles/L2_sequential/237_lfsr16_maxlen | 16-bit Linear Feedback Shift Register | L2_sequential | L2 | 237 | # Problem 237: 16-bit Linear Feedback Shift Register
**Level**: 2 (Sequential Logic)
**Category**: shift_registers
## Description
Design a 16-bit Linear Feedback Shift Register (LFSR) with taps at bit positions 15, 14, 12, and 3 (XOR feedback). The LFSR generates a maximum-length pseudo-random sequence of 2^16 - 1 =... | problem_id: '237'
title: 16-bit Linear Feedback Shift Register
level: 2
category: shift_registers
description: 16-bit LFSR with taps at bits 15, 14, 12, 3 for maximum-length sequence
module_name: lfsr16_maxlen
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
q:
direction: o... | `timescale 1ns/1ps
module tb_lfsr16_maxlen;
reg clk, rst;
wire [15:0] q;
lfsr16_maxlen uut(.clk(clk), .rst(rst), .q(q));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
task check;
input [15:0] exp_q;
input [255:0] msg;
... |
238_crc8_serial | bundles/L2_sequential/238_crc8_serial | 8-bit CRC Calculator (CRC-8) | L2_sequential | L2 | 238 | # Problem 238: 8-bit CRC Calculator (CRC-8)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a serial CRC-8 calculator using the polynomial x^8 + x^2 + x + 1 (standard CRC-8, polynomial value 0x07). The circuit processes one bit per clock cycle and maintains a running CRC value.
... | problem_id: '238'
title: 8-bit CRC Calculator (CRC-8)
level: 2
category: sequential_logic
description: Serial CRC-8 calculator with polynomial x^8+x^2+x+1 (0x07) and configurable initialization
module_name: crc8_serial
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
data_in:
... | `timescale 1ns/1ps
module tb_crc8_serial;
reg clk, rst, data_in, data_valid, init;
wire [7:0] crc;
crc8_serial uut(.clk(clk), .rst(rst), .data_in(data_in),
.data_valid(data_valid), .init(init), .crc(crc));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
... |
239_phase_accum_8 | bundles/L2_sequential/239_phase_accum_8 | Phase Accumulator (8-bit) | L2_sequential | L2 | 239 | # Problem 239: Phase Accumulator (8-bit)
**Level**: 2 (Sequential Logic)
**Category**: arithmetic_sequential
## Description
Design an 8-bit phase accumulator, which is the core component of a Direct Digital Synthesizer (DDS) or Numerically Controlled Oscillator (NCO). On each clock cycle, the accumulator adds a prog... | problem_id: '239'
title: Phase Accumulator (8-bit)
level: 2
category: arithmetic_sequential
description: 8-bit phase accumulator (core of DDS/NCO) that adds a frequency word each clock cycle
module_name: phase_accum_8
ports:
clk:
direction: input
width: 1
rst:
direction: input
width: 1
freq_word:
... | `timescale 1ns/1ps
module tb_phase_accum_8;
reg clk, rst;
reg [7:0] freq_word;
wire [7:0] phase;
phase_accum_8 uut(.clk(clk), .rst(rst), .freq_word(freq_word), .phase(phase));
initial clk = 0;
always #5 clk = ~clk;
integer pass_count = 0;
integer fail_count = 0;
task check;
... |
240_glitch_free_clk_mux | bundles/L2_sequential/240_glitch_free_clk_mux | Glitch-Free Clock Mux (2-input) | L2_sequential | L2 | 240 | # Problem 240: Glitch-Free Clock Mux (2-input)
**Level**: 2 (Sequential Logic)
**Category**: sequential_logic
## Description
Design a glitch-free 2-input clock multiplexer. The classic technique synchronizes the select signal to each clock domain's falling edge and uses AND-OR gating to prevent glitches during switc... | problem_id: '240'
title: Glitch-Free Clock Mux (2-input)
level: 2
category: sequential_logic
description: Glitch-free 2-input clock multiplexer using synchronized select with AND-OR gating
module_name: glitch_free_clk_mux
ports:
clk0:
direction: input
width: 1
clk1:
direction: input
width: 1
rst:
... | `timescale 1ns/1ps
module tb_glitch_free_clk_mux;
reg clk0, clk1, rst, sel;
wire clk_out;
glitch_free_clk_mux uut(.clk0(clk0), .clk1(clk1), .rst(rst),
.sel(sel), .clk_out(clk_out));
// clk0: period 10ns (same as standard)
initial clk0 = 0;
always #5 clk0 = ~clk0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.