trouble connecting an out std_logic_vector port to aggregate

I

ihk

Guest
Hello,

Can a VHDL guru help me explaining why for a component defined like
this

component nios is
port (
pio_in : in std_logic_vector(15 downto 0),
pio_out : out std_logic_vector(7 downto 0)
);

I can do the following assignment:

nios_1 : nios
port map (
pio_in => (
0 => pll_locked,
1 => pll_clkswitch,
others => '0')
);

but the following gives syntax error (in Altera Quartus)

nios_1 : nios
port map (
pio_out => (
0 => led1,
1 => led2,
others => open)
);

The only way I can make this works is if I do the assignment to
pio_out like this:
nios_1 : nios
port map (
pio_out(0) => led1,
pio_out(1) => led2
);


Thanks and best regards,
Ivo
 
Not beeing a guru, I should perhaps not attempt an answer...
(Gurus usually have several limo's, I don't)

I have been bitten by similar issues before, portmaps
where parts of a vector should connect, others stay open, etc.

I think this is an effect of the language trying to limit
the missuses rather than to allow non-precise statements
to be accepted. Or perhaps it's some vendors non-compliance
to the standard.

Your solution seems pretty clean and expressive, your
problem was probably getting the compiler to accept the code.

When I struggled with this, I got some informative compile
errors from the simulator (modelsim or riviera, can't remember witch).

HTH -- Pontus

On 1 Sep, 10:48, ihk <ivokassama...@gmail.com> wrote:
Hello,

Can a VHDL guru help me explaining why for a component defined like
this

component nios is
   port (
       pio_in   : in  std_logic_vector(15 downto 0),
       pio_out : out std_logic_vector(7 downto 0)
);

I can do the following assignment:

nios_1 : nios
   port map (
       pio_in   => (
                0           => pll_locked,
                1           => pll_clkswitch,
                others      => '0')
  );

but the following gives syntax error (in Altera Quartus)

nios_1 : nios
   port map (
       pio_out   => (
                0           => led1,
                1           => led2,
                others    => open)
  );

The only way I can make this works is if I do the assignment to
pio_out like this:
nios_1 : nios
   port map (
       pio_out(0)  => led1,
       pio_out(1)  => led2
  );

Thanks and best regards,
Ivo
 
On 01/09/11 09:48, ihk wrote:
Hello,

Can a VHDL guru help me explaining why for a component defined like
this

component nios is
port (
pio_in : in std_logic_vector(15 downto 0),
pio_out : out std_logic_vector(7 downto 0)
);

I can do the following assignment:

nios_1 : nios
port map (
pio_in => (
0 => pll_locked,
1 => pll_clkswitch,
others => '0')
);

but the following gives syntax error (in Altera Quartus)

nios_1 : nios
port map (
pio_out => (
0 => led1,
1 => led2,
others => open)
);
As far as I remember that's just not legal. You can't say others =>
open. But I'll have to look at the standard to be really sure.

The only way I can make this works is if I do the assignment to
pio_out like this:
nios_1 : nios
port map (
pio_out(0) => led1,
pio_out(1) => led2
);
If I recall correctly, that's illegal in VHDL93, but legal in VHDL87.
In VHDL 93 the standard was modified to say that if you map parts of a
vector, you either have to do associate all elements, or leave all
elements open. I.e. not a mixture.

regards
Alan


--
Alan Fitch
 

Welcome to EDABoard.com

Sponsor

Back
Top