comparator

Status
Not open for further replies.

avc

Newbie level 1
Joined
Jan 23, 2013
Messages
0
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,280
Activity points
1,280
while designing a floating point comparator i get one errror like dis.
ERROR:HDLParsers:164 - "D:/comp/comp.vhd" Line 77. parse error, unexpected PROCESS, expecting IF

can any one tell how to solve dis error.????

the code is as below:

library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity compare is
port( opcode: in std_logic_vector (8 downto 0);
destaddress:in std_logic_vector (4 downto 0);
clk: in std_logic;
fa_sign : in std_logic;
fb_sign: in std_logic;
fa_mantissa: in std_logic_vector (7 downto 0);
fb_mantissa: in std_logic_vector (7 downto 0);
fa_exp:in std_logic_vector (22 downto 0);
fb_exp:in std_logic_vector (22 downto 0);
alessb : out std_logic;
aequalb : out std_logic;
agreaterb : out std_logic;
unordered : out std_logic);
end compare;

architecture rtl of compare is
begin
process(clk,fa_sign,fb_sign,fa_exp,fb_exp,fa_mantissa,fb_mantissa)
begin
if clk'event and clk='1' then
if opcode = "000000000" then
if (fa_sign > fb_sign) then
alessb<= '1';
aequalb <= '0';
agreaterb <= '0';
unordered<= '0';
elsif (fa_sign < fb_sign) then
alessb<= '0';
aequalb <= '0';
agreaterb <= '1';
unordered<= '0';
if (fa_sign = fb_sign) then
if (fa_exp> fb_exp) then
alessb<= '0';
aequalb <= '0';
agreaterb <= '1';
unordered<= '0';
elsif (fa_exp< fb_exp) then
alessb<= '1';
aequalb <= '0';
agreaterb <= '0';
unordered<= '0';
if (fa_exp= fb_exp) then
if (fa_mantissa > fb_mantissa) then
alessb<= '0';
aequalb <= '0';
agreaterb <= '1';
unordered<= '0';
elsif (fa_mantissa < fb_mantissa) then
alessb<= '1';
aequalb <= '0';
agreaterb <= '0';
unordered<= '0';
end if;
end process;
end rtl;
 

you have

Code VHDL - [expand]
1
end compare;


you should have:

Code VHDL - [expand]
1
end entity compare;

 

still that error is there...
ERROR:HDLParsers:164 - "D:/comp/comp.vhd" Line 77. parse error, unexpected PROCESS, expecting IF
 

Okay, I see the problem I didn't reformat the code and just look for the first error I could find. You've left off all the end if statements throughout the code.

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
53
54
55
56
57
58
59
60
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
entity compare is
port(    opcode: in std_logic_vector (8 downto 0);
destaddress:in std_logic_vector (4 downto 0);
clk: in std_logic;
fa_sign : in std_logic;
fb_sign: in std_logic;
fa_mantissa: in std_logic_vector (7 downto 0);
fb_mantissa: in std_logic_vector (7 downto 0);
fa_exp:in std_logic_vector (22 downto 0);
fb_exp:in std_logic_vector (22 downto 0);
alessb : out std_logic; 
aequalb : out std_logic; 
agreaterb : out std_logic;
unordered : out std_logic);
end entity compare;
 
architecture rtl of compare is
begin
process(clk,fa_sign,fb_sign,fa_exp,fb_exp,fa_mantissa,fb_mantissa)
begin
  if clk'event and clk='1' then 
    if opcode = "000000000" then
      if (fa_sign > fb_sign) then
        alessb<= '1'; 
        aequalb <= '0';
        agreaterb <= '0';
        unordered<= '0';
      elsif (fa_sign < fb_sign) then
        alessb<= '0'; 
        aequalb <= '0';
        agreaterb <= '1';
        unordered<= '0';
        if (fa_sign = fb_sign) then
          if (fa_exp> fb_exp) then
            alessb<= '0'; 
            aequalb <= '0';
            agreaterb <= '1';
            unordered<= '0';
          elsif (fa_exp< fb_exp) then
            alessb<= '1'; 
            aequalb <= '0';
            agreaterb <= '0';
            unordered<= '0';
            if (fa_exp= fb_exp) then
              if (fa_mantissa > fb_mantissa) then
                alessb<= '0'; 
                aequalb <= '0';
                agreaterb <= '1';
                unordered<= '0';
              elsif (fa_mantissa < fb_mantissa) then 
                alessb<= '1'; 
                aequalb <= '0';
                agreaterb <= '0';
                unordered<= '0';
-- lots of missing end if; statements if this is your intention.
    end if;
  end process;
end rtl;

 

where you have if (a = b) then, I think you really want just an else
 

also you don't define what to do with fa_mantissa = fb_mantissa
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…