![]() |
|
|
|
#1 |
|
Hi,
I try this: >entity demultiplex is > generic(N :integer := 4); > port(X :in bit; > Sel :integer range 0 to N-1; > Y >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 |
|
|
|
|
#2 |
|
Posts: n/a
|
> 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 Egbert Molenkamp |
|
|
|
#3 |
|
Posts: n/a
|
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 > >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 Nicolas Matringe |
|
|
|
#4 |
|
Posts: n/a
|
Gietek <> wrote in message news:<>...
> Hi, > I try this: > > >entity demultiplex is > > generic(N :integer := 4); > > port(X :in bit; > > Sel :integer range 0 to N-1; > > Y > >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 Charles M. Elias |
|
|
|
#5 |
|
Posts: n/a
|
Egbert Molenkamp wrote:
> > This will work Not quite! The sensitivity list is missing. > process process(x, sel) > begin > Y <= (others=>'0'); > Y(sel) <= X; > end process; Paul. Paul Uiterlinden |
|
|
|
#6 |
|
Posts: n/a
|
> > 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 - "???" > > Charles Gietek |
|