c:= a/b Initialization in VHDL

Moderator (Company: Titel) #2538002
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?
Moderator (Company: Titel) #2538057
>  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.
Moderator (Company: Titel) #2539518
How can this fit together:
1
  type rational is array (natural range numer to denom) of integer; -- one dimension
2

3
  variable max : rational;
4

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

However:
What happens, if you use additional variables like this
1
  function maxi(a,b,c,d:integer) return rational is
2
    variable w,x,y,z:integer;
3
    variable t1,t2:integer;
4
    variable max : rational;
5
  begin
6
    t1:=w*z;
7
    t2:=x*y;
8
    t3:=w/x;
9
    t4:=y/z;
10
    if(t1 > t2)then
11
      max(t3,t4) := w/x;  
12
    else
13
      max(t3,t4) := y/z;
14

15
   :
16
   :
OP #2539685
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
Attached files:
Moderator (Company: Titel) #2539696
> 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"?
1
  variable w,x,y,z:      integer;
2
  variable t1,t2,t3,t4:  rational;
3
  begin
4
    t1:=w*z;   -- how to convert from "integer" to "rational"?
5
    t2:=x*y;
6
    t3:=w/x;
7
    t4:=y/z;
Guest #2607131
Hello Raghavendra B.

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

Thanks...

Reply

A question of your own? This thread is over 14 years old. Ask it in a thread of its own – more people read along there, and it gets answered more often and sooner.

Start a new thread

A fix, an addition or feedback on this thread? Then reply here.

Formatting
  • [c]C-Code[/c]
  • [vhdl]VHDL-Code[/vhdl]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]
  • [[Title]] – link to an article
  • Link to another post: right-click its post ID (#8078628), copy the address, paste it into the text

More about formatting

Post long source code as an attachment, not in the text.

Already registered? Log in

Not shown to anyone. We send you a link; your post appears once you confirm it there.

By submitting you create a free account and accept the terms of use.