![]() |
|
|
|
#1 |
|
I've created a library of components to use in my designs.
Most of these components use "generic" widths. For example, a 2-to-1 mux takes two std_logic_vector(width-1 downto 0) inputs, and outputs one of them. My question is as follows: Is there a more generic way to describe this so that the inputs can be std_logic? XST doesn't seem to like std_logic_vector(0 downto 0). Or, do I have to do what I have been doing, and define one component for std_logic, and one for std_logic_vector? Thanks, Adam The Weiss Family |
|
|
|
|
#2 |
|
Posts: n/a
|
On Thu, 5 Aug 2004 19:51:51 -0700, "The Weiss Family"
<> wrote: >I've created a library of components to use in my designs. >Most of these components use "generic" widths. > >For example, a 2-to-1 mux takes two std_logic_vector(width-1 downto 0) >inputs, and outputs one of them. >My question is as follows: > >Is there a more generic way to describe this so that the inputs can be >std_logic? >XST doesn't seem to like std_logic_vector(0 downto 0). XST handles this just fine. svl <= sl; or svl(0 downto 0) <= sl; won't work, as you are trying to assign signals of different type. This is illegal VHDL, and won't work in any proper VHDL tool, not just XST. Your simulator, for example, wouldn't compile this either. BTW, any reasonable design flow involves simulation before synthesis. OTOH, svl(0) <= sl, will work fine, as the *elements* of the std_logic_vector have the right type. >Or, do I have to do what I have been doing, and define one component for >std_logic, and one for std_logic_vector? No, one copy, using std_logic_vector, is all you need. Regards, Allan. Allan Herriman |
|
|
|
#3 |
|
Posts: n/a
|
> I've created a library of components to use in my designs.
> Most of these components use "generic" widths. > > For example, a 2-to-1 mux takes two std_logic_vector(width-1 downto 0) > inputs, and outputs one of them. An alternate solution would be to use a subprogram. Subprograms are overloadable. You can also use an unconstrained array. A function works well for this as then you could write: Y <= Mux2(Sel1, A, B) and Mux2(Sel2, C, D) ; Cheers, Jim -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ Jim Lewis Director of Training private.php?do=newpm&u= SynthWorks Design Inc. http://www.SynthWorks.com 1-503-590-4787 Expert VHDL Training for Hardware Design and Verification ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ Jim Lewis |
|
![]() |
| Thread Tools | Search this Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Dial-up Modem Question | w_tom | A+ Certification | 0 | 09-18-2005 09:12 PM |
| "Installing two drives" question - what next? | Jim | A+ Certification | 12 | 08-07-2005 01:19 PM |
| Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good | God | DVD Video | 3 | 04-25-2005 04:19 PM |
| Re: Good morning or good evening depending upon your location. I want to ask you the most important question of your life. Your joy or sorrow for all eternity depends upon your answer. The question is: Are you saved? It is not a question of how good | Filthy Mcnasty | DVD Video | 0 | 04-25-2005 04:29 AM |
| Re: Safe Mode Question (A+ question) | Gordon Findlay | A+ Certification | 0 | 06-16-2004 10:48 AM |