n_bit_demux

G

Gietek

Guest
Hi,
I try this:

entity demultiplex is
generic(N :integer := 4);
port(X :in bit;
Sel :integer range 0 to N-1;
Y :eek:ut bit_vector(N-1 downto 0));
end demultiplex;

architecture dataflow of demultiplex is
begin
Y <= (Sel => X, others => '0');
end dataflow;
but it does an error:

Y <= (Sel => X, others => '0');
|
non-locally static or null range choice must be only choice
 
but it does an error:

Y <= (Sel => X, others => '0');
|
non-locally static or null range choice must be only choice
This will work

process
begin
Y <= (others=>'0');
Y(sel) <= X;
end process;

Egbert Molenkamp
 
Gietek a écrit:
Hi,
I try this:

entity demultiplex is
generic(N :integer := 4);
port(X :in bit;
Sel :integer range 0 to N-1;
Y :eek:ut bit_vector(N-1 downto 0));
end demultiplex;

architecture dataflow of demultiplex is
begin
Y <= (Sel => X, others => '0');
end dataflow;

but it does an error:

Y <= (Sel => X, others => '0');
|
non-locally static or null range choice must be only choice
I suggested not so long ago but I hadn't tested it. It seems this is not
allowed. Use a process instead:

process (X, Sel)
begin
Y <= (others => '0');
Y(Sel) <= X;
end process;

(this works, I used it many times)

Nicolas
 
Gietek <gientke@wp.pl> wrote in message news:<3FD5AC90.2070104@wp.pl>...
Hi,
I try this:

entity demultiplex is
generic(N :integer := 4);
port(X :in bit;
Sel :integer range 0 to N-1;
Y :eek:ut bit_vector(N-1 downto 0));
end demultiplex;

architecture dataflow of demultiplex is
begin
Y <= (Sel => X, others => '0');
end dataflow;

but it does an error:

Y <= (Sel => X, others => '0');
|
non-locally static or null range choice must be only choice
Gietek, try this:

architecture dataflow of demultiplex is
begin
p : process( sel )
begin
for i in 0 to N - 1 loop
if i = sel then
Y( i ) <= X;
else
Y( i ) <= '0';
end if;
end loop;
end process;
end;

Charles
 
Gietek, try this:

architecture dataflow of demultiplex is
begin
p : process( sel )
begin
for i in 0 to N - 1 loop
if i = sel then
Y( i ) <= X;
else
Y( i ) <= '0';
end if;
end loop;
end process;
end;

Thank, this works. I mean compilation and simulation was successful on
Altera Max2plus. But here I work on Cadence and SimVision doesn't
simulate it. Bits and bit_vectors waveforms are unknown - "???"

 

Welcome to EDABoard.com

Sponsor

Back
Top