vhdl generate statement omit

Discussion in 'VHDL' started by thedarkness, May 7, 2010.

  1. thedarkness

    thedarkness

    Joined:
    May 7, 2010
    Messages:
    2
    Hello everyone,
    I'm trying to create a byte comparator using single bit cascadable comparators with generate statement.

    Code used:
    "entity comparator_byte is
    generic(n_bit:integer : = 8);
    port(a,b: in bit_vector(n_bit-1 downto 0); gt,eq,lt: in bit; a_gt_b,a_eq_b,a_lt_b: out bit);
    end comparator_byte;

    architecture comparator_byte_ar of comparator_byte is

    component bit_comp port(a,b,gt,eq,lt: in bit; a_gt_b,a_eq_b,a_lt_b: out bit); end component;

    for all: bit_comp use entity work.bit_comparator(bit_comparator_ar);

    signal tmp: bit_vector((n_bit-1)*3-1 downto 0);

    begin

    bit0: bit_comp port map(a(0),b(0),gt,eq,lt,tmp(0),tmp(1),tmp(2));

    gen_stat: for i in 1 to n_bit-2 generate
    begin

    bit_rest: bit_comp port map(a(i),b(i),tmp(i*3-3),tmp(i*3-2),tmp(i*3-1),
    tmp(i*3),tmp(i*3+1),tmp(i*3+2));

    end generate gen_stat;

    bit_last: bit_comp port map(a(n_bit-1),b(n_bit-1),tmp((n_bit-1)*3-3),tmp((n_bit-1)*3-2),
    tmp((n_bit-1)*3-1),a_gt_b,a_eq_b,a_lt_b);

    end comparator_byte_ar;"

    When I try to execute it with ghdl, the elaborate session (ghdl -e) gives me this warnings:
    "comparator_byte.vhdl:21:16:warning: component instance "bit_rest" is not bound
    comparator_byte.vhdl:6:14:warning: (in default configuration of comparator_byte(comparator_byte_ar))"

    and the code in generate statement is completely omit.
    How can I resolve this problem? Thanks.
     
    Last edited: May 8, 2010
    thedarkness, May 7, 2010
    #1
    1. Advertising

  2. thedarkness

    joris

    Joined:
    Jan 29, 2009
    Messages:
    152
    Trying with ghdl... I'm not sure whether it's "correct" behavior, but it does work if you use,

    Code:
    component bit_comparator port(a,b,gt,eq,lt: in bit; a_gt_b,a_eq_b,a_lt_b: out bit); end component;
    
    for all: bit_comparator use entity work.bit_comparator(bit_comparator_ar);
    
    -- ...
    
    bit0: bit_comparator port map(a(0),b(0),gt,eq,lt,tmp(0),tmp(1),tmp(2));
    
    That is, using the actual name of the entity, instead of a pseudonym
     
    joris, May 8, 2010
    #2
    1. Advertising

  3. thedarkness

    thedarkness

    Joined:
    May 7, 2010
    Messages:
    2
    It works!!! Thank you very much!!!!:D
     
    thedarkness, May 9, 2010
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Troy
    Replies:
    1
    Views:
    366
    S. Justin Gengo
    Aug 26, 2003
  2. hellrazor
    Replies:
    2
    Views:
    651
    hellrazor
    May 17, 2004
  3. RB

    How to omit a header?

    RB, Jul 1, 2003, in forum: C Programming
    Replies:
    1
    Views:
    713
    Thomas Matthews
    Jul 1, 2003
  4. STF
    Replies:
    6
    Views:
    475
    seak.tf@gmail.com
    Jun 24, 2005
  5. tony@donotspamme.ar
    Replies:
    2
    Views:
    326
    Thomas Tutone
    Aug 24, 2006
Loading...

Share This Page