Abhijith Yadav
Junior Member level 3
- Joined
- May 19, 2012
- Messages
- 28
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Location
- Kozhikode, India
- Activity points
- 1,653
Hey people,
I am working on viterbi decoding in vhdl. I am using altera quartusII 6.0. I am posting the code and the problem, please help me rectifyy ut
the code for viterbi_table
code for A,B,C,D:
data package :
- - - Updated - - -
The errors are as follows
Error (10500): VHDL syntax error at Viterbi_decode.vhd(105) near text "generate"; expecting "loop"
Error (10500): VHDL syntax error at Viterbi_decode.vhd(114) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(114) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(115) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(115) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(116) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(116) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(117) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(117) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(118) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(118) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(122) near text "if"; expecting "process"
- - - Updated - - -
In addition to that, I have a query.. is it wrong to use component instantiation inside a process or a conditional loop
I am working on viterbi decoding in vhdl. I am using altera quartusII 6.0. I am posting the code and the problem, please help me rectifyy ut
Code:
library ieee;
library work;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_1164.all;
use work.data_packages.all;
entity viterbi_decode is
port (path_calc: buffer statehist_data;
enc_data : in std_logic_vector(1 downto 0);
clock : in std_logic;
xor_out : buffer output_data;
pm : buffer pmetric;
path : buffer statehist_data;
pathfinal: out std_logic_vector(14 downto 0));
end viterbi_decode;
architecture func of viterbi_decode is
component A is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricA : buffer integer range 0 to 1023;
pm : out pmetric);
end component;
component B is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricB : buffer integer range 0 to 1023;
pm : out pmetric);
end component;
component C is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricC : buffer integer range 0 to 1023;
pm : out pmetric);
end component;
component D is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricD : buffer integer range 0 to 1023;
pm : out pmetric);
end component;
component viterbi_table is
port(bm :buffer bmetric;
enc_data :in std_logic_vector(1 downto 0);
xor_out :buffer output_data);
end component;
signal ct: integer range 0 to 20:=0;
begin
--path_calc<=path;
process(xor_out,ct,clock,path,enc_data)
begin
if(rising_edge(clock)) then
path_calc<=path;
ct<=ct+1;
if(ct=1) then
xor_out(0)<=enc_data xor "00";
xor_out(1)<=enc_data xor "11";
path(2)(14 downto 0)<=path(0)(13 downto 0);
path(2)(0)<='1';
for i in 0 to 1 loop
if (xor_out(0)(i)=1) then
pm(0)<=pm(0)+1;
end if;
if (xor_out(1)(i)=1) then
pm(2)<=pm(2)+1;
end if;
end loop;
elsif(ct+2) then
xor_out(0)<=enc_data xor "00";
xor_out(1)<=enc_data xor "11";
xor_out(4)<=enc_data xor "10";
xor_out(5)<=enc_data xor "01";
path(1)(14 downto 1)<=path(2)(13 downto 0);
path(1)(0)<='0';
path(3)(14 downto 1)<=path(2)(13 downto 0);
path(3)(0)<='1';
path(2)(14 downto 1)<=path(0)(13 downto 0);
path(2)(0)<='1';
for i in 0 to 1 loop
if ( xor_out(0)(i)='1') then
pm(0)<=pm(0)+1;
end if;
if ( xor_out(1)(i)='1') then
pm(1)<=pm(1)+1;
end if;
if ( xor_out(4)(i)='1') then
pm(1)<=pm(4)+1;
end if;
if ( xor_out(5)(i)='1') then
pm(5)<=pm(5)+1;
end if;
end loop;
end if;
viterbi: for ct in 2 to 15 generate
bm(0)<=pm(0);
bm(1)<=pm(0);
bm(2)<=pm(1);
bm(3)<=pm(1);
bm(4)<=pm(2);
bm(5)<=pm(2);
bm(6)<=pm(3);
bm(7)<=pm(3);
Table: Viterbi_table port map(bm,enc_data,xor_out);
atA: A port map(xor_out,path,bm,pm(0),pm);
atB: B port map(xor_out,path,bm,pm(1),pm);
atC: C port map(xor_out,path,bm,pm(2),pm);
atD: D port map(xor_out,path,bm,pm(3),pm);
end generate;
ct<=0;
end if;
end if;
end process;
end func;
the code for viterbi_table
Code:
library ieee;
library work;
use work.data_packages.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
entity viterbi_table is
port(bm :buffer bmetric;
enc_data :in std_logic_vector(1 downto 0);
xor_out :buffer output_data);
end viterbi_table;
architecture func of viterbi_table is
signal output:output_data;
begin
output(0)<="00";
output(1)<="11";
output(2)<="11";
output(3)<="00";
output(4)<="10";
output(5)<="01";
output(6)<="01";
output(7)<="10";
process(enc_data,output,xor_out,bm)
begin
for i in 0 to 7 loop
xor_out(i)<=enc_data xor output(i);
for j in 0 to 1 loop
if ( xor_out(i)(j)='1') then
bm(i)<=bm(i)+1;
end if;
end loop;
end loop ;
end process;
end func;
code for A,B,C,D:
Code:
library ieee;
library work;
use work.data_packages.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_1164.all;
entity A is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricA : buffer integer range 0 to 1023;
pm : out pmetric);
end A;
architecture func of A is
signal pmetric_calc: metric_calc;
signal path_calc : statehist_data;
begin
path_calc(0)<=path(0);
path_calc(1)<=path(1);
path_calc(2)<=path(2);
path_calc(3)<=path(3);
process(pmetric_calc,bm,path_calc,pathmetricA)
begin
pmetric_calc(0)<=pathmetricA+bm(0);
pmetric_calc(1)<=pathmetricA+bm(2);
if (pmetric_calc(0)<pmetric_calc(1)) then
pathmetricA<=pmetric_calc(0);
path(0)(14 downto 1)<=path_calc(0)(13 downto 0);
path(0)(0)<='0';
elsif(pmetric_calc(0)>pmetric_calc(1)) then
pathmetricA<=pmetric_calc(1);
path(0)(14 downto 1)<=path_calc(1)(13 downto 0);
path(0)(0)<='0';
end if;
end process;
end func;
Code:
library ieee;
library work;
use work.data_packages.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_1164.all;
entity B is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricB : buffer integer range 0 to 1023;
pm : out pmetric);
end B;
architecture func of B is
signal pmetric_calc: metric_calc;
signal path_calc : statehist_data;
begin
path_calc(0)<=path(0);
path_calc(1)<=path(1);
path_calc(2)<=path(2);
path_calc(3)<=path(3);
process(pmetric_calc,bm,path_calc,pathmetricB)
begin
pmetric_calc(0)<=pathmetricB+bm(4);
pmetric_calc(1)<=pathmetricB+bm(6);
if (pmetric_calc(0)<pmetric_calc(1)) then
pathmetricB<=pmetric_calc(0);
path(1)(14 downto 1)<=path_calc(1)(13 downto 0);
path(1)(0)<='0';
elsif(pmetric_calc(0)>pmetric_calc(1)) then
pathmetricB<=pmetric_calc(1);
path(1)(14 downto 1)<=path_calc(1)(13 downto 0);
path(1)(0)<='0';
end if;
end process;
end func;
Code:
library ieee;
library work;
use work.data_packages.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_1164.all;
entity C is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricC : buffer integer range 0 to 1023;
pm : out pmetric);
end C;
architecture func of C is
signal pmetric_calc: metric_calc;
signal path_calc : statehist_data;
begin
path_calc(0)<=path(0);
path_calc(1)<=path(1);
path_calc(2)<=path(2);
path_calc(3)<=path(3);
process(pmetric_calc,bm,path_calc,pathmetricC)
begin
pmetric_calc(0)<=pathmetricC+bm(1);
pmetric_calc(1)<=pathmetricC+bm(3);
if (pmetric_calc(0)<pmetric_calc(1)) then
pathmetricC<=pmetric_calc(0);
path(2)(14 downto 1)<=path_calc(2)(13 downto 0);
path(2)(0)<='1';
elsif(pmetric_calc(0)>pmetric_calc(1)) then
pathmetricC<=pmetric_calc(1);
path(2)(14 downto 1)<=path_calc(2)(13 downto 0);
path(2)(0)<='1';
end if;
end process;
end func;
Code:
library ieee;
library work;
use work.data_packages.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_1164.all;
entity D is
port (xor_out : buffer output_data;
path : buffer statehist_data;
bm : in bmetric;
pathmetricD : buffer integer range 0 to 1023;
pm : out pmetric);
end D;
architecture func of D is
signal pmetric_calc: metric_calc;
signal path_calc : statehist_data;
begin
path_calc(0)<=path(0);
path_calc(1)<=path(1);
path_calc(2)<=path(2);
path_calc(3)<=path(3);
process(pmetric_calc,bm,path_calc,pathmetricD)
begin
pmetric_calc(0)<=pathmetricD+bm(5);
pmetric_calc(1)<=pathmetricD+bm(7);
if (pmetric_calc(0)<pmetric_calc(1)) then
pathmetricD<=pmetric_calc(0);
path(3)(14 downto 1)<=path_calc(3)(13 downto 0);
path(3)(0)<='1';
elsif(pmetric_calc(0)>pmetric_calc(1)) then
pathmetricD<=pmetric_calc(1);
path(3)(14 downto 1)<=path_calc(3)(13 downto 0);
path(3)(0)<='1';
end if;
end process;
end func;
data package :
Code:
library ieee;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
package data_packages is
type statenew_data is array(7 downto 0) of std_logic_vector(1 downto 0);
type statehist_data is array(3 downto 0) of std_logic_vector(14 downto 0);
type state_data is array(7 downto 0) of std_logic_vector(1 downto 0);
type output_data is array(7 downto 0) of std_logic_vector(1 downto 0);
type bmetric is array(7 downto 0) of integer range 0 to 2;
type pmetric is array(3 downto 0) of integer range 0 to 1023;
type metric_calc is array(1 downto 0) of integer range 0 to 1023;
end;
- - - Updated - - -
The errors are as follows
Error (10500): VHDL syntax error at Viterbi_decode.vhd(105) near text "generate"; expecting "loop"
Error (10500): VHDL syntax error at Viterbi_decode.vhd(114) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(114) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(115) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(115) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(116) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(116) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(117) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(117) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(118) near text "port"; expecting "(", or "'", or "."
Error (10500): VHDL syntax error at Viterbi_decode.vhd(118) near text ";"; expecting ":=", or "<="
Error (10500): VHDL syntax error at Viterbi_decode.vhd(122) near text "if"; expecting "process"
- - - Updated - - -
In addition to that, I have a query.. is it wrong to use component instantiation inside a process or a conditional loop