maheyadav333
Member level 1
why this function show the syntex error during compilation ?
# ** Error: C:/Users/user/Desktop/function bilbo/bilbo reg func.vhd(1): near "function": syntax error
function bilbo_reg (Si, b1 ,b2: std_logic;
Z: std_logic_vector(7 downto 0);
Q: std_logic_vector(7 downto 0))
return std_logic_vector is
variable FB: std_logic;
variable mode: std_logic_vector(1 downto 0);
begin
FB <= Q(1) xor Q(2) xor Q(3) xor Q(7) ;
mode := B1 & B2;
case mode is
when "00" => -- Shift register mode
Q <= Si & Q(1 to NBITS-1);
when "01" => -- Pseudo Random Pattern Generator mode
Q <= FB & Q(1 to NBITS-1);
when "10" => -- Normal Operating mode
Q <= Z;
when "11" => -- Multiple Input Signature Register mode
Q <= Z(7 downto 0) xor (FB & Q(7 downto 1));
when others =>
end case;
return Q;
end bilbo_reg;
# ** Error: C:/Users/user/Desktop/function bilbo/bilbo reg func.vhd(1): near "function": syntax error
function bilbo_reg (Si, b1 ,b2: std_logic;
Z: std_logic_vector(7 downto 0);
Q: std_logic_vector(7 downto 0))
return std_logic_vector is
variable FB: std_logic;
variable mode: std_logic_vector(1 downto 0);
begin
FB <= Q(1) xor Q(2) xor Q(3) xor Q(7) ;
mode := B1 & B2;
case mode is
when "00" => -- Shift register mode
Q <= Si & Q(1 to NBITS-1);
when "01" => -- Pseudo Random Pattern Generator mode
Q <= FB & Q(1 to NBITS-1);
when "10" => -- Normal Operating mode
Q <= Z;
when "11" => -- Multiple Input Signature Register mode
Q <= Z(7 downto 0) xor (FB & Q(7 downto 1));
when others =>
end case;
return Q;
end bilbo_reg;