From 796dd9e640efb580226052bdce375fba886e080c Mon Sep 17 00:00:00 2001 From: Elie Deletang Date: Sun, 29 Nov 2026 10:34:26 +0100 Subject: [PATCH] add seq_detector_1011 --- .vscode/settings.json | 20 ++ build/counter_4b.vcd | 78 +++---- build/seq_detector_1011.vcd | 149 ++++++++++++++ build/simu_counter_4b | 105 +++++----- build/simu_seq_detector_1011 | 236 ++++++++++++++++++++++ counter_4b/tb_counter_4b.sv | 2 +- seq_detector_1011/seq_detecotr_1011.json | 81 ++++++++ seq_detector_1011/seq_detecotr_1011.vcd | 149 ++++++++++++++ seq_detector_1011/seq_detector_1011.sv | 45 +++++ seq_detector_1011/tb_seq_detector_1011.sv | 57 ++++++ 10 files changed, 829 insertions(+), 93 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 build/seq_detector_1011.vcd create mode 100644 build/simu_seq_detector_1011 create mode 100644 seq_detector_1011/seq_detecotr_1011.json create mode 100644 seq_detector_1011/seq_detecotr_1011.vcd create mode 100644 seq_detector_1011/seq_detector_1011.sv create mode 100644 seq_detector_1011/tb_seq_detector_1011.sv diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..2a32a95 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,20 @@ +{ + // Désactive les suggestions sur tout le dossier du projet + "editor.quickSuggestions": { + "other": "off", + "comments": "off", + "strings": "off" + }, + "editor.suggestOnTriggerCharacters": false, + "editor.inlineSuggest.enabled": false, + + // OU uniquement pour un langage spécifique (ex: SystemVerilog, C, Markdown) : + "[systemverilog]": { + "editor.quickSuggestions": { + "other": "off", + "comments": "off", + "strings": "off" + }, + "editor.inlineSuggest.enabled": false + } +} \ No newline at end of file diff --git a/build/counter_4b.vcd b/build/counter_4b.vcd index 6667b4c..4275f11 100644 --- a/build/counter_4b.vcd +++ b/build/counter_4b.vcd @@ -1,5 +1,5 @@ $date - Wed Nov 25 12:07:08 2026 + Thu Nov 26 23:03:41 2026 $end $version Icarus Verilog @@ -32,11 +32,11 @@ $end #0 $dumpvars bx ) -b11 ( +b100 ( 1' 0& 0% -b11 $ +b100 $ 0# bx " x! @@ -60,8 +60,8 @@ b0 ) #30000 0# #35000 -b11 " -b11 ) +b100 " +b100 ) 1# #40000 0# @@ -71,98 +71,98 @@ b11 ) #50000 0# #55000 -b100 " -b100 ) +b101 " +b101 ) 1# #60000 0# #65000 -b101 " -b101 ) +b110 " +b110 ) 1# #70000 0# #75000 -b110 " -b110 ) +b111 " +b111 ) 1# #80000 0# #85000 -b111 " -b111 ) +b1000 " +b1000 ) 1# #90000 0# #95000 -b1000 " -b1000 ) +b1001 " +b1001 ) 1# #100000 0# #105000 -b1001 " -b1001 ) +b1010 " +b1010 ) 1# #110000 0# #115000 -b1010 " -b1010 ) +b1011 " +b1011 ) 1# #120000 0# #125000 -b1011 " -b1011 ) +b1100 " +b1100 ) 1# #130000 0# #135000 -b1100 " -b1100 ) +b1101 " +b1101 ) 1# #140000 0# #145000 -b1101 " -b1101 ) +b1110 " +b1110 ) 1# #150000 0# #155000 -b1110 " -b1110 ) -1# -#160000 -0# -#165000 1! b1111 " b1111 ) 1# -#170000 +#160000 0# -#175000 +#165000 0! b0 " b0 ) 1# +#170000 +0# +#175000 +b1 " +b1 ) +1# #180000 0# #185000 -b1 " -b1 ) +b10 " +b10 ) 1# #190000 0# #195000 -b10 " -b10 ) +b11 " +b11 ) 1# #200000 0# #205000 -b11 " -b11 ) +b100 " +b100 ) 1# diff --git a/build/seq_detector_1011.vcd b/build/seq_detector_1011.vcd new file mode 100644 index 0000000..fb06253 --- /dev/null +++ b/build/seq_detector_1011.vcd @@ -0,0 +1,149 @@ +$date + Sun Nov 29 10:29:28 2026 +$end +$version + Icarus Verilog +$end +$timescale + 1ps +$end +$scope module tb_seq_detector_1011 $end +$var wire 1 ! detected $end +$var reg 1 " clk $end +$var reg 1 # in $end +$var reg 1 $ rst $end +$scope module dut $end +$var wire 1 " clk $end +$var wire 1 # in $end +$var wire 1 $ rst $end +$var wire 1 ! detected $end +$var reg 3 % current_state [2:0] $end +$var reg 3 & next_state [2:0] $end +$upscope $end +$upscope $end +$enddefinitions $end +$comment Show the parameter values. $end +$dumpall +$end +#0 +$dumpvars +b0 & +bx % +1$ +0# +0" +x! +$end +#5000 +0! +b0 % +1" +#10000 +0" +#15000 +1" +#20000 +0" +#25000 +b1 & +1# +0$ +1" +#30000 +0" +#35000 +b10 & +0# +b1 % +1" +#40000 +0" +#45000 +b11 & +b10 % +1# +1" +#50000 +0" +#55000 +b100 & +b11 % +1" +#60000 +0" +#65000 +b10 & +1! +b100 % +0# +1" +#70000 +0" +#75000 +b11 & +1# +0! +b10 % +1" +#80000 +0" +#85000 +b100 & +b11 % +1" +#90000 +0" +#95000 +b10 & +0# +1! +b100 % +1" +#100000 +0" +#105000 +b11 & +0! +b10 % +1# +1" +#110000 +0" +#115000 +b10 & +0# +b11 % +1" +#120000 +0" +#125000 +b11 & +b10 % +1# +1" +#130000 +0" +#135000 +b100 & +b11 % +1" +#140000 +0" +#145000 +b10 & +1! +b100 % +0# +1" +#150000 +0" +#155000 +b0 & +0! +b10 % +1" +#160000 +0" +#165000 +b0 % +1" diff --git a/build/simu_counter_4b b/build/simu_counter_4b index c95c85d..d0f2b8c 100644 --- a/build/simu_counter_4b +++ b/build/simu_counter_4b @@ -1,5 +1,5 @@ #! /c/Source/iverilog-install/bin/vvp -:ivl_version "12.0 (devel)" "(s20150603-1539-g2693dd32b)"; +:ivl_version "14.0 (devel)"; :ivl_delay_selection "TYPICAL"; :vpi_time_precision - 12; :vpi_module "C:\iverilog\lib\ivl\system.vpi"; @@ -8,18 +8,18 @@ :vpi_module "C:\iverilog\lib\ivl\v2005_math.vpi"; :vpi_module "C:\iverilog\lib\ivl\va_math.vpi"; :vpi_module "C:\iverilog\lib\ivl\v2009.vpi"; -S_0000025ca043a570 .scope package, "$unit" "$unit" 2 1; +S_0000015A388B9110 .scope package, "$unit" "$unit" 2 1; .timescale 0 0; -S_0000025ca043b920 .scope module, "tb_counter_4b" "tb_counter_4b" 3 3; +S_0000015A388B94B0 .scope module, "tb_counter_4b" "tb_counter_4b" 3 3; .timescale -9 -12; -v0000025ca0861840_0 .var "clk", 0 0; -v0000025ca08618e0_0 .net "count", 3 0, v0000025ca043be80_0; 1 drivers -v0000025ca0861980_0 .var "data_in", 3 0; -v0000025ca0861a20_0 .var "en", 0 0; -v0000025ca0861ac0_0 .var "load", 0 0; -v0000025ca0861b60_0 .net "max_tick", 0 0, L_0000025ca0861ed0; 1 drivers -v0000025ca0861e30_0 .var "rst", 0 0; -S_0000025ca043d790 .scope module, "dut" "counter_4b" 3 14, 4 3 0, S_0000025ca043b920; +v0000015A388CECD0_0 .var "clk", 0 0; +v0000015A388CE410_0 .net "count", 3 0, v0000015A388CED70_0; 1 drivers +v0000015A388CE730_0 .var "data_in", 3 0; +v0000015A388CE370_0 .var "en", 0 0; +v0000015A388CEAF0_0 .var "load", 0 0; +v0000015A388CE5F0_0 .net "max_tick", 0 0, L_0000015A388CEB90; 1 drivers +v0000015A388CE7D0_0 .var "rst", 0 0; +S_0000015A388CB3C0 .scope module, "dut" "counter_4b" 3 14, 4 3 0, S_0000015A388B94B0; .timescale -9 -12; .port_info 0 /INPUT 1 "clk"; .port_info 1 /INPUT 1 "rst"; @@ -28,89 +28,88 @@ S_0000025ca043d790 .scope module, "dut" "counter_4b" 3 14, 4 3 0, S_0000025ca043 .port_info 4 /INPUT 4 "data_in"; .port_info 5 /OUTPUT 4 "count"; .port_info 6 /OUTPUT 1 "max_tick"; -L_0000025ca0862c18 .functor BUFT 1, C4<1111>, C4<0>, C4<0>, C4<0>; -v0000025ca07e2f20_0 .net/2u *"_ivl_0", 3 0, L_0000025ca0862c18; 1 drivers -v0000025ca07e2c30_0 .net "clk", 0 0, v0000025ca0861840_0; 1 drivers -v0000025ca043be80_0 .var "count", 3 0; -v0000025ca043bab0_0 .net "data_in", 3 0, v0000025ca0861980_0; 1 drivers -v0000025ca043d920_0 .net "en", 0 0, v0000025ca0861a20_0; 1 drivers -v0000025ca043d9c0_0 .net "load", 0 0, v0000025ca0861ac0_0; 1 drivers -v0000025ca043da60_0 .net "max_tick", 0 0, L_0000025ca0861ed0; alias, 1 drivers -v0000025ca043db00_0 .net "rst", 0 0, v0000025ca0861e30_0; 1 drivers -E_0000025ca081a8f0 .event posedge, v0000025ca07e2c30_0; -L_0000025ca0861ed0 .cmp/eq 4, v0000025ca043be80_0, L_0000025ca0862c18; - .scope S_0000025ca043d790; +L_0000015A38A10088 .functor BUFT 1, C4<1111>, C4<0>, C4<0>, C4<0>; +v0000015A388CE050_0 .net/2u *"_ivl_0", 3 0, L_0000015A38A10088; 1 drivers +v0000015A388CE910_0 .net "clk", 0 0, v0000015A388CECD0_0; 1 drivers +v0000015A388CED70_0 .var "count", 3 0; +v0000015A388CE230_0 .net "data_in", 3 0, v0000015A388CE730_0; 1 drivers +v0000015A388CE4B0_0 .net "en", 0 0, v0000015A388CE370_0; 1 drivers +v0000015A388CEC30_0 .net "load", 0 0, v0000015A388CEAF0_0; 1 drivers +v0000015A388CE550_0 .net "max_tick", 0 0, L_0000015A388CEB90; alias, 1 drivers +v0000015A388CE2D0_0 .net "rst", 0 0, v0000015A388CE7D0_0; 1 drivers +E_0000015A388B4E30 .event posedge, v0000015A388CE910_0; +L_0000015A388CEB90 .cmp/eq 4, v0000015A388CED70_0, L_0000015A38A10088; + .scope S_0000015A388CB3C0; T_0 ; - %wait E_0000025ca081a8f0; - %load/vec4 v0000025ca043db00_0; + %wait E_0000015A388B4E30; + %load/vec4 v0000015A388CE2D0_0; %flag_set/vec4 8; %jmp/0xz T_0.0, 8; %pushi/vec4 0, 0, 4; - %assign/vec4 v0000025ca043be80_0, 0; + %assign/vec4 v0000015A388CED70_0, 0; %jmp T_0.1; T_0.0 ; - %load/vec4 v0000025ca043d9c0_0; + %load/vec4 v0000015A388CEC30_0; %flag_set/vec4 8; %jmp/0xz T_0.2, 8; - %load/vec4 v0000025ca043bab0_0; - %assign/vec4 v0000025ca043be80_0, 0; + %load/vec4 v0000015A388CE230_0; + %assign/vec4 v0000015A388CED70_0, 0; %jmp T_0.3; T_0.2 ; - %load/vec4 v0000025ca043d920_0; + %load/vec4 v0000015A388CE4B0_0; %flag_set/vec4 8; %jmp/0xz T_0.4, 8; - %load/vec4 v0000025ca043be80_0; + %load/vec4 v0000015A388CED70_0; %addi 1, 0, 4; - %assign/vec4 v0000025ca043be80_0, 0; + %assign/vec4 v0000015A388CED70_0, 0; T_0.4 ; T_0.3 ; T_0.1 ; %jmp T_0; .thread T_0; - .scope S_0000025ca043b920; + .scope S_0000015A388B94B0; T_1 ; %pushi/vec4 0, 0, 1; - %store/vec4 v0000025ca0861840_0, 0, 1; + %store/vec4 v0000015A388CECD0_0, 0, 1; T_1.0 ; %delay 5000, 0; - %load/vec4 v0000025ca0861840_0; + %load/vec4 v0000015A388CECD0_0; %inv; - %store/vec4 v0000025ca0861840_0, 0, 1; + %store/vec4 v0000015A388CECD0_0, 0, 1; %jmp T_1.0; +T_1.1 ; %end; .thread T_1; - .scope S_0000025ca043b920; + .scope S_0000015A388B94B0; T_2 ; %vpi_call/w 3 31 "$dumpfile", "counter_4b.vcd" {0 0 0}; - %vpi_call/w 3 32 "$dumpvars", 32'sb00000000000000000000000000000000, S_0000025ca043b920 {0 0 0}; + %vpi_call/w 3 32 "$dumpvars", 32'sb00000000000000000000000000000000, S_0000015A388B94B0 {0 0 0}; %pushi/vec4 1, 0, 1; - %store/vec4 v0000025ca0861e30_0, 0, 1; + %store/vec4 v0000015A388CE7D0_0, 0, 1; %pushi/vec4 0, 0, 1; - %store/vec4 v0000025ca0861a20_0, 0, 1; + %store/vec4 v0000015A388CE370_0, 0, 1; %pushi/vec4 0, 0, 1; - %store/vec4 v0000025ca0861ac0_0, 0, 1; - %pushi/vec4 3, 0, 4; - %store/vec4 v0000025ca0861980_0, 0, 4; + %store/vec4 v0000015A388CEAF0_0, 0, 1; + %pushi/vec4 4, 0, 4; + %store/vec4 v0000015A388CE730_0, 0, 4; %delay 20000, 0; - %wait E_0000025ca081a8f0; + %wait E_0000015A388B4E30; %pushi/vec4 0, 0, 1; - %assign/vec4 v0000025ca0861e30_0, 0; + %assign/vec4 v0000015A388CE7D0_0, 0; %pushi/vec4 1, 0, 1; - %assign/vec4 v0000025ca0861a20_0, 0; + %assign/vec4 v0000015A388CE370_0, 0; %pushi/vec4 1, 0, 1; - %assign/vec4 v0000025ca0861ac0_0, 0; + %assign/vec4 v0000015A388CEAF0_0, 0; %delay 20000, 0; %pushi/vec4 0, 0, 1; - %assign/vec4 v0000025ca0861ac0_0, 0; + %assign/vec4 v0000015A388CEAF0_0, 0; %pushi/vec4 15, 0, 32; T_2.0 %dup/vec4; - %pushi/vec4 0, 0, 32; - %cmp/s; + %cmpi/s 0, 0, 32; %jmp/1xz T_2.1, 5; %jmp/1 T_2.1, 4; - %pushi/vec4 1, 0, 32; - %sub; - %wait E_0000025ca081a8f0; + %subi 1, 0, 32; + %wait E_0000015A388B4E30; %jmp T_2.0; T_2.1 ; %pop/vec4 1; diff --git a/build/simu_seq_detector_1011 b/build/simu_seq_detector_1011 new file mode 100644 index 0000000..0755515 --- /dev/null +++ b/build/simu_seq_detector_1011 @@ -0,0 +1,236 @@ +#! /c/Source/iverilog-install/bin/vvp +:ivl_version "12.0 (devel)" "(s20150603-1539-g2693dd32b)"; +:ivl_delay_selection "TYPICAL"; +:vpi_time_precision - 12; +:vpi_module "C:\iverilog\lib\ivl\system.vpi"; +:vpi_module "C:\iverilog\lib\ivl\vhdl_sys.vpi"; +:vpi_module "C:\iverilog\lib\ivl\vhdl_textio.vpi"; +:vpi_module "C:\iverilog\lib\ivl\v2005_math.vpi"; +:vpi_module "C:\iverilog\lib\ivl\va_math.vpi"; +:vpi_module "C:\iverilog\lib\ivl\v2009.vpi"; +S_000001f5da0bb6f0 .scope package, "$unit" "$unit" 2 1; + .timescale 0 0; +S_000001f5da114bb0 .scope module, "tb_seq_detector_1011" "tb_seq_detector_1011" 3 4; + .timescale -9 -12; +v000001f5da114870_0 .var "clk", 0 0; +v000001f5da114550_0 .net "detected", 0 0, L_000001f5da114230; 1 drivers +v000001f5da114190_0 .var "in", 0 0; +v000001f5da114af0_0 .var "rst", 0 0; +S_000001f5da107720 .scope module, "dut" "seq_detector_1011" 3 11, 4 1 0, S_000001f5da114bb0; + .timescale 0 0; + .port_info 0 /INPUT 1 "clk"; + .port_info 1 /INPUT 1 "rst"; + .port_info 2 /INPUT 1 "in"; + .port_info 3 /OUTPUT 1 "detected"; +enum000001f5da10d830 .enum4 (3) + "IDLE" 3'b000, + "S1" 3'b001, + "S10" 3'b010, + "S101" 3'b011, + "S1011" 3'b100 + ; +L_000001f5da167248 .functor BUFT 1, C4<100>, C4<0>, C4<0>, C4<0>; +v000001f5da1145f0_0 .net/2u *"_ivl_0", 2 0, L_000001f5da167248; 1 drivers +v000001f5da114a50_0 .net "clk", 0 0, v000001f5da114870_0; 1 drivers +v000001f5da114730_0 .var "current_state", 2 0; +v000001f5da1144b0_0 .net "detected", 0 0, L_000001f5da114230; alias, 1 drivers +v000001f5da113f10_0 .net "in", 0 0, v000001f5da114190_0; 1 drivers +v000001f5da1140f0_0 .var "next_state", 2 0; +v000001f5da1149b0_0 .net "rst", 0 0, v000001f5da114af0_0; 1 drivers +E_000001f5da10ea80 .event anyedge, v000001f5da114730_0, v000001f5da113f10_0; +E_000001f5da10e440 .event posedge, v000001f5da114a50_0; +L_000001f5da114230 .cmp/eq 3, v000001f5da114730_0, L_000001f5da167248; + .scope S_000001f5da107720; +T_0 ; + %wait E_000001f5da10e440; + %load/vec4 v000001f5da1149b0_0; + %flag_set/vec4 8; + %jmp/0xz T_0.0, 8; + %pushi/vec4 0, 0, 3; + %assign/vec4 v000001f5da114730_0, 0; + %jmp T_0.1; +T_0.0 ; + %load/vec4 v000001f5da1140f0_0; + %assign/vec4 v000001f5da114730_0, 0; +T_0.1 ; + %jmp T_0; + .thread T_0; + .scope S_000001f5da107720; +T_1 ; +Ewait_0 .event/or E_000001f5da10ea80, E_0x0; + %wait Ewait_0; + %pushi/vec4 0, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; + %load/vec4 v000001f5da114730_0; + %dup/vec4; + %pushi/vec4 0, 0, 3; + %cmp/u; + %jmp/1 T_1.0, 6; + %dup/vec4; + %pushi/vec4 1, 0, 3; + %cmp/u; + %jmp/1 T_1.1, 6; + %dup/vec4; + %pushi/vec4 2, 0, 3; + %cmp/u; + %jmp/1 T_1.2, 6; + %dup/vec4; + %pushi/vec4 3, 0, 3; + %cmp/u; + %jmp/1 T_1.3, 6; + %dup/vec4; + %pushi/vec4 4, 0, 3; + %cmp/u; + %jmp/1 T_1.4, 6; + %pushi/vec4 0, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; + %jmp T_1.6; +T_1.0 ; + %load/vec4 v000001f5da113f10_0; + %flag_set/vec4 8; + %jmp/0xz T_1.7, 8; + %pushi/vec4 1, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; + %jmp T_1.8; +T_1.7 ; + %pushi/vec4 0, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; +T_1.8 ; + %jmp T_1.6; +T_1.1 ; + %load/vec4 v000001f5da113f10_0; + %flag_set/vec4 8; + %jmp/0xz T_1.9, 8; + %pushi/vec4 1, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; + %jmp T_1.10; +T_1.9 ; + %pushi/vec4 2, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; +T_1.10 ; + %jmp T_1.6; +T_1.2 ; + %load/vec4 v000001f5da113f10_0; + %flag_set/vec4 8; + %jmp/0xz T_1.11, 8; + %pushi/vec4 3, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; + %jmp T_1.12; +T_1.11 ; + %pushi/vec4 0, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; +T_1.12 ; + %jmp T_1.6; +T_1.3 ; + %load/vec4 v000001f5da113f10_0; + %flag_set/vec4 8; + %jmp/0xz T_1.13, 8; + %pushi/vec4 4, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; + %jmp T_1.14; +T_1.13 ; + %pushi/vec4 2, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; +T_1.14 ; + %jmp T_1.6; +T_1.4 ; + %load/vec4 v000001f5da113f10_0; + %flag_set/vec4 8; + %jmp/0xz T_1.15, 8; + %pushi/vec4 1, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; + %jmp T_1.16; +T_1.15 ; + %pushi/vec4 2, 0, 3; + %store/vec4 v000001f5da1140f0_0, 0, 3; +T_1.16 ; + %jmp T_1.6; +T_1.6 ; + %pop/vec4 1; + %jmp T_1; + .thread T_1, $push; + .scope S_000001f5da114bb0; +T_2 ; + %pushi/vec4 0, 0, 1; + %store/vec4 v000001f5da114870_0, 0, 1; +T_2.0 ; + %delay 5000, 0; + %load/vec4 v000001f5da114870_0; + %inv; + %store/vec4 v000001f5da114870_0, 0, 1; + %jmp T_2.0; + %end; + .thread T_2; + .scope S_000001f5da114bb0; +T_3 ; + %vpi_call/w 3 24 "$dumpfile", "seq_detector_1011.vcd" {0 0 0}; + %vpi_call/w 3 25 "$dumpvars", 32'sb00000000000000000000000000000000, S_000001f5da114bb0 {0 0 0}; + %pushi/vec4 1, 0, 1; + %store/vec4 v000001f5da114af0_0, 0, 1; + %pushi/vec4 0, 0, 1; + %store/vec4 v000001f5da114190_0, 0, 1; + %delay 20000, 0; + %wait E_000001f5da10e440; + %pushi/vec4 0, 0, 1; + %assign/vec4 v000001f5da114af0_0, 0; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 0, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 0, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 0, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 0, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 1, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %wait E_000001f5da10e440; + %pushi/vec4 0, 0, 1; + %assign/vec4 v000001f5da114190_0, 0; + %pushi/vec4 2, 0, 32; +T_3.0 %dup/vec4; + %pushi/vec4 0, 0, 32; + %cmp/s; + %jmp/1xz T_3.1, 5; + %jmp/1 T_3.1, 4; + %pushi/vec4 1, 0, 32; + %sub; + %wait E_000001f5da10e440; + %jmp T_3.0; +T_3.1 ; + %pop/vec4 1; + %vpi_call/w 3 53 "$display", "Fin de la simulation." {0 0 0}; + %vpi_call/w 3 54 "$finish" {0 0 0}; + %end; + .thread T_3; +# The file index is used to find the file name in the following table. +:file_names 5; + "N/A"; + ""; + "-"; + "seq_detector_1011/tb_seq_detector_1011.sv"; + "seq_detector_1011/seq_detector_1011.sv"; diff --git a/counter_4b/tb_counter_4b.sv b/counter_4b/tb_counter_4b.sv index 2fb292e..d13d724 100644 --- a/counter_4b/tb_counter_4b.sv +++ b/counter_4b/tb_counter_4b.sv @@ -34,7 +34,7 @@ module tb_counter_4b; rst = 1'b1; en = 1'b0; load = 1'b0; - data_in = 4'b0011; + data_in = 4'b0100; #20; // Maintien du reset pendant 2 coups d'horloge diff --git a/seq_detector_1011/seq_detecotr_1011.json b/seq_detector_1011/seq_detecotr_1011.json new file mode 100644 index 0000000..5a552fd --- /dev/null +++ b/seq_detector_1011/seq_detecotr_1011.json @@ -0,0 +1,81 @@ +{ + "extensionVersion": "1.6.1", + "fileName": "c:\\Users\\elied\\Nextcloud\\garage\\Learn_FPGA\\seq_detector_1011\\seq_detecotr_1011.vcd", + "markerTime": null, + "altMarkerTime": null, + "displayTimeUnit": "ps", + "selectedSignal": { + "name": "tb_seq_detector_1011.clk", + "msb": -1, + "lsb": -1 + }, + "zoomRatio": 0.005058356714266344, + "scrollLeft": 0, + "defaultPixelTime": 100000, + "displayedSignals": [ + { + "dataType": "netlist-variable", + "netlistId": 0, + "name": "detected", + "scopePath": [ + "tb_seq_detector_1011" + ], + "numberFormat": "binary", + "colorIndex": 0, + "rowHeight": 1, + "verticalScale": 1, + "nameType": "fullPath", + "customName": "detected", + "renderType": "binary", + "valueLinkEnable": false + }, + { + "dataType": "netlist-variable", + "netlistId": 2, + "name": "in", + "scopePath": [ + "tb_seq_detector_1011" + ], + "numberFormat": "binary", + "colorIndex": 0, + "rowHeight": 1, + "verticalScale": 1, + "nameType": "fullPath", + "customName": "in", + "renderType": "binary", + "valueLinkEnable": false + }, + { + "dataType": "netlist-variable", + "netlistId": 3, + "name": "rst", + "scopePath": [ + "tb_seq_detector_1011" + ], + "numberFormat": "binary", + "colorIndex": 0, + "rowHeight": 1, + "verticalScale": 1, + "nameType": "fullPath", + "customName": "rst", + "renderType": "binary", + "valueLinkEnable": false + }, + { + "dataType": "netlist-variable", + "netlistId": 1, + "name": "clk", + "scopePath": [ + "tb_seq_detector_1011" + ], + "numberFormat": "binary", + "colorIndex": 0, + "rowHeight": 1, + "verticalScale": 1, + "nameType": "fullPath", + "customName": "clk", + "renderType": "binary", + "valueLinkEnable": false + } + ] +} \ No newline at end of file diff --git a/seq_detector_1011/seq_detecotr_1011.vcd b/seq_detector_1011/seq_detecotr_1011.vcd new file mode 100644 index 0000000..3826e96 --- /dev/null +++ b/seq_detector_1011/seq_detecotr_1011.vcd @@ -0,0 +1,149 @@ +$date + Sun Nov 29 10:28:41 2026 +$end +$version + Icarus Verilog +$end +$timescale + 1ps +$end +$scope module tb_seq_detector_1011 $end +$var wire 1 ! detected $end +$var reg 1 " clk $end +$var reg 1 # in $end +$var reg 1 $ rst $end +$scope module dut $end +$var wire 1 " clk $end +$var wire 1 # in $end +$var wire 1 $ rst $end +$var wire 1 ! detected $end +$var reg 3 % current_state [2:0] $end +$var reg 3 & next_state [2:0] $end +$upscope $end +$upscope $end +$enddefinitions $end +$comment Show the parameter values. $end +$dumpall +$end +#0 +$dumpvars +b0 & +bx % +1$ +0# +0" +x! +$end +#5000 +0! +b0 % +1" +#10000 +0" +#15000 +1" +#20000 +0" +#25000 +b1 & +1# +0$ +1" +#30000 +0" +#35000 +b10 & +0# +b1 % +1" +#40000 +0" +#45000 +b11 & +b10 % +1# +1" +#50000 +0" +#55000 +b100 & +b11 % +1" +#60000 +0" +#65000 +b10 & +1! +b100 % +0# +1" +#70000 +0" +#75000 +b11 & +1# +0! +b10 % +1" +#80000 +0" +#85000 +b100 & +b11 % +1" +#90000 +0" +#95000 +b10 & +0# +1! +b100 % +1" +#100000 +0" +#105000 +b11 & +0! +b10 % +1# +1" +#110000 +0" +#115000 +b10 & +0# +b11 % +1" +#120000 +0" +#125000 +b11 & +b10 % +1# +1" +#130000 +0" +#135000 +b100 & +b11 % +1" +#140000 +0" +#145000 +b10 & +1! +b100 % +0# +1" +#150000 +0" +#155000 +b0 & +0! +b10 % +1" +#160000 +0" +#165000 +b0 % +1" diff --git a/seq_detector_1011/seq_detector_1011.sv b/seq_detector_1011/seq_detector_1011.sv new file mode 100644 index 0000000..f444070 --- /dev/null +++ b/seq_detector_1011/seq_detector_1011.sv @@ -0,0 +1,45 @@ +module seq_detector_1011 ( + input logic clk, + input logic rst, + input logic in, + output logic detected +); + + +typedef enum logic [2:0] +{ + IDLE, + S1, + S10, + S101, + S1011 +} state_t; + +state_t current_state, next_state; + +always_ff @(posedge clk) begin + if (rst) begin + current_state <= IDLE; + end else begin + current_state <= next_state; + end +end + +always_comb begin + next_state = IDLE; + case (current_state) + IDLE : if (in) next_state = S1; else next_state = IDLE; + S1 : if (in) next_state = S1; else next_state = S10; + S10 : if (in) next_state = S101; else next_state = IDLE; + S101 : if (in) next_state = S1011; else next_state = S10; + S1011 : if (in) next_state = S1; else next_state = S10; + default : next_state = IDLE; + endcase +end + + + + +assign detected = (current_state == S1011); + +endmodule \ No newline at end of file diff --git a/seq_detector_1011/tb_seq_detector_1011.sv b/seq_detector_1011/tb_seq_detector_1011.sv new file mode 100644 index 0000000..e5105d6 --- /dev/null +++ b/seq_detector_1011/tb_seq_detector_1011.sv @@ -0,0 +1,57 @@ + +`timescale 1ns / 1ps + +module tb_seq_detector_1011; + + logic clk; + logic rst; + logic in; + logic detected; + + seq_detector_1011 dut( + .clk(clk), + .rst(rst), + .in(in), + .detected(detected) + ); + + initial begin + clk = 1'b0; + forever #5 clk = ~clk; + end + + initial begin + $dumpfile("seq_detector_1011.vcd"); + $dumpvars(0, tb_seq_detector_1011); + + rst = 1'b1; + in = 1'b0; + // detected = 1'b0; inutile output + + #20; + + @(posedge clk); + + rst <= 1'b0; + + in <= 1'b1; @(posedge clk); // Bit 1 + in <= 1'b0; @(posedge clk); // Bit 0 + in <= 1'b1; @(posedge clk); // Bit 1 + in <= 1'b1; @(posedge clk); // Bit 1 -> détection #1 attendue au cycle suivant + in <= 1'b0; @(posedge clk); // Bit 0 + in <= 1'b1; @(posedge clk); // Bit 1 + in <= 1'b1; @(posedge clk); // Bit 1 -> détection #2 (chevauchement) + in <= 1'b0; @(posedge clk); // Bit 0 + in <= 1'b1; @(posedge clk); // Bit 1 + in <= 1'b0; @(posedge clk); // Bit 0 + in <= 1'b1; @(posedge clk); // Bit 1 + in <= 1'b1; @(posedge clk); // Bit 1 -> détection #3 (chevauchement 101011) + + in <= 1'b0; + repeat (2) @(posedge clk); // Laisse 2 cycles pour voir la dernière détection retomber + + $display("Fin de la simulation."); + $finish; + end; + +endmodule \ No newline at end of file