P
Pasacco
Guest
hi all
I need some help for making generic VHDL. Problem is following.
Design module has input port X, output port Y, and internal control
signal C, with following type.
X : array (0 to 2) of std_logic_vector (1 downto 0);
Y : array (0 to 2) of std_logic_vector (1 downto 0);
C : array (0 to 2) of std_logic_vector (1 downto 0);
Output 'Y' is determined by control signal 'C' and input 'X'.
For example,
consider possible cases for 'C' are only C(0)="00", C(0)="01",
C(1)="01", C(2)="10".
Y(0) <= X(0) when C(0) is "00"
Y(0) <= X(1) when C(0) is "01"
Y(1) <= X(1) when C(1) is "01"
Y(2) <= X(2) when C(2) is "10"
In VHDL, I did it asynchronously and manually, depending on possible
'C' values.
Y( 0 ) <= X( 0 ) when C( 0 )="00" else
X( 1 ) when C( 0 )="01" else "00" ;
Y( 1 ) <= X( 1 ) when C( 1 )="01" else "00" ;
Y( 2 ) <= X( 2 ) when C( 2 )="10" else "00" ;
Then it works fine.
Problem is that I can not make thse VHDL descriptions "generic", when
possible values of 'C' are known.
For example, possible values C(1) are "00" and "01".
I don't want to use 3 MUXs to accomodate all possible cases.
Does someone has comment to do that ? Thankyou.
I need some help for making generic VHDL. Problem is following.
Design module has input port X, output port Y, and internal control
signal C, with following type.
X : array (0 to 2) of std_logic_vector (1 downto 0);
Y : array (0 to 2) of std_logic_vector (1 downto 0);
C : array (0 to 2) of std_logic_vector (1 downto 0);
Output 'Y' is determined by control signal 'C' and input 'X'.
For example,
consider possible cases for 'C' are only C(0)="00", C(0)="01",
C(1)="01", C(2)="10".
Y(0) <= X(0) when C(0) is "00"
Y(0) <= X(1) when C(0) is "01"
Y(1) <= X(1) when C(1) is "01"
Y(2) <= X(2) when C(2) is "10"
In VHDL, I did it asynchronously and manually, depending on possible
'C' values.
Y( 0 ) <= X( 0 ) when C( 0 )="00" else
X( 1 ) when C( 0 )="01" else "00" ;
Y( 1 ) <= X( 1 ) when C( 1 )="01" else "00" ;
Y( 2 ) <= X( 2 ) when C( 2 )="10" else "00" ;
Then it works fine.
Problem is that I can not make thse VHDL descriptions "generic", when
possible values of 'C' are known.
For example, possible values C(1) are "00" and "01".
I don't want to use 3 MUXs to accomodate all possible cases.
Does someone has comment to do that ? Thankyou.