Which std logic code is better ?

Status
Not open for further replies.

vlsi_freak

Full Member level 2
Joined
Sep 3, 2007
Messages
127
Helped
14
Reputation
28
Reaction score
8
Trophy points
1,298
Activity points
2,041
Which one would you use and why?

I vote for the first method???


signal a_sig : std_logic_vector(n downto 0);
signal b_sig : std_logic_vector(n downto 0);

process(a_sig,bsig)
variable c_sig : std_logic_vector(n downto 0);
begin
c_sig := a_sig-bsig;
a_is_smaller <= c_sig(c_sig'high);
end process;

process(a_sig,bsig)
variable c_sig : std_logic_vector(n downto 0);
begin
if(asig < bsig) then
a_is_smaller <= '1';
else
a_is_smaller <= '0';
end if;
end process;
 

Re: Which one is good

I think the answer to your question depens upon the synthesis tool that you use...the less than comparator might have less number of gates than the subractor... so i guess the second code will be better...
 

Re: Which one is good

First approch is just taking one substractor and second approch is taking comparator.

First approch is taking less combinational delay than second one. So I will also go for First approch.
 

Re: Which one is good

hi,

depends on synthesis tool.

thanx......
 

    vlsi_freak

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…