Re: cyclic (7,4) encoder
This is in extension with the above program.
Actually if u have idea of fire code which is binary cyclic code....so i have extended the above (7,4) cyclic code for (35,27) Fire code - a 3 burst error correcting capability code...
So the problem is in the below DECODER which uses "error trapping decoding" concept.
Code:
entity dec1 is
port(b1:in std_logic_vector(34 downto 0);clk:in std_logic;
d
ut std_logic_vector(26 downto 0));
end dec1;
architecture Behavioral of dec1 is
begin
process(clk,b1)
variable br:std_logic_vector(34 downto 0);
variable temp1,s:std_logic_vector(7 downto 0):="00000000";
begin
if(clk'event and clk='1') then
for i in 0 to 34 loop
s(7):=b1(i) xor temp1(0);
s(6):=s(7) xor temp1(7);
s(5):=temp1(6);
s(4):=temp1(5) xor s(7);
s(3):=temp1(4);
s(2):=s(7) xor temp1(3);
s(1):=s(7) xor temp1(2);
s(0):=temp1(1);
temp1 := s;
br(i):=b1(i);
end loop;
for j in 0 to 34 loop
s(7):= temp1(0);
s(6):=s(7) xor temp1(7);
s(5):=temp1(6);
s(4):=temp1(5) xor s(7);
s(3):=temp1(4);
s(2):=s(7) xor temp1(3);
s(1):=s(7) xor temp1(2);
s(0):=temp1(1);
temp1 := s;
if(j>=0 and j<=4 ) then
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
d<=br(26 downto 0);
exit;
end if;
end if;
if(j>=5 and j<=7 ) then
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
if(j=5) then
br(0):=(br(0)) xor s(2);
d<=br(26 downto 0);
exit;
elsif(j=6) then
br(0):=(br(0)) xor s(1);
br(1):=(br(1)) xor s(2);
d<=br(26 downto 0);
exit;
elsif(j=7) then
br(0):=(br(0)) xor s(0);
br(1):=(br(1)) xor s(1);
br(2):=(br(2)) xor s(2);
d<=br(26 downto 0);
exit;
end if;
end if;
end if;
if(j>=8 and j<=28 ) then
d(j-8 )<=br(j-8 );
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
d(j-7)<=br(j-7) xor s(0);
d(j-6)<=br(j-6) xor s(1);
d(j-5)<=br(j-5) xor s(2);
d(26 downto j-4)<=br(26 downto j-4);
exit;
end if;
end if;
if(j=29) then
d(21)<=br(21);
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
d(22)<=br(22) xor s(0);
d(23)<=br(23) xor s(1);
d(24)<=br(24) xor s(2);
d(25)<=br(25);
d(26)<=br(26);
exit;
end if;
end if;
if(j=30) then
d(22)<=br(22);
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
d(23)<=br(23) xor s(0);
d(24)<=br(24) xor s(1);
d(25)<=br(25) xor s(2);
d(26)<=br(26);
exit;
end if;
end if;
if(j=31) then
d(23)<=br(23);
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
d(24)<=br(24) xor s(0);
d(25)<=br(25) xor s(1);
d(26)<=br(26) xor s(2);
exit;
end if;
end if;
if(j=32) then
d(24)<=br(24);
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
d(25)<=br(25) xor s(0);
d(26)<=br(26) xor s(1);
exit;
end if;
end if;
if(j=33) then
d(25)<=br(25);
if((s(7) or s(6) or s(5) or s(4) or s(3))='0') then
d(26)<=br(26) xor s(0);
exit;
end if;
end if;
if(j=34) then
d(26)<=br(26);
end if;
end loop;
end if;
end process;
end Behavioral;
"Now the problem is ...if I give a particular signal as input it will give the output(27 bits) same as input(the right most 27bits of 35bits) but when I want to give error in input which should give the corrected output, it is giving the signal with error itself."