0
library ieee;
use ieee.std_logic_1164.all;

entity basic_shift_register_with_multiple_taps is

    generic
    (
        DATA_WIDTH : natural := 8
    
    );

    port 
    (
        clk          : in std_logic;
        enable       : in std_logic;
        sr_one       : in std_logic_vector((DATA_WIDTH-1) downto 0);
        sr_two       : in std_logic_vector((DATA_WIDTH-1) downto 0);
        sr_out       : out std_logic_vector(2*(DATA_WIDTH-1) downto 0)
    );

end entity ;

architecture rtl of basic_shift_register_with_multiple_taps is

    
    signal sig_out  :std_logic_vector(2*(DATA_WIDTH-1) downto 0);
    variable count  : integer := 0;
    variable count1 : integer := 0;
    
begin
    
    process (clk,enable,sr_one,sr_two,sig_out)
    
    begin
    
        if(enable = '0' or count = 16) then 
            count := 0;
            count1 := 0;
        else if (clk'event and clk='1') then
            sig_out(count) <= sr_one(count1);
            
            count := count + 1;
        
        else --if (clk'event and clk='0') then--
            sig_out(count) <= sr_two(count1);
            count := count + 1;
            
        end if;
        
        count1 := count1 + 1;   
        
        
(54)    end process;

    sr_out <= sig_out;

(58) end rtl;

errors:

Error (10500): VHDL syntax error at teste.vhd(54) near text "process"; expecting "if"

Error (10500): VHDL syntax error at teste.vhd(58) near text "rtl"; expecting "if"

1
  • 2
    It's complaining about a missing "end if". My guess is you don't have a VHDL syntax guide handy so you guessed how o spell "elsif" and missed. Commented Jan 10, 2017 at 11:20

1 Answer 1

1

Your problem is that your second if statement

if (clk'event and clk='1') then

has no end if associated with it. So, when the compiler gets to line 54, it encounters an end process before the end if it was expecting. Instead of this

if(enable = '0' or count = 16) then 
    count := 0;
    count1 := 0;
else if (clk'event and clk='1') then
    sig_out(count) <= sr_one(count1);

    count := count + 1;

else --if (clk'event and clk='0') then--
    sig_out(count) <= sr_two(count1);
    count := count + 1;

end if;

do this:

if(enable = '0' or count = 16) then 
    count := 0;
    count1 := 0;
else
    if (clk'event and clk='1') then
        sig_out(count) <= sr_one(count1);
        count := count + 1;
    else --if (clk'event and clk='0') then--
        sig_out(count) <= sr_two(count1);
        count := count + 1;
    end if;
end if;

However, if you are intending to synthesis this, your syntax error is the least of your worries. See this answer.

Sign up to request clarification or add additional context in comments.

1 Comment

@MatheusSasso As I said, you need to look at this answer. You have describe behaviour that is not synthesisable. A logic synthesiser's job is to think of a circuit that behaves like you code. It cannot do this. Nor can I. You have described behaviour that cannot be implemented using combinational logic and D-type flip-flops. The error messages in your other question tell you what this behaviour is. So, you need to change your code as in the link I posted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.