Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Having trouble with VHDL syntax, can anyone help me please. New to forum and VHDL.

Status
Not open for further replies.

solely_magnus

Newbie level 3
Newbie level 3
Joined
Oct 21, 2014
Messages
4
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Visit site
Activity points
35
these are the error messages, i don't know how to fix them.

** Error: //ads.bris.ac.uk/filestore/MyFiles/StudentUG14/aa14244/Documents/SDR Lab/shifter/shiftd.vhd(46): near "else": expecting "END"
** Error: //ads.bris.ac.uk/filestore/MyFiles/StudentUG14/aa14244/Documents/SDR Lab/shifter/shiftd.vhd(52): VHDL Compiler exiting




Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
library ieee;
 
use ieee.std_logic_1164.all;
 
--additional functionality of being able to shift both up and down
--DIRUP=’1’ then DIN will shift into the least significant bit Y(0)
-- If DIRUP=’0’ then DIN will shift into the most significant bit Y(7)
 
 
 
entity shiftd is
    port (
        din : in std_logic; -- DATA IN
        en : in std_logic; -- CHIP ENABLE
        clk : in std_logic; -- CLOCK
        y : out std_logic_vector(7 downto 0); -- SHIFTER OUTPUT
        dirup : in std_logic); -- SHIFT DIRECTION
end shiftd;
 
architecture shiftd_arch of shiftd is
 
--SIGNALS
signal s_register : std_logic_vector (7 downto 0); --REGISTER CONTENTS
begin
 
--PROCESS : SHIFT
shift : process (clk)
begin
    if rising_edge(clk) and en='1' then -- FULLY SYNCHRONOUS AND ENABLED
      
      if (dirup = '0') then
        for i in 7 downto 1 loop
          s_register(i) <= s_register(i-1); -- SHIFT ALL BITS UP 1
        end loop;
        s_register(0) <= din;  -- INSERT DATA BIT IN LSB
              
      else if (dirup = '1') then 
        for j in 1 to 7 loop 
          s_register(j-1) <= s_register(j); -- SHIFT ALL BITS DOWN 1
        end loop;
        s_register(7) <= din;  -- INSERT DATA BIT IN LSB        
      else null;
            
      end if;         
          
    else null; --else null for original if statement
    end if; --for original if statement
end process;
 
y <= s_register; -- WRITE REGISTER CONTENTS TO OUTPUT
 
end shiftd_arch;

 
Last edited by a moderator:

thank you but why is this what is the difference between
HTML:
else if
and
HTML:
elsif
 

The question demands for VHDL text book or language reference literature, I think.

else if opens a new if ... else ... end if level which must be closed by a terminating end if. But you don't have it in your code.
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top