EmbDev.net

Forum: FPGA, VHDL & Verilog c:= a/b Initialization in VHDL


Author: Raghavendra B. (raghavendra_b98)
Posted on:

Rate this post
0 useful
not useful
Hi all

How to initialize and use c:=a/b statment in VHDL.
Regards
Raghavendra

Author: Fetz (Guest)
Posted on:

Rate this post
0 useful
not useful
with "VARIABLE".

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
There is not enough information for a answer!
Pls. post ALL necessary information. Not only "why isn't it working?"

What is your actual problem?
What do you want to do?
What have you tried?
What does not work?
What warnings or errrors do you get?

Author: Raghavendra B. (raghavendra_b98)
Posted on:

Rate this post
0 useful
not useful
Thanks for your replies..
Hi Lothar Miller,
I try to do comparing 2 rationals numbers and display the number is max 
or min, for example a/b and c/d are 2 rational numbers i want to display
max :=a/b or c/d.

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
>  comparing 2 rationals numbers
Just for simulation? Or in real hardware?

> the number
What types are a...d?

> try to do comparing 2 rationals numbers and display the number is max
And how far did you get until now?
Show your first steps, report the problems you got, and then lets 
discuss ways to solve them.

Author: Raghavendra B. (raghavendra_b98)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Thanks...I attached my program.once i ran in GHDL simulator it gave 
error
"no function declarations for operator "/""

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
> "no function declarations for operator "/""
No corresponding line number?
Its VERY exhausting to worm every little facts out of you...  :-/

Author: Raghavendra B. (raghavendra_b98)
Posted on:

Rate this post
0 useful
not useful
Thanks for your intrest.

line number 67 and 69.

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
> line number 67 and 69.
Would it cost you much effort to post the complete lines of code.
This just because the code you posted has only 62 lines...   :-o

Author: Raghavendra B. (raghavendra_b98)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Sorry ..i attached my source code.
error -->  "no function declarations for operator "/"
error in line number --> 52 and 54

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
How can this fit together:
  type rational is array (natural range numer to denom) of integer; -- one dimension

  variable max : rational;

  max(w/x,y/z) := w/x; -- two dimensions?

However:
What happens, if you use additional variables like this
  function maxi(a,b,c,d:integer) return rational is
    variable w,x,y,z:integer;
    variable t1,t2:integer;
    variable max : rational;
  begin
    t1:=w*z;
    t2:=x*y;
    t3:=w/x;
    t4:=y/z;
    if(t1 > t2)then
      max(t3,t4) := w/x;  
    else
      max(t3,t4) := y/z;

   :
   :

Author: Raghavendra B. (raghavendra_b98)
Posted on:

Rate this post
0 useful
not useful
Thanks ..i will try ..

Author: Raghavendra B. (raghavendra_b98)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Hi..Lothar Miller
I changed in my program below,but its not working fine gave 
error.attached my program.
 t3:=w/x;
 t4:=y/z;
    if(t1 > t2)then
      max(t3,t4) := t3;
    else
      max(t3,t4) := t4;

ERRORS :-
50:8: no function declarations for operator "*"
51:8: no function declarations for operator "*"
52:8: no function declarations for operator "/"
53:8: no function declarations for operator "/"
55:6: number of indexes mismatches array dimension
57:6: number of indexes mismatches array dimension
ghdl: compilation error

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
> 55:6: number of indexes mismatches array dimension
> 57:6: number of indexes mismatches array dimension
What did i write about one and two dimensions?

> 50:8: no function declarations for operator "*"
> 51:8: no function declarations for operator "*"
> 52:8: no function declarations for operator "/"
> 53:8: no function declarations for operator "/"
You did not implement a function for the operations * and /
Additionally: in which way must a integer be converted to a "rational"?
  variable w,x,y,z:      integer;
  variable t1,t2,t3,t4:  rational;
  begin
    t1:=w*z;   -- how to convert from "integer" to "rational"?
    t2:=x*y;
    t3:=w/x;
    t4:=y/z;

Author: Raghavendra B. (raghavendra_b98)
Posted on:

Rate this post
0 useful
not useful
Thanks Lothar Miller..fron your suggestions my program working fine

Thanks once again

Author: Lothar Miller (lkmiller) (Moderator)
Posted on:

Rate this post
0 useful
not useful
Raghavendra B. wrote:
>  my program working fine
Thats nice to hear.
> Thanks once again
De nada... ;-)

Author: Hanna G. (Guest)
Posted on:

Rate this post
0 useful
not useful
Hello Raghavendra B.

i have the same problem like you can you post the last code how you 
solve it pls?

Thanks...

Author: Raghavendra B. (raghavendra_b98)
Posted on:
Attached files:

Rate this post
0 useful
not useful
Hi..Hanna G. I attached my source code.

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [vhdl]VHDL code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.