From 9a8789b42be6cdf41afe1db1d96a4e274a142ce7 Mon Sep 17 00:00:00 2001 From: gianmarcogirau Date: Tue, 17 Sep 2019 09:30:51 +0100 Subject: [PATCH] WH-16 - Adding Golay Decoder --- .../pof_protocol/1/sim/sim_golay_codec.do | 74 ++++ .../pof_protocol/1/sim/wave_golay_codec.do | 81 +++++ generic_ip/pof_protocol/1/src/golay_dec.vhd | 118 ++++++ .../pof_protocol/1/src/golay_dec_pkg.vhd | 286 +++++++++++++++ .../1/src/golay_dec_syndrome_gen.vhd | 76 ++++ .../1/src/test/binary-golay-model/com.sh | 2 - .../1/src/test/error_corr_parser.py | 32 ++ .../1/src/test/golay_codec_tb.vhd | 335 ++++++++++++++++++ generic_ip/pof_protocol/Readme.txt | 1 + 9 files changed, 1003 insertions(+), 2 deletions(-) create mode 100644 generic_ip/pof_protocol/1/sim/sim_golay_codec.do create mode 100644 generic_ip/pof_protocol/1/sim/wave_golay_codec.do create mode 100644 generic_ip/pof_protocol/1/src/golay_dec.vhd create mode 100644 generic_ip/pof_protocol/1/src/golay_dec_pkg.vhd create mode 100644 generic_ip/pof_protocol/1/src/golay_dec_syndrome_gen.vhd create mode 100644 generic_ip/pof_protocol/1/src/test/error_corr_parser.py create mode 100644 generic_ip/pof_protocol/1/src/test/golay_codec_tb.vhd create mode 100644 generic_ip/pof_protocol/Readme.txt diff --git a/generic_ip/pof_protocol/1/sim/sim_golay_codec.do b/generic_ip/pof_protocol/1/sim/sim_golay_codec.do new file mode 100644 index 0000000..d95e541 --- /dev/null +++ b/generic_ip/pof_protocol/1/sim/sim_golay_codec.do @@ -0,0 +1,74 @@ +# Simulation macro + +.main clear + +# Cleanup libraries +foreach lib [list work OSVVM] { + file delete -force -- $lib + vlib $lib +} + +set COMP_ONLY 0 + +set TB_PATH ./../src/test +set SRC_PATH ../src +set COMMON_PATH ../../../common/0/src +set OSVVM_PATH ../../../common/0/src/test/OSVVM + +set WORKLIB work + +vlib ./work +vmap work ./work + +if {$COMP_ONLY == 0} { +# Compile the constrained random related packages + vlib OSVVM + vcom -2008 -work OSVVM \ + $OSVVM_PATH/RandomBasePkg.vhd \ + $OSVVM_PATH/SortListPkg_int.vhd \ + $OSVVM_PATH/RandomPkg.vhd \ + $OSVVM_PATH/NamePkg.vhd \ + $OSVVM_PATH/MessagePkg.vhd \ + $OSVVM_PATH/CoveragePkg.vhd +} + +# compile the UUTs: +vcom -2008 -work $WORKLIB $SRC_PATH/golay_enc_syndrome_gen.vhd +vcom -2008 -work $WORKLIB $SRC_PATH/golay_enc.vhd +vcom -2008 -work $WORKLIB $SRC_PATH/golay_dec_syndrome_gen.vhd +vcom -2008 -work $WORKLIB $SRC_PATH/golay_dec_pkg.vhd +vcom -2008 -work $WORKLIB $SRC_PATH/golay_dec.vhd + + + +# Compile the testbench and the other components supporting the test +if {$COMP_ONLY == 0} { + # Test support packages + vcom -2008 -work $WORKLIB $COMMON_PATH/test/common_test_pkg.vhd + vcom -2008 -work $WORKLIB $COMMON_PATH/test/log_pkg.vhd + #vcom -2008 -work $WORKLIB $COMMON_PATH/test/avalon_verify_pkg.vhd + + # Testbench + vcom -2008 -work $WORKLIB $TB_PATH/golay_codec_tb.vhd + + vsim -t ps work.golay_codec_tb + + #add wave golay_codec_tb/* + #add wave golay_codec_tb/iENC/* + #add wave golay_codec_tb/iDEC/* + + # remove warnings from standard numeric/arithmetic packages (speed-up simulation) + set StdArithNoWarnings 1 + set NumericStdNoWarnings 1 + + do wave_golay_codec.do + + when -label end_of_simulation {test_completed == true} {echo "Simulation Completed"; stop ;} + run -all + + #run 100 us; +} + + + + diff --git a/generic_ip/pof_protocol/1/sim/wave_golay_codec.do b/generic_ip/pof_protocol/1/sim/wave_golay_codec.do new file mode 100644 index 0000000..70f68cf --- /dev/null +++ b/generic_ip/pof_protocol/1/sim/wave_golay_codec.do @@ -0,0 +1,81 @@ +onerror {resume} +quietly WaveActivateNextPane {} 0 +add wave -noupdate /golay_codec_tb/clk +add wave -noupdate /golay_codec_tb/init +add wave -noupdate -radix hexadecimal /golay_codec_tb/symbol +add wave -noupdate /golay_codec_tb/symbol_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/codeword +add wave -noupdate /golay_codec_tb/codeword_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/rx_codeword +add wave -noupdate /golay_codec_tb/rx_codeword_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/dec_symbol +add wave -noupdate /golay_codec_tb/dec_symbol_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/injected_error +add wave -noupdate /golay_codec_tb/dec_detected_error +add wave -noupdate /golay_codec_tb/dec_ready +add wave -noupdate /golay_codec_tb/symbol_cnt +add wave -noupdate /golay_codec_tb/error_cnt +add wave -noupdate /golay_codec_tb/test_completed +add wave -noupdate /golay_codec_tb/setup +add wave -noupdate /golay_codec_tb/running +add wave -noupdate /golay_codec_tb/passed +add wave -noupdate /golay_codec_tb/failed +add wave -noupdate /golay_codec_tb/error_flag +add wave -noupdate /golay_codec_tb/iENC/clk +add wave -noupdate /golay_codec_tb/iENC/init +add wave -noupdate -radix hexadecimal /golay_codec_tb/iENC/symbol +add wave -noupdate /golay_codec_tb/iENC/symbol_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/iENC/codeword +add wave -noupdate /golay_codec_tb/iENC/codeword_valid +add wave -noupdate /golay_codec_tb/iENC/syndrome_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/iENC/syndrome +add wave -noupdate /golay_codec_tb/iDEC/clk +add wave -noupdate /golay_codec_tb/iDEC/init +add wave -noupdate /golay_codec_tb/iDEC/dec_ready +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/codeword +add wave -noupdate /golay_codec_tb/iDEC/codeword_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/dec_symbol +add wave -noupdate /golay_codec_tb/iDEC/dec_symbol_valid +add wave -noupdate /golay_codec_tb/iDEC/dec_detected_error +add wave -noupdate /golay_codec_tb/iDEC/syndrome_valid +add wave -noupdate /golay_codec_tb/iDEC/syndrome_is_zero +add wave -noupdate /golay_codec_tb/iDEC/ready +add wave -noupdate /golay_codec_tb/iDEC/codeword_valid_i +add wave -noupdate /golay_codec_tb/iDEC/codeword_latch +add wave -noupdate /golay_codec_tb/iDEC/dec_valid +add wave -noupdate /golay_codec_tb/iDEC/err_corr_valid +add wave -noupdate /golay_codec_tb/iDEC/detected_error +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/ect_addr +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/syndrome +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/codeword_i +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/error_pattern +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/dec_codeword +add wave -noupdate /golay_codec_tb/iDEC/iSYN_GEN/clk +add wave -noupdate /golay_codec_tb/iDEC/iSYN_GEN/init +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/iSYN_GEN/codeword +add wave -noupdate /golay_codec_tb/iDEC/iSYN_GEN/codeword_valid +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/iSYN_GEN/syndrome +add wave -noupdate /golay_codec_tb/iDEC/iSYN_GEN/syndrome_valid +add wave -noupdate /golay_codec_tb/iDEC/iSYN_GEN/generating +add wave -noupdate /golay_codec_tb/iDEC/iSYN_GEN/finished +add wave -noupdate -radix unsigned /golay_codec_tb/iDEC/iSYN_GEN/idx_cnt +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/iSYN_GEN/data_xor +add wave -noupdate -radix hexadecimal /golay_codec_tb/iDEC/iSYN_GEN/data +TreeUpdate [SetDefaultTree] +WaveRestoreCursors {{Cursor 1} {385000 ps} 0} +quietly wave cursor active 1 +configure wave -namecolwidth 276 +configure wave -valuecolwidth 156 +configure wave -justifyvalue left +configure wave -signalnamewidth 0 +configure wave -snapdistance 10 +configure wave -datasetprefix 0 +configure wave -rowmargin 4 +configure wave -childrowmargin 2 +configure wave -gridoffset 0 +configure wave -gridperiod 1 +configure wave -griddelta 40 +configure wave -timeline 0 +configure wave -timelineunits ps +update +WaveRestoreZoom {0 ps} {7243360 ps} diff --git a/generic_ip/pof_protocol/1/src/golay_dec.vhd b/generic_ip/pof_protocol/1/src/golay_dec.vhd new file mode 100644 index 0000000..810e40e --- /dev/null +++ b/generic_ip/pof_protocol/1/src/golay_dec.vhd @@ -0,0 +1,118 @@ +------------------------------------------------------------------------------- +-- Title : golay_dec +-- Project : Generic-IP +------------------------------------------------------------------------------- +-- File : golay_dec.vhd +-- Author : Gianmarco Girau +-- Company : Global Inkjet Systems +-- Created : 2019-09-13 +-- Last update: 2019-09-16 +-- SVN ID : Git +-- Standard : VHDL'2008 +------------------------------------------------------------------------------- +-- Description: Binary Golay Decoder ([23,12,7]) +-- Error correction patterns are stored in a 2048x23 bits LUT +------------------------------------------------------------------------------- +-- altera vhdl_input_version vhdl_2008 + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +use work.golay_dec_pkg.all; + +entity golay_dec is + port( + clk : in std_logic; + init : in std_logic; -- always assert init to start + dec_ready : out std_logic; -- decoder ready to accept a codeword + codeword : in std_logic_vector(22 downto 0); + codeword_valid : in std_logic; + dec_symbol : out std_logic_vector(11 downto 0); + dec_symbol_valid : out std_logic; + dec_detected_error : out std_logic); -- detected errors can be either + -- correctable or not +end entity golay_dec; + +architecture rtl of golay_dec is + + + signal syndrome_valid, syndrome_is_zero : std_logic; + signal ready, codeword_valid_i : std_logic; + signal codeword_latch, dec_valid : std_logic; + signal err_corr_valid, detected_error : std_logic; + signal ect_addr, syndrome : std_logic_vector(10 downto 0); + signal codeword_i : std_logic_vector(22 downto 0); + signal error_pattern, dec_codeword : std_logic_vector(22 downto 0); + +begin + + ----------------------------------------------------------------------------- + -- Syndrome Generation + ----------------------------------------------------------------------------- + + iSYN_GEN: entity work.golay_dec_syndrome_gen + port map ( + clk => clk, + init => init, + codeword => codeword_i, + codeword_valid => codeword_valid_i, + syndrome => syndrome, + syndrome_valid => syndrome_valid); + + --codeword_valid_i <= codeword_valid and ready; + + syndrome_is_zero <= '1' when unsigned(syndrome) = 0 else '0'; + + ----------------------------------------------------------------------------- + -- Error Correction LUT + ----------------------------------------------------------------------------- + + -- An error is detected when there is a non-zero syndrome value. For each + -- syndrome value, the error correction LUT contains the pattern aiming to + -- correct the error. Only errors with up to 3 flipped bits can be corrected, + -- whether up to 7 flipped bits can be detected. + -- Note: make sure the LUT is instantiated using 6 M10K blocks. + pERR_CORR : process(clk) + begin + if(clk = '1' and clk'event) then + error_pattern <= error_corr_table(to_integer(unsigned(ect_addr))); + end if; + end process pERR_CORR; + + ----------------------------------------------------------------------------- + -- Decoding Process + ----------------------------------------------------------------------------- + + pDEC: process(clk) + begin + if(clk = '1' and clk'event) then + if(init = '1' or err_corr_valid = '1') then + ready <= '1'; + elsif(codeword_latch = '1') then + ready <= '0'; + end if; + codeword_valid_i <= codeword_latch; + if(codeword_latch = '1') then + codeword_i <= codeword; + end if; + err_corr_valid <= syndrome_valid; + dec_valid <= err_corr_valid; + detected_error <= err_corr_valid and (not syndrome_is_zero); + dec_codeword <= error_pattern xor codeword; + end if; + end process pDEC; + + codeword_latch <= codeword_valid and ready; + + ect_addr <= syndrome(10 downto 0); + + dec_ready <= ready; + + dec_symbol <= dec_codeword(22 downto 11); + dec_symbol_valid <= dec_valid; + + dec_detected_error <= detected_error; + + +end architecture rtl; diff --git a/generic_ip/pof_protocol/1/src/golay_dec_pkg.vhd b/generic_ip/pof_protocol/1/src/golay_dec_pkg.vhd new file mode 100644 index 0000000..4ae58ee --- /dev/null +++ b/generic_ip/pof_protocol/1/src/golay_dec_pkg.vhd @@ -0,0 +1,286 @@ +------------------------------------------------------------------------------- +-- Title : golay_dec_pkg +-- Project : Generic-IP +------------------------------------------------------------------------------- +-- File : golay_dec_pkg.vhd +-- Author : Gianmarco Girau +-- Company : Global Inkjet Systems +-- Created : 2019-09-13 +-- Last update: 2019-09-16 +-- SVN ID : Git +-- Standard : VHDL'2008 +------------------------------------------------------------------------------- +-- Description: Packge for Binary Golay Decoder ([23,12,7]) +-- Error correction patterns are stored in a 2048x23 bits LUT +------------------------------------------------------------------------------- +-- altera vhdl_input_version vhdl_2008 + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +package golay_dec_pkg is + + type err_corr_table_t is array (0 to 2047) of std_logic_vector(22 downto 0); + + -- Error Correction table: correction patterns to be applied when an error is + -- detected + constant error_corr_table : err_corr_table_t := ( + 23x"000000", 23x"000001", 23x"000002", 23x"000003", 23x"000004", 23x"000005", 23x"000006", 23x"000007", + 23x"000008", 23x"000009", 23x"00000A", 23x"00000B", 23x"00000C", 23x"00000D", 23x"00000E", 23x"024020", + 23x"000010", 23x"000011", 23x"000012", 23x"000013", 23x"000014", 23x"000015", 23x"000016", 23x"412000", + 23x"000018", 23x"000019", 23x"00001A", 23x"180800", 23x"00001C", 23x"200300", 23x"048040", 23x"001480", + 23x"000020", 23x"000021", 23x"000022", 23x"000023", 23x"000024", 23x"000025", 23x"000026", 23x"024008", + 23x"000028", 23x"000029", 23x"00002A", 23x"024004", 23x"00002C", 23x"024002", 23x"024001", 23x"024000", + 23x"000030", 23x"000031", 23x"000032", 23x"008180", 23x"000034", 23x"000C40", 23x"301000", 23x"0C0200", + 23x"000038", 23x"043000", 23x"400600", 23x"210040", 23x"090080", 23x"508000", 23x"002900", 23x"024010", + 23x"000040", 23x"000041", 23x"000042", 23x"000043", 23x"000044", 23x"000045", 23x"000046", 23x"280080", + 23x"000048", 23x"000049", 23x"00004A", 23x"002500", 23x"00004C", 23x"111000", 23x"048010", 23x"400A00", + 23x"000050", 23x"000051", 23x"000052", 23x"021200", 23x"000054", 23x"000C20", 23x"048008", 23x"104100", + 23x"000058", 23x"404080", 23x"048004", 23x"210020", 23x"048002", 23x"0A2000", 23x"048000", 23x"048001", + 23x"000060", 23x"000061", 23x"000062", 23x"540000", 23x"000064", 23x"000C10", 23x"010300", 23x"00B000", + 23x"000068", 23x"088200", 23x"001880", 23x"210010", 23x"602000", 23x"040180", 23x"180400", 23x"024040", + 23x"000070", 23x"000C04", 23x"086000", 23x"210008", 23x"000C01", 23x"000C00", 23x"420080", 23x"000C02", + 23x"120100", 23x"210002", 23x"210001", 23x"210000", 23x"005200", 23x"000C08", 23x"048020", 23x"210004", + 23x"000080", 23x"000081", 23x"000082", 23x"000083", 23x"000084", 23x"000085", 23x"000086", 23x"280040", + 23x"000088", 23x"000089", 23x"00008A", 23x"050200", 23x"00008C", 23x"00A800", 23x"500100", 23x"001410", + 23x"000090", 23x"000091", 23x"000092", 23x"008120", 23x"000094", 23x"160000", 23x"004A00", 23x"001408", + 23x"000098", 23x"404040", 23x"222000", 23x"001404", 23x"090020", 23x"001402", 23x"001401", 23x"001400", + 23x"0000A0", 23x"0000A1", 23x"0000A2", 23x"008110", 23x"0000A4", 23x"401200", 23x"042400", 23x"110800", + 23x"0000A8", 23x"300400", 23x"001840", 23x"482000", 23x"090010", 23x"040140", 23x"208200", 23x"024080", + 23x"0000B0", 23x"008102", 23x"008101", 23x"008100", 23x"090008", 23x"206000", 23x"420040", 23x"008104", + 23x"090004", 23x"020A00", 23x"144000", 23x"008108", 23x"090000", 23x"090001", 23x"090002", 23x"001420", + 23x"0000C0", 23x"0000C1", 23x"0000C2", 23x"280004", 23x"0000C4", 23x"280002", 23x"280001", 23x"280000", + 23x"0000C8", 23x"404010", 23x"001820", 23x"128000", 23x"020600", 23x"040120", 23x"016000", 23x"280008", + 23x"0000D0", 23x"404008", 23x"110400", 23x"042800", 23x"003100", 23x"018200", 23x"420020", 23x"280010", + 23x"404001", 23x"404000", 23x"080300", 23x"404002", 23x"300800", 23x"404004", 23x"048080", 23x"001440", + 23x"0000E0", 23x"032000", 23x"001808", 23x"004600", 23x"10C000", 23x"040108", 23x"420010", 23x"280020", + 23x"001802", 23x"040104", 23x"001800", 23x"001801", 23x"040101", 23x"040100", 23x"001804", 23x"040102", + 23x"240200", 23x"181000", 23x"420004", 23x"008140", 23x"420002", 23x"000C80", 23x"420000", 23x"420001", + 23x"00A400", 23x"404020", 23x"001810", 23x"210080", 23x"090040", 23x"040110", 23x"420008", 23x"102200", + 23x"000100", 23x"000101", 23x"000102", 23x"000103", 23x"000104", 23x"000105", 23x"000106", 23x"041800", + 23x"000108", 23x"000109", 23x"00010A", 23x"002440", 23x"00010C", 23x"200210", 23x"500080", 23x"098000", + 23x"000110", 23x"000111", 23x"000112", 23x"0080A0", 23x"000114", 23x"200208", 23x"0A0400", 23x"104040", + 23x"000118", 23x"200204", 23x"015000", 23x"460000", 23x"200201", 23x"200200", 23x"002820", 23x"200202", + 23x"000120", 23x"000121", 23x"000122", 23x"008090", 23x"000124", 23x"182000", 23x"010240", 23x"600400", + 23x"000128", 23x"410800", 23x"2C0000", 23x"101200", 23x"009400", 23x"0400C0", 23x"002810", 23x"024100", + 23x"000130", 23x"008082", 23x"008081", 23x"008080", 23x"444000", 23x"031000", 23x"002808", 23x"008084", + 23x"120040", 23x"084400", 23x"002804", 23x"008088", 23x"002802", 23x"200220", 23x"002800", 23x"002801", + 23x"000140", 23x"000141", 23x"000142", 23x"002408", 23x"000144", 23x"428000", 23x"010220", 23x"104010", + 23x"000148", 23x"002402", 23x"002401", 23x"002400", 23x"084800", 23x"0400A0", 23x"221000", 23x"002404", + 23x"000150", 23x"0D0000", 23x"600800", 23x"104004", 23x"003080", 23x"104002", 23x"104001", 23x"104000", + 23x"120020", 23x"009800", 23x"080280", 23x"002410", 23x"410400", 23x"200240", 23x"048100", 23x"104008", + 23x"000160", 23x"205000", 23x"010204", 23x"0A0800", 23x"010202", 23x"040088", 23x"010200", 23x"010201", + 23x"120010", 23x"040084", 23x"40C000", 23x"002420", 23x"040081", 23x"040080", 23x"010208", 23x"040082", + 23x"120008", 23x"402200", 23x"041400", 23x"0080C0", 23x"288000", 23x"000D00", 23x"010210", 23x"104020", + 23x"120000", 23x"120001", 23x"120002", 23x"210100", 23x"120004", 23x"040090", 23x"002840", 23x"481000", + 23x"000180", 23x"000181", 23x"000182", 23x"008030", 23x"000184", 23x"014400", 23x"500008", 23x"022200", + 23x"000188", 23x"0A1000", 23x"500004", 23x"204800", 23x"500002", 23x"040060", 23x"500000", 23x"500001", + 23x"000190", 23x"008022", 23x"008021", 23x"008020", 23x"003040", 23x"480800", 23x"250000", 23x"008024", + 23x"040C00", 23x"112000", 23x"080240", 23x"008028", 23x"02C000", 23x"200280", 23x"500010", 23x"001500", + 23x"0001A0", 23x"008012", 23x"008011", 23x"008010", 23x"220800", 23x"040048", 23x"085000", 23x"008014", + 23x"006200", 23x"040044", 23x"030400", 23x"008018", 23x"040041", 23x"040040", 23x"500020", 23x"040042", + 23x"008003", 23x"008002", 23x"008001", 23x"008000", 23x"100600", 23x"008006", 23x"008005", 23x"008004", + 23x"601000", 23x"00800A", 23x"008009", 23x"008008", 23x"090100", 23x"040050", 23x"002880", 23x"00800C", + 23x"0001C0", 23x"100A00", 23x"064000", 23x"411000", 23x"003010", 23x"040028", 23x"008C00", 23x"280100", + 23x"218000", 23x"040024", 23x"080210", 23x"002480", 23x"040021", 23x"040020", 23x"500040", 23x"040022", + 23x"003004", 23x"220400", 23x"080208", 23x"008060", 23x"003000", 23x"003001", 23x"003002", 23x"104080", + 23x"080202", 23x"404100", 23x"080200", 23x"080201", 23x"003008", 23x"040030", 23x"080204", 23x"030800", + 23x"480400", 23x"04000C", 23x"302000", 23x"008050", 23x"040009", 23x"040008", 23x"010280", 23x"04000A", + 23x"040005", 23x"040004", 23x"001900", 23x"040006", 23x"040001", 23x"040000", 23x"040003", 23x"040002", + 23x"014800", 23x"008042", 23x"008041", 23x"008040", 23x"003020", 23x"040018", 23x"420100", 23x"008044", + 23x"120080", 23x"040014", 23x"080220", 23x"008048", 23x"040011", 23x"040010", 23x"204400", 23x"040012", + 23x"000200", 23x"000201", 23x"000202", 23x"000203", 23x"000204", 23x"000205", 23x"000206", 23x"108400", + 23x"000208", 23x"000209", 23x"00020A", 23x"050080", 23x"00020C", 23x"200110", 23x"083000", 23x"400840", + 23x"000210", 23x"000211", 23x"000212", 23x"021040", 23x"000214", 23x"200108", 23x"004880", 23x"0C0020", + 23x"000218", 23x"200104", 23x"400420", 23x"00E000", 23x"200101", 23x"200100", 23x"130000", 23x"200102", + 23x"000220", 23x"000221", 23x"000222", 23x"202800", 23x"000224", 23x"401080", 23x"010140", 23x"0C0010", + 23x"000228", 23x"088040", 23x"400410", 23x"101100", 23x"140800", 23x"012400", 23x"208080", 23x"024200", + 23x"000230", 23x"114000", 23x"400408", 23x"0C0004", 23x"02A000", 23x"0C0002", 23x"0C0001", 23x"0C0000", + 23x"400402", 23x"020880", 23x"400400", 23x"400401", 23x"005040", 23x"200120", 23x"400404", 23x"0C0008", + 23x"000240", 23x"000241", 23x"000242", 23x"021010", 23x"000244", 23x"046000", 23x"010120", 23x"400808", + 23x"000248", 23x"088020", 23x"304000", 23x"400804", 23x"020480", 23x"400802", 23x"400801", 23x"400800", + 23x"000250", 23x"021002", 23x"021001", 23x"021000", 23x"580000", 23x"018080", 23x"202400", 23x"021004", + 23x"012800", 23x"140400", 23x"080180", 23x"021008", 23x"005020", 23x"200140", 23x"048200", 23x"400810", + 23x"000260", 23x"088008", 23x"010104", 23x"004480", 23x"010102", 23x"320000", 23x"010100", 23x"010101", + 23x"088001", 23x"088000", 23x"062000", 23x"088002", 23x"005010", 23x"088004", 23x"010108", 23x"400820", + 23x"240080", 23x"402100", 23x"108800", 23x"021020", 23x"005008", 23x"000E00", 23x"010110", 23x"0C0040", + 23x"005004", 23x"088010", 23x"400440", 23x"210200", 23x"005000", 23x"005001", 23x"005002", 23x"102080", + 23x"000280", 23x"000281", 23x"000282", 23x"050008", 23x"000284", 23x"401020", 23x"004810", 23x"022100", + 23x"000288", 23x"050002", 23x"050001", 23x"050000", 23x"020440", 23x"184000", 23x"208020", 23x"050004", + 23x"000290", 23x"082400", 23x"004804", 23x"700000", 23x"004802", 23x"018040", 23x"004800", 23x"004801", + 23x"109000", 23x"020820", 23x"080140", 23x"050010", 23x"442000", 23x"200180", 23x"004808", 23x"001600", + 23x"0002A0", 23x"401004", 23x"1A0000", 23x"004440", 23x"401001", 23x"401000", 23x"208008", 23x"401002", + 23x"006100", 23x"020810", 23x"208004", 23x"050020", 23x"208002", 23x"401008", 23x"208000", 23x"208001", + 23x"240040", 23x"020808", 23x"013000", 23x"008300", 23x"100500", 23x"401010", 23x"004820", 23x"0C0080", + 23x"020801", 23x"020800", 23x"400480", 23x"020802", 23x"090200", 23x"020804", 23x"208010", 23x"102040", + 23x"0002C0", 23x"100900", 23x"40A000", 23x"004420", 23x"020408", 23x"018010", 23x"141000", 23x"280200", + 23x"020404", 23x"203000", 23x"080110", 23x"050040", 23x"020400", 23x"020401", 23x"020402", 23x"400880", + 23x"240020", 23x"018004", 23x"080108", 23x"021080", 23x"018001", 23x"018000", 23x"004840", 23x"018002", + 23x"080102", 23x"404200", 23x"080100", 23x"080101", 23x"020410", 23x"018008", 23x"080104", 23x"102020", + 23x"240010", 23x"004402", 23x"004401", 23x"004400", 23x"082800", 23x"401040", 23x"010180", 23x"004404", + 23x"510000", 23x"088080", 23x"001A00", 23x"004408", 23x"020420", 23x"040300", 23x"208040", 23x"102010", + 23x"240000", 23x"240001", 23x"240002", 23x"004410", 23x"240004", 23x"018020", 23x"420200", 23x"102008", + 23x"240008", 23x"020840", 23x"080120", 23x"102004", 23x"005080", 23x"102002", 23x"102001", 23x"102000", + 23x"000300", 23x"000301", 23x"000302", 23x"484000", 23x"000304", 23x"200018", 23x"010060", 23x"022080", + 23x"000308", 23x"200014", 23x"028800", 23x"101020", 23x"200011", 23x"200010", 23x"044400", 23x"200012", + 23x"000310", 23x"20000C", 23x"142000", 23x"010C00", 23x"200009", 23x"200008", 23x"409000", 23x"20000A", + 23x"200005", 23x"200004", 23x"0800C0", 23x"200006", 23x"200001", 23x"200000", 23x"200003", 23x"200002", + 23x"000320", 23x"060400", 23x"010044", 23x"101008", 23x"010042", 23x"00C800", 23x"010040", 23x"010041", + 23x"006080", 23x"101002", 23x"101001", 23x"101000", 23x"4A0000", 23x"200030", 23x"010048", 23x"101004", + 23x"081800", 23x"402040", 23x"224000", 23x"008280", 23x"100480", 23x"200028", 23x"010050", 23x"0C0100", + 23x"058000", 23x"200024", 23x"400500", 23x"101010", 23x"200021", 23x"200020", 23x"002A00", 23x"200022", + 23x"000340", 23x"100880", 23x"010024", 23x"248000", 23x"010022", 23x"081400", 23x"010020", 23x"010021", + 23x"441000", 23x"034000", 23x"080090", 23x"002600", 23x"10A000", 23x"200050", 23x"010028", 23x"400900", + 23x"00C400", 23x"402020", 23x"080088", 23x"021100", 23x"060800", 23x"200048", 23x"010030", 23x"104200", + 23x"080082", 23x"200044", 23x"080080", 23x"080081", 23x"200041", 23x"200040", 23x"080084", 23x"200042", + 23x"010006", 23x"402010", 23x"010004", 23x"010005", 23x"010002", 23x"010003", 23x"010000", 23x"010001", + 23x"200C00", 23x"088100", 23x"01000C", 23x"101040", 23x"01000A", 23x"040280", 23x"010008", 23x"010009", + 23x"402001", 23x"402000", 23x"010014", 23x"402002", 23x"010012", 23x"402004", 23x"010010", 23x"010011", + 23x"120200", 23x"402008", 23x"0800A0", 23x"044800", 23x"005100", 23x"200060", 23x"010018", 23x"028400", + 23x"000380", 23x"100840", 23x"201400", 23x"022004", 23x"0C8000", 23x"022002", 23x"022001", 23x"022000", + 23x"006020", 23x"408400", 23x"080050", 23x"050100", 23x"011800", 23x"200090", 23x"500200", 23x"022008", + 23x"430000", 23x"045000", 23x"080048", 23x"008220", 23x"100420", 23x"200088", 23x"004900", 23x"022010", + 23x"080042", 23x"200084", 23x"080040", 23x"080041", 23x"200081", 23x"200080", 23x"080044", 23x"200082", + 23x"006008", 23x"290000", 23x"440800", 23x"008210", 23x"100410", 23x"401100", 23x"0100C0", 23x"022020", + 23x"006000", 23x"006001", 23x"006002", 23x"101080", 23x"006004", 23x"040240", 23x"208100", 23x"080C00", + 23x"100404", 23x"008202", 23x"008201", 23x"008200", 23x"100400", 23x"100401", 23x"100402", 23x"008204", + 23x"006010", 23x"020900", 23x"080060", 23x"008208", 23x"100408", 23x"2000A0", 23x"061000", 23x"414000", + 23x"100801", 23x"100800", 23x"080018", 23x"100802", 23x"604000", 23x"100804", 23x"0100A0", 23x"022040", + 23x"080012", 23x"100808", 23x"080010", 23x"080011", 23x"020500", 23x"040220", 23x"080014", 23x"00D000", + 23x"08000A", 23x"100810", 23x"080008", 23x"080009", 23x"003200", 23x"018100", 23x"08000C", 23x"440400", + 23x"080002", 23x"080003", 23x"080000", 23x"080001", 23x"080006", 23x"2000C0", 23x"080004", 23x"080005", + 23x"029000", 23x"100820", 23x"010084", 23x"004500", 23x"010082", 23x"040208", 23x"010080", 23x"010081", + 23x"006040", 23x"040204", 23x"080030", 23x"620000", 23x"040201", 23x"040200", 23x"010088", 23x"040202", + 23x"240100", 23x"402080", 23x"080028", 23x"008240", 23x"100440", 23x"0A4000", 23x"010090", 23x"201800", + 23x"080022", 23x"011400", 23x"080020", 23x"080021", 23x"408800", 23x"040210", 23x"080024", 23x"102100", + 23x"000400", 23x"000401", 23x"000402", 23x"000403", 23x"000404", 23x"000405", 23x"000406", 23x"108200", + 23x"000408", 23x"000409", 23x"00040A", 23x"002140", 23x"00040C", 23x"4C0000", 23x"210800", 23x"001090", + 23x"000410", 23x"000411", 23x"000412", 23x"244000", 23x"000414", 23x"000860", 23x"0A0100", 23x"001088", + 23x"000418", 23x"038000", 23x"400220", 23x"001084", 23x"106000", 23x"001082", 23x"001081", 23x"001080", + 23x"000420", 23x"000421", 23x"000422", 23x"091000", 23x"000424", 23x"000850", 23x"042080", 23x"600100", + 23x"000428", 23x"300080", 23x"400210", 23x"048800", 23x"009100", 23x"012200", 23x"180040", 23x"024400", + 23x"000430", 23x"000844", 23x"400208", 23x"122000", 23x"000841", 23x"000840", 23x"01C000", 23x"000842", + 23x"400202", 23x"084100", 23x"400200", 23x"400201", 23x"260000", 23x"000848", 23x"400204", 23x"0010A0", + 23x"000440", 23x"000441", 23x"000442", 23x"002108", 23x"000444", 23x"000830", 23x"405000", 23x"070000", + 23x"000448", 23x"002102", 23x"002101", 23x"002100", 23x"020280", 23x"20C000", 23x"180020", 23x"002104", + 23x"000450", 23x"000824", 23x"110080", 23x"488000", 23x"000821", 23x"000820", 23x"202200", 23x"000822", + 23x"281000", 23x"140200", 23x"024800", 23x"002110", 23x"410100", 23x"000828", 23x"048400", 23x"0010C0", + 23x"000460", 23x"000814", 23x"228000", 23x"004280", 23x"000811", 23x"000810", 23x"180008", 23x"000812", + 23x"054000", 23x"421000", 23x"180004", 23x"002120", 23x"180002", 23x"000818", 23x"180000", 23x"180001", + 23x"000805", 23x"000804", 23x"041100", 23x"000806", 23x"000801", 23x"000800", 23x"000803", 23x"000802", + 23x"00A080", 23x"00080C", 23x"400240", 23x"210400", 23x"000809", 23x"000808", 23x"180010", 23x"00080A", + 23x"000480", 23x"000481", 23x"000482", 23x"420800", 23x"000484", 23x"014100", 23x"042020", 23x"001018", + 23x"000488", 23x"300020", 23x"08C000", 23x"001014", 23x"020240", 23x"001012", 23x"001011", 23x"001010", + 23x"000490", 23x"082200", 23x"110040", 23x"00100C", 23x"608000", 23x"00100A", 23x"001009", 23x"001008", + 23x"040900", 23x"001006", 23x"001005", 23x"001004", 23x"001003", 23x"001002", 23x"001001", 23x"001000", + 23x"0004A0", 23x"300008", 23x"042004", 23x"004240", 23x"042002", 23x"0A8000", 23x"042000", 23x"042001", + 23x"300001", 23x"300000", 23x"030100", 23x"300002", 23x"404800", 23x"300004", 23x"042008", 23x"001030", + 23x"025000", 23x"450000", 23x"280800", 23x"008500", 23x"100300", 23x"0008C0", 23x"042010", 23x"001028", + 23x"00A040", 23x"300010", 23x"400280", 23x"001024", 23x"090400", 23x"001022", 23x"001021", 23x"001020", + 23x"0004C0", 23x"049000", 23x"110010", 23x"004220", 23x"020208", 23x"502000", 23x"008900", 23x"280400", + 23x"020204", 23x"090800", 23x"640000", 23x"002180", 23x"020200", 23x"020201", 23x"020202", 23x"001050", + 23x"110002", 23x"220100", 23x"110000", 23x"110001", 23x"0C4000", 23x"0008A0", 23x"110004", 23x"001048", + 23x"00A020", 23x"404400", 23x"110008", 23x"001044", 23x"020210", 23x"001042", 23x"001041", 23x"001040", + 23x"480100", 23x"004202", 23x"004201", 23x"004200", 23x"211000", 23x"000890", 23x"042040", 23x"004204", + 23x"00A010", 23x"300040", 23x"001C00", 23x"004208", 23x"020220", 23x"040500", 23x"180080", 23x"418000", + 23x"00A008", 23x"000884", 23x"110020", 23x"004210", 23x"000881", 23x"000880", 23x"420400", 23x"000882", + 23x"00A000", 23x"00A001", 23x"00A002", 23x"0E0000", 23x"00A004", 23x"000888", 23x"204100", 23x"001060", + 23x"000500", 23x"000501", 23x"000502", 23x"002048", 23x"000504", 23x"014080", 23x"0A0010", 23x"600020", + 23x"000508", 23x"002042", 23x"002041", 23x"002040", 23x"009020", 23x"120800", 23x"044200", 23x"002044", + 23x"000510", 23x"501000", 23x"0A0004", 23x"010A00", 23x"0A0002", 23x"04A000", 23x"0A0000", 23x"0A0001", + 23x"040880", 23x"084020", 23x"308000", 23x"002050", 23x"410040", 23x"200600", 23x"0A0008", 23x"001180", + 23x"000520", 23x"060200", 23x"104800", 23x"600004", 23x"009008", 23x"600002", 23x"600001", 23x"600000", + 23x"009004", 23x"084010", 23x"030080", 23x"002060", 23x"009000", 23x"009001", 23x"009002", 23x"600008", + 23x"212000", 23x"084008", 23x"041040", 23x"008480", 23x"100280", 23x"000940", 23x"0A0020", 23x"600010", + 23x"084001", 23x"084000", 23x"400300", 23x"084002", 23x"009010", 23x"084004", 23x"002C00", 23x"150000", + 23x"000540", 23x"00200A", 23x"002009", 23x"002008", 23x"340000", 23x"081200", 23x"008880", 23x"00200C", + 23x"002003", 23x"002002", 23x"002001", 23x"002000", 23x"410010", 23x"002006", 23x"002005", 23x"002004", + 23x"00C200", 23x"220080", 23x"041020", 23x"002018", 23x"410008", 23x"000920", 23x"0A0040", 23x"104400", + 23x"410004", 23x"002012", 23x"002011", 23x"002010", 23x"410000", 23x"410001", 23x"410002", 23x"002014", + 23x"480080", 23x"118000", 23x"041010", 23x"002028", 23x"026000", 23x"000910", 23x"010600", 23x"600040", + 23x"200A00", 23x"002022", 23x"002021", 23x"002020", 23x"009040", 23x"040480", 23x"180100", 23x"002024", + 23x"041002", 23x"000904", 23x"041000", 23x"041001", 23x"000901", 23x"000900", 23x"041004", 23x"000902", + 23x"120400", 23x"084040", 23x"041008", 23x"002030", 23x"410020", 23x"000908", 23x"204080", 23x"028200", + 23x"000580", 23x"014004", 23x"201200", 23x"1C0000", 23x"014001", 23x"014000", 23x"008840", 23x"014002", + 23x"040810", 23x"408200", 23x"030020", 23x"0020C0", 23x"282000", 23x"014008", 23x"500400", 23x"001110", + 23x"040808", 23x"220040", 23x"406000", 23x"008420", 23x"100220", 23x"014010", 23x"0A0080", 23x"001108", + 23x"040800", 23x"040801", 23x"040802", 23x"001104", 23x"040804", 23x"001102", 23x"001101", 23x"001100", + 23x"480040", 23x"003800", 23x"030008", 23x"008410", 23x"100210", 23x"014020", 23x"042100", 23x"600080", + 23x"030002", 23x"300100", 23x"030000", 23x"030001", 23x"009080", 23x"040440", 23x"030004", 23x"080A00", + 23x"100204", 23x"008402", 23x"008401", 23x"008400", 23x"100200", 23x"100201", 23x"100202", 23x"008404", + 23x"040820", 23x"084080", 23x"030010", 23x"008408", 23x"100208", 23x"422000", 23x"204040", 23x"001120", + 23x"480020", 23x"220010", 23x"008804", 23x"002088", 23x"008802", 23x"014040", 23x"008800", 23x"008801", + 23x"105000", 23x"002082", 23x"002081", 23x"002080", 23x"020300", 23x"040420", 23x"008808", 23x"002084", + 23x"220001", 23x"220000", 23x"110100", 23x"220002", 23x"003400", 23x"220004", 23x"008810", 23x"440200", + 23x"040840", 23x"220008", 23x"080600", 23x"002090", 23x"410080", 23x"188000", 23x"204020", 23x"001140", + 23x"480000", 23x"480001", 23x"480002", 23x"004300", 23x"480004", 23x"040408", 23x"008820", 23x"121000", + 23x"480008", 23x"040404", 23x"030040", 23x"0020A0", 23x"040401", 23x"040400", 23x"204010", 23x"040402", + 23x"480010", 23x"220020", 23x"041080", 23x"008440", 23x"100240", 23x"000980", 23x"204008", 23x"092000", + 23x"00A100", 23x"011200", 23x"204004", 23x"500800", 23x"204002", 23x"040410", 23x"204000", 23x"204001", + 23x"000600", 23x"000601", 23x"000602", 23x"108004", 23x"000604", 23x"108002", 23x"108001", 23x"108000", + 23x"000608", 23x"005800", 23x"400030", 23x"2A0000", 23x"0200C0", 23x"012020", 23x"044100", 23x"108008", + 23x"000610", 23x"082080", 23x"400028", 23x"010900", 23x"051000", 23x"424000", 23x"202040", 23x"108010", + 23x"400022", 23x"140040", 23x"400020", 23x"400021", 23x"088800", 23x"200500", 23x"400024", 23x"001280", + 23x"000620", 23x"060100", 23x"400018", 23x"0040C0", 23x"284000", 23x"012008", 23x"021800", 23x"108020", + 23x"400012", 23x"012004", 23x"400010", 23x"400011", 23x"012001", 23x"012000", 23x"400014", 23x"012002", + 23x"40000A", 23x"209000", 23x"400008", 23x"400009", 23x"100180", 23x"000A40", 23x"40000C", 23x"0C0400", + 23x"400002", 23x"400003", 23x"400000", 23x"400001", 23x"400006", 23x"012010", 23x"400004", 23x"400005", + 23x"000640", 23x"610000", 23x"0C0800", 23x"0040A0", 23x"020088", 23x"081100", 23x"202010", 23x"108040", + 23x"020084", 23x"140010", 23x"019000", 23x"002300", 23x"020080", 23x"020081", 23x"020082", 23x"400C00", + 23x"00C100", 23x"140008", 23x"202004", 23x"021400", 23x"202002", 23x"000A20", 23x"202000", 23x"202001", + 23x"140001", 23x"140000", 23x"400060", 23x"140002", 23x"020090", 23x"140004", 23x"202008", 23x"094000", + 23x"103000", 23x"004082", 23x"004081", 23x"004080", 23x"448000", 23x"000A10", 23x"010500", 23x"004084", + 23x"200900", 23x"088400", 23x"400050", 23x"004088", 23x"0200A0", 23x"012040", 23x"180200", 23x"241000", + 23x"0B0000", 23x"000A04", 23x"400048", 23x"004090", 23x"000A01", 23x"000A00", 23x"202020", 23x"000A02", + 23x"400042", 23x"140020", 23x"400040", 23x"400041", 23x"005400", 23x"000A08", 23x"400044", 23x"028100", + 23x"000680", 23x"082010", 23x"201100", 23x"004060", 23x"020048", 23x"240800", 23x"490000", 23x"108080", + 23x"020044", 23x"408100", 23x"102800", 23x"050400", 23x"020040", 23x"020041", 23x"020042", 23x"001210", + 23x"082001", 23x"082000", 23x"068000", 23x"082002", 23x"100120", 23x"082004", 23x"004C00", 23x"001208", + 23x"214000", 23x"082008", 23x"4000A0", 23x"001204", 23x"020050", 23x"001202", 23x"001201", 23x"001200", + 23x"018800", 23x"004042", 23x"004041", 23x"004040", 23x"100110", 23x"401400", 23x"042200", 23x"004044", + 23x"0C1000", 23x"300200", 23x"400090", 23x"004048", 23x"020060", 23x"012080", 23x"208400", 23x"080900", + 23x"100104", 23x"082020", 23x"400088", 23x"004050", 23x"100100", 23x"100101", 23x"100102", 23x"230000", + 23x"400082", 23x"020C00", 23x"400080", 23x"400081", 23x"100108", 23x"04C000", 23x"400084", 23x"001220", + 23x"02000C", 23x"004022", 23x"004021", 23x"004020", 23x"020008", 23x"020009", 23x"02000A", 23x"004024", + 23x"020004", 23x"020005", 23x"020006", 23x"004028", 23x"020000", 23x"020001", 23x"020002", 23x"020003", + 23x"401800", 23x"082040", 23x"110200", 23x"004030", 23x"020018", 23x"018400", 23x"202080", 23x"440100", + 23x"020014", 23x"140080", 23x"080500", 23x"208800", 23x"020010", 23x"020011", 23x"020012", 23x"001240", + 23x"004003", 23x"004002", 23x"004001", 23x"004000", 23x"020028", 23x"004006", 23x"004005", 23x"004004", + 23x"020024", 23x"00400A", 23x"004009", 23x"004008", 23x"020020", 23x"020021", 23x"020022", 23x"00400C", + 23x"240400", 23x"004012", 23x"004011", 23x"004010", 23x"100140", 23x"000A80", 23x"089000", 23x"004014", + 23x"00A200", 23x"011100", 23x"4000C0", 23x"004018", 23x"020030", 23x"680000", 23x"050800", 23x"102400", + 23x"000700", 23x"060020", 23x"201080", 23x"010810", 23x"402800", 23x"081040", 23x"044008", 23x"108100", + 23x"190000", 23x"408080", 23x"044004", 23x"002240", 23x"044002", 23x"200410", 23x"044000", 23x"044001", + 23x"00C040", 23x"010802", 23x"010801", 23x"010800", 23x"1000A0", 23x"200408", 23x"0A0200", 23x"010804", + 23x"023000", 23x"200404", 23x"400120", 23x"010808", 23x"200401", 23x"200400", 23x"044010", 23x"200402", + 23x"060001", 23x"060000", 23x"08A000", 23x"060002", 23x"100090", 23x"060004", 23x"010440", 23x"600200", + 23x"200840", 23x"060008", 23x"400110", 23x"101400", 23x"009200", 23x"012100", 23x"044020", 23x"080880", + 23x"100084", 23x"060010", 23x"400108", 23x"010820", 23x"100080", 23x"100081", 23x"100082", 23x"007000", + 23x"400102", 23x"084200", 23x"400100", 23x"400101", 23x"100088", 23x"200420", 23x"400104", 23x"028040", + 23x"00C010", 23x"081004", 23x"520000", 23x"002208", 23x"081001", 23x"081000", 23x"010420", 23x"081002", + 23x"200820", 23x"002202", 23x"002201", 23x"002200", 23x"020180", 23x"081008", 23x"044040", 23x"002204", + 23x"00C000", 23x"00C001", 23x"00C002", 23x"010840", 23x"00C004", 23x"081010", 23x"202100", 23x"440080", + 23x"00C008", 23x"140100", 23x"080480", 23x"002210", 23x"410200", 23x"200440", 23x"101800", 23x"028020", + 23x"200808", 23x"060040", 23x"010404", 23x"004180", 23x"010402", 23x"081020", 23x"010400", 23x"010401", + 23x"200800", 23x"200801", 23x"200802", 23x"002220", 23x"200804", 23x"504000", 23x"010408", 23x"028010", + 23x"00C020", 23x"402400", 23x"041200", 23x"380000", 23x"1000C0", 23x"000B00", 23x"010410", 23x"028008", + 23x"200810", 23x"011080", 23x"400140", 23x"028004", 23x"0C2000", 23x"028002", 23x"028001", 23x"028000", + 23x"201002", 23x"408008", 23x"201000", 23x"201001", 23x"100030", 23x"014200", 23x"201004", 23x"022400", + 23x"408001", 23x"408000", 23x"201008", 23x"408002", 23x"020140", 23x"408004", 23x"044080", 23x"080820", + 23x"100024", 23x"082100", 23x"201010", 23x"010880", 23x"100020", 23x"100021", 23x"100022", 23x"440040", + 23x"040A00", 23x"408010", 23x"080440", 23x"124000", 23x"100028", 23x"200480", 23x"01A000", 23x"001300", + 23x"100014", 23x"060080", 23x"201020", 23x"004140", 23x"100010", 23x"100011", 23x"100012", 23x"080808", + 23x"006400", 23x"408020", 23x"030200", 23x"080804", 23x"100018", 23x"080802", 23x"080801", 23x"080800", + 23x"100004", 23x"100005", 23x"100006", 23x"008600", 23x"100000", 23x"100001", 23x"100002", 23x"100003", + 23x"10000C", 23x"011040", 23x"400180", 23x"242000", 23x"100008", 23x"100009", 23x"10000A", 23x"080810", + 23x"052000", 23x"100C00", 23x"201040", 23x"004120", 23x"020108", 23x"081080", 23x"008A00", 23x"440010", + 23x"020104", 23x"408040", 23x"080410", 23x"002280", 23x"020100", 23x"020101", 23x"020102", 23x"310000", + 23x"00C080", 23x"220200", 23x"080408", 23x"440004", 23x"100060", 23x"440002", 23x"440001", 23x"440000", + 23x"080402", 23x"011020", 23x"080400", 23x"080401", 23x"020110", 23x"006800", 23x"080404", 23x"440008", + 23x"480200", 23x"004102", 23x"004101", 23x"004100", 23x"100050", 23x"20A000", 23x"010480", 23x"004104", + 23x"200880", 23x"011010", 23x"148000", 23x"004108", 23x"020120", 23x"040600", 23x"403000", 23x"080840", + 23x"100044", 23x"011008", 23x"022800", 23x"004110", 23x"100040", 23x"100041", 23x"100042", 23x"440020", + 23x"011001", 23x"011000", 23x"080420", 23x"011002", 23x"100048", 23x"011004", 23x"204200", 23x"028080"); + +end package golay_dec_pkg; diff --git a/generic_ip/pof_protocol/1/src/golay_dec_syndrome_gen.vhd b/generic_ip/pof_protocol/1/src/golay_dec_syndrome_gen.vhd new file mode 100644 index 0000000..0b1159a --- /dev/null +++ b/generic_ip/pof_protocol/1/src/golay_dec_syndrome_gen.vhd @@ -0,0 +1,76 @@ +------------------------------------------------------------------------------- +-- Title : golay_dec_syndrome_gen +-- Project : Generic-IP +------------------------------------------------------------------------------- +-- File : golay_dec_syndrome_gen.vhd +-- Author : Gianmarco Girau +-- Company : Global Inkjet Systems +-- Created : 2019-09-11 +-- Last update: 2019-09-16 +-- SVN ID : Git +-- Standard : VHDL'2008 +------------------------------------------------------------------------------- +-- Description: Syndrome generator for a Binary Golay Decoder (Generator +-- Polynomial is 0xC75) +------------------------------------------------------------------------------- +-- altera vhdl_input_version vhdl_2008 + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; + +entity golay_dec_syndrome_gen is + port( + clk : in std_logic; + init : in std_logic; + codeword : in std_logic_vector(22 downto 0); + codeword_valid : in std_logic; + syndrome : out std_logic_vector(10 downto 0); + syndrome_valid : out std_logic); +end entity golay_dec_syndrome_gen; + +architecture rtl of golay_dec_syndrome_gen is + + constant GEN_POL : std_logic_vector(11 downto 0) := X"C75"; -- Generator Polynomial + + signal generating, finished : std_logic; + signal idx_cnt : std_logic_vector( 4 downto 0); + signal data_xor : std_logic_vector(11 downto 0); + signal data : std_logic_vector(22 downto 0); + +begin + + pGEN_SYN : process(clk) + begin + if(clk = '1' and clk'event) then + if(init = '1' or finished = '1') then + generating <= '0'; + elsif(codeword_valid = '1') then + generating <= '1'; + end if; + if(generating = '0' and codeword_valid = '1') then + data <= codeword; + elsif(generating = '1') then + if(data(0) = '1') then + data <= '0' & data(data'left downto 12) & data_xor(data_xor'left downto 1); + else + data <= '0' & data(data'left downto 1); + end if; + end if; + if(finished = '1') then + syndrome <= data(10 downto 0); + end if; + syndrome_valid <= finished; + if(codeword_valid = '1') then + idx_cnt <= (others => '0'); + elsif(generating = '1') then + idx_cnt <= std_logic_vector(unsigned(idx_cnt)+1); + end if; + end if; + end process pGEN_SYN; + + finished <= '1' when unsigned(idx_cnt) = 23 else '0'; + + data_xor <= data(11 downto 0) xor GEN_POL; + +end architecture rtl; diff --git a/generic_ip/pof_protocol/1/src/test/binary-golay-model/com.sh b/generic_ip/pof_protocol/1/src/test/binary-golay-model/com.sh index d421fe0..84088b6 100644 --- a/generic_ip/pof_protocol/1/src/test/binary-golay-model/com.sh +++ b/generic_ip/pof_protocol/1/src/test/binary-golay-model/com.sh @@ -1,4 +1,2 @@ #!/bin/sh -gcc golay23.c -o golay23 -gcc golay23-gen.c -o golay23-gen gcc golay23_codec.c -o golay23_codec diff --git a/generic_ip/pof_protocol/1/src/test/error_corr_parser.py b/generic_ip/pof_protocol/1/src/test/error_corr_parser.py new file mode 100644 index 0000000..44f31f2 --- /dev/null +++ b/generic_ip/pof_protocol/1/src/test/error_corr_parser.py @@ -0,0 +1,32 @@ +# Read the Error-Correction table for a Golay [23, 12, 7] decoder, parse the table as a VHDL constant + +error_table_file = './binary-golay-model/decoding_table.txt' +f_data = open(error_table_file, 'r') + +err_corr_table = [] + +for line in f_data: + err_corr_table.append(int(line,16)) + #print(err_corr_table[-1]) + +f_data.close + + +f_data = open('./err_corr_table.tmp', 'w') + +N = len(err_corr_table) + +f_data.write("(" + '\n') + +n_lines = int(2048/8) +n_col = int(N/n_lines) +for n in range(0,n_lines): + line = '' + for m in range(0,n_col): + line += "23x\"{:06X}\", ".format(err_corr_table[m+n_col*n]) + if n == n_lines-1: + line = line[0:-2] + ');' + f_data.write(line + '\n') + +f_data.close + diff --git a/generic_ip/pof_protocol/1/src/test/golay_codec_tb.vhd b/generic_ip/pof_protocol/1/src/test/golay_codec_tb.vhd new file mode 100644 index 0000000..a5cde50 --- /dev/null +++ b/generic_ip/pof_protocol/1/src/test/golay_codec_tb.vhd @@ -0,0 +1,335 @@ +------------------------------------------------------------------------------- +-- Title : golay_codec_tb +-- Project : Generic-IP +------------------------------------------------------------------------------- +-- File : golay_codec_tb.vhd +-- Author : Gianmarco Girau +-- Company : Global Inkjet Systems +-- Created : 2019-09-11 +-- Last update: 2019-09-17 +-- SVN ID : Git +-- Standard : VHDL'2008 +------------------------------------------------------------------------------- +-- Description: golay_enc/golay_dec testbench +------------------------------------------------------------------------------- + +library std; +use std.textio.all; + +library ieee; +use ieee.std_logic_1164.all; +use ieee.numeric_std.all; +use ieee.std_logic_textio.all; + +use work.log_pkg.all; + +entity golay_codec_tb is + -- +end entity golay_codec_tb; + +architecture rtl of golay_codec_tb is + + -- Test type: + -- exhaustive runs all the possible test patterns (2^23). + -- non-exhaustive selects random symbols and randoms error vectors + constant RUN_EXHAUSTIVE_TEST : boolean := true; + + -- when running the non-exhaustive test, stop after a fixed number of + -- codewords: + constant SIM_CODEWORDS : natural := 4096; + + constant SKIP_ERROR_INJECTION : boolean := false; + + constant STOP_ON_FIRST_ERROR : boolean := true; + + constant REPORT_PROGRESS_INTERVAL : natural := 65536; + + constant CLK_PERIOD : time := 10 ns; + + -- Logging Verbosity Level + constant VERBOSITY_LEVEL : verb_level_t := VMEDIUM; + + type err_vec_table_t is array (0 to 2047) of std_logic_vector(22 downto 0); + + constant error_vec_file : string := "./../src/test/binary-golay-model/error_patterns.txt"; + + signal clk : std_logic := '0'; + signal init : std_logic; + signal symbol : std_logic_vector(11 downto 0); + signal symbol_valid : std_logic; + signal codeword : std_logic_vector(22 downto 0); + signal codeword_valid : std_logic; + signal rx_codeword : std_logic_vector(22 downto 0); + signal rx_codeword_valid : std_logic; + signal dec_symbol : std_logic_vector(11 downto 0); + signal dec_symbol_valid : std_logic; + signal injected_error : std_logic_vector(22 downto 0); + signal dec_detected_error : std_logic; + signal dec_ready : std_logic; + -- + signal symbol_cnt : integer; -- total number of encoded/decoded symbols + signal injected_err_cnt : integer; -- numbers of codewords with injected error + signal error_free_cnt : integer; -- numbers of codewords without injected error + signal error_cnt : integer; -- encoding/decoding error (does not + -- include not-correctable errors) + -- + signal test_completed : boolean; + signal setup : boolean; + signal running : boolean; + signal passed : boolean; + signal failed : boolean; + -- + shared variable error_flag : boolean; + + ----------------------------------------------------------------------------- + -- TB Functions / Procedures + ----------------------------------------------------------------------------- + + procedure wait_latency( + signal clk : in std_logic; + cycles : in natural) is + begin + for i in 1 to cycles loop + wait until clk = '1' and clk'event; + end loop; -- i + end procedure wait_latency; + + procedure fetch_error_vectors( + fname : in string; + error_vec : out err_vec_table_t) is + + file f_id : text; + variable status : file_open_status; + variable InLine : line; + variable word : std_logic_vector(22 downto 0); + + begin + + log("Fetching error vectors ...", VLOW); + + file_open(status, f_id, fname, read_mode); + if(status /= open_ok) then + log("ERROR: Failed to open file " & fname & ".", VLOW); + error_flag := true; + else + + READ_LOOP: for idx in 0 to 2047 loop + + readline(f_id, InLine); + hread(InLine, word); + error_vec(idx) := word; + --log("encoding-table[" & to_string(idx) & "] = " & to_hstring(encoding_table(idx)), VMEDIUM); + + end loop; -- READ_LOOP + + file_close(f_id); + + log("Error vectors fetched.", VLOW); + + end if; + + end procedure fetch_error_vectors; + +begin + + clk <= not clk after 0.5*CLK_PERIOD; + + ----------------------------------------------------------------------------- + -- UUTs + ----------------------------------------------------------------------------- + + iENC: entity work.golay_enc + port map ( + clk => clk, + init => init, + symbol => symbol, + symbol_valid => symbol_valid, + codeword => codeword, + codeword_valid => codeword_valid); + + iDEC: entity work.golay_dec + port map ( + clk => clk, + init => init, + dec_ready => dec_ready, + codeword => rx_codeword, + codeword_valid => rx_codeword_valid, + dec_symbol => dec_symbol, + dec_symbol_valid => dec_symbol_valid, + dec_detected_error => dec_detected_error); + + ----------------------------------------------------------------------------- + -- Error Injection + ----------------------------------------------------------------------------- + + rx_codeword_valid <= codeword_valid; + rx_codeword <= codeword xor injected_error; + + ----------------------------------------------------------------------------- + -- Testbench Logic + ----------------------------------------------------------------------------- + + pTB : process + variable error_vec : err_vec_table_t; + variable sim_progress : real; + begin + + set_log_verbosity(VERBOSITY_LEVEL); + + setup <= true; + running <= false; + passed <= false; + + init <= '0'; + -- + symbol <= (others => '0'); + symbol_valid <= '0'; + -- + injected_error <= (others => '0'); + -- + symbol_cnt <= 0; + injected_err_cnt <= 0; + error_free_cnt <= 0; + error_cnt <= 0; + + -- Fetch the error patterns + log_separator_line(VLOW); + fetch_error_vectors(error_vec_file, error_vec); + log_separator_line(VLOW); + + -- init + wait for 100 ns; + wait until clk = '1' and clk'event; + init <= '1'; + wait until clk = '1' and clk'event; + init <= '0'; + + setup <= false; + running <= true; + + wait for 100 ns; + wait until clk = '1' and clk'event; + + log_separator_line(VLOW); + log("Golay Encoder/Decoder Verification ", VLOW); + log_separator_line(VLOW); + + if(RUN_EXHAUSTIVE_TEST = true) then + + if(SKIP_ERROR_INJECTION = true) then + log("Running full verification, without any injected error (2^12 codewords)", VLOW); + else + log("Running full verification, with error injection (2^23 codewords)", VLOW); + end if; + + -- Encode symbols and check the results + SYMBOL_LOOP: for symbol_idx in 0 to 4095 loop + ERROR_LOOP: for error_idx in 0 to 2047 loop + + -- select the error pattern + if(SKIP_ERROR_INJECTION = false) then + injected_error <= error_vec(error_idx); + else + injected_error <= (others => '0'); + end if; + + wait until clk = '1' and clk'event; + -- apply a new symbol + symbol <= std_logic_vector(to_unsigned(symbol_idx,12)); + symbol_valid <= '1'; + symbol_cnt <= symbol_cnt + 1; + if(unsigned(injected_error) = 0) then + error_free_cnt <= error_free_cnt + 1; + else + injected_err_cnt <= injected_err_cnt + 1; + end if; + + wait until clk = '1' and clk'event; + symbol_valid <= '0'; + -- wait until the encoding process is finished + wait until dec_symbol_valid = '1'; + wait until clk = '0' and clk'event; + -- check the data + if(dec_symbol /= symbol) then + log("ERROR: orginal symbol = " & to_hstring(symbol) & ", decoded symbol = " & to_hstring(dec_symbol) & ", injected error = " & to_hstring(injected_error), VLOW); + error_flag := true; + error_cnt <= error_cnt + 1; + end if; + -- check the error flag + if(unsigned(injected_error) = 0) then + if(dec_detected_error = '1') then + log("ERROR: False positive on Decoder detected error flag", VLOW); + error_flag := true; + error_cnt <= error_cnt + 1; + end if; + else + if(dec_detected_error = '0') then + log("ERROR: Decoder did not detect injected error", VLOW); + error_flag := true; + error_cnt <= error_cnt + 1; + end if; + end if; + + if(error_flag = true and STOP_ON_FIRST_ERROR = true) then + exit SYMBOL_LOOP; + end if; + + -- Exit the loop after the first symbol + if(SKIP_ERROR_INJECTION = true) then + exit ERROR_LOOP; + end if; + + wait until clk = '1' and clk'event; + + if(symbol_cnt > 0 and (symbol_cnt mod REPORT_PROGRESS_INTERVAL) = 0) then + sim_progress := real(symbol_cnt*100)/8388608.0; + log("INFO: Total Simulated Symbols = " & to_string(symbol_cnt) & "(" & to_string(sim_progress,1) & "%) ...", VLOW); + log("INFO: Error-free codewords = " & to_string(error_free_cnt) & ", Injected-errors = " & to_string(injected_err_cnt) & ".", VLOW); + end if; + + end loop; -- error_idx + end loop; -- symbol_idx + + else + log("ERROR: Ramdom test not supported yet!", VLOW); + error_flag := true; + end if; -- RUN_EXHAUSTIVE_TEST = true + + wait for 100 ns; + running <= false; + + if(error_cnt = 0) then + passed <= true; + log("Encoder/Decoder test completed: total symbols = " & to_string(symbol_cnt) & ", error-free codewords = " & to_string(error_free_cnt) & ", injected-errors = " & to_string(injected_err_cnt) & ".", VLOW); + end if; + + wait; + + end process pTB; + + pCHECK_ERROR : process + begin + failed <= false; + while true loop + wait for 100 ns; + if(error_flag = true) then + failed <= true; + end if; + end loop; + end process pCHECK_ERROR; + + pREPORT_RESULT : process + begin + wait until failed = true or passed = true; + wait for 1 us; + log_separator_line(VLOW); + if(failed = true) then + log("FAILURE: test completed with errors.", VLOW); + elsif(passed = true) then + log("SUCCESS: test successfully completed.", VLOW); + end if; + log_separator_line(VLOW); + test_completed <= true; + end process pREPORT_RESULT; + +end architecture rtl; diff --git a/generic_ip/pof_protocol/Readme.txt b/generic_ip/pof_protocol/Readme.txt new file mode 100644 index 0000000..e38099d --- /dev/null +++ b/generic_ip/pof_protocol/Readme.txt @@ -0,0 +1 @@ +- Major Version 1: Modified POF Protocol, with Golay coding \ No newline at end of file