| Author |
Message |
jene2in
Joined: 06 Aug 2008 Posts: 14
|
19 Aug 2008 19:24 programming help VHDL |
|
|
|
When I try to map components within a process, all the components are ignored and not recognized.
Is there some way to use components within a process?
|
|
| Back to top |
|
 |
avimit
Joined: 16 Nov 2005 Posts: 415 Helped: 68 Location: Fleet, UK
|
19 Aug 2008 21:12 Re: programming help VHDL |
|
|
|
You are not allowed to instantiate components inside a process. I wonder why you would like to do that.
Kr,
Avi
http://www.vlsiip.com
|
|
| Back to top |
|
 |
childs
Joined: 28 Apr 2008 Posts: 41 Helped: 2
|
20 Aug 2008 4:13 Re: programming help VHDL |
|
|
|
What error does it give you? What compiler u using? Can u show the code?
|
|
| Back to top |
|
 |
jene2in
Joined: 06 Aug 2008 Posts: 14
|
20 Aug 2008 5:19 Re: programming help VHDL |
|
|
|
well I understand that components cannot be instantiated in a process. I don't know if I can explain it better.
The algorithm I am trying to implement uses a while loop and within that loop uses a couple of components mostly division related. While coding with VHDL, I cannot use WHILE loop so I had to replace the WHILE loop with a clock and if statement. However, this doesn;t work as the components cannot be instantiated. This is part of the algorithm that am trying to implement. As you can see within the WHILE loop it uses some components like LSR, MSR which are rather big programs on division. I don't know how to replace the components if I have to replace the while loop with a clocked process~~
while P ≠ 0 do
if [a1a0] = 0 then A = A/4, U = LSR(U,M)
if D < 2 then
if D = 1 then P = P − 1
else P = P − 2
D = D − 2
elsif a0 = 0 then A = A/2, U = MSR (U,M)
if D < 1 then P = P − 1
D = D − 1
else
if ([a1a0] + [b1b0]) mod 4 = 0 then q = 1 else q = −1
if D ¸ 0 then A = (A + qB)/4, U = LSR(U + qV,M)
if D = 0 then P Ã P − 1
D = D − 1
else D = −D − 1, {A = (A + qB)/4, B = A}
{U = LSR(U + qV,M), V = U}
|
|
| Back to top |
|
 |
j_andr
Joined: 30 Mar 2008 Posts: 90 Helped: 15 Location: europe
|
20 Aug 2008 8:29 Re: programming help VHDL |
|
|
|
| jene2in wrote: |
The algorithm I am trying to implement uses a while loop and within
that loop uses a couple of components mostly division related/.../ |
I can not help you with vhdl description, but may be a genaral note
about hardware will be useful:
you have to instantiate all your computing unit 'unconditionaly'
and in "IF's" switch their inputs and/or outputs;
just as an illustrative example:
| Code: |
if [a1a0] = 0 then A = A/4, U = LSR(U,M)
elsif a0 = 0 then A = A/2, U = MSR (U,M) |
you need both units LSR and MSR implemented and in an
IF statemen choose what value is connected to U register;
something like:
| Code: |
lsr_out = LSR(x,y); msr_out = MSR(t,z);
/..../
if ( <...> ) U = lsr_out;
else U = msr_out; |
the same relates to inputs of a unit;
---
|
|
| Back to top |
|
 |
jene2in
Joined: 06 Aug 2008 Posts: 14
|
20 Aug 2008 8:46 programming help VHDL |
|
|
|
Thanks for your reply. It makes sense. I guess the next question would be the components are to be used in every loop till the condition is met and everytime the inputs to the components are updated from the previous loop, how do I update the inputs.
According to my knowledge your suggestion helps if there is just one iteration, but in the algorithm the components are used every loop with updated inputs. May be am missing something here!!!!!!!!!!
Thanks.
|
|
| Back to top |
|
 |
j_andr
Joined: 30 Mar 2008 Posts: 90 Helped: 15 Location: europe
|
20 Aug 2008 9:49 Re: programming help VHDL |
|
|
|
| jene2in wrote: |
| the next question would be/.../how do I update the inputs |
as usual - if I understand you correctly ...
< unit instantiation >
< signal unit_output declaration >
< process statement >
if/while < some conditions >
unit_output = unit(x,y);
else
unit_output = unit_output;
< end process >
<probably clocked process>
x [or y] = unit_output;
---
|
|
| Back to top |
|
 |
avimit
Joined: 16 Nov 2005 Posts: 415 Helped: 68 Location: Fleet, UK
|
20 Aug 2008 12:01 Re: programming help VHDL |
|
|
|
You can use vhdl functions insead of components, and then you can use those functions just like they are used in alogirhtm.
for example if a vhdl function is called MAX or MIN, then you can use these inside a process;
signal_a <= MAX(signal_b, signal_c, signal_d, signal_e)
|
|
| Back to top |
|
 |
jene2in
Joined: 06 Aug 2008 Posts: 14
|
20 Aug 2008 20:07 Re: programming help VHDL |
|
|
|
I will think about the reply by j_andr. Will try to work on it and see if this is wghat can be done.
ABout the functions, I can convert the components to functions but as I mentioned earlier my components are rather big programs with divider, adder components in it. So I am not sure if I can convert my components to functions as the components have other components within it.
I know it's rather confusing.
Thanks for all your replies.
|
|
| Back to top |
|
 |