Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

error in running the code...

Status
Not open for further replies.

revathivenkat

Newbie level 5
Joined
Mar 4, 2012
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,358
if i execut this program
i am getting error during run of this code in the lne which is represented in red.....

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
 
package math_complex is
  type complex is record
        r :real;
        i :real;
        
    end record;
    function CMPLX(x,y: in complex ) return complex;
    function  mul(x, y: in complex ) return complex;
end math_complex; 
 
package body math_complex is  
function  CMPLX(x,y: in complex ) return complex is
 variable f:complex;
 begin 
 f.r:=x.r + y.r;
 f.i:=x.i + y.i;
 return f;
 end CMPLX ;
 
 function  mul(x, y: in complex) return complex is
 variable k:complex;
 begin 
[COLOR=#ff0000][B]k.r:=(x.r * y.r) - (x.i * y.i);
k.i:=(x.r * y.i) + (x.i * y.r);[/B][/COLOR]
 return k;
 end mul ;
end math_complex;
 
 
 
 
 
 
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use work.math_complex.all;
entity mathS is 
port(g,h:in complex;
j,l:in  complex;
c,d:inout  complex;
y:out  complex);
end mathS;
architecture data of mathS is
begin
  c <= CMPLX(g,j);
  d <= CMPLX(h,l);
  y <= mul(c,d);
  
end data;


any one clear that......
 
Last edited:

Code:

Code VHDL - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
library IEEE;
use IEEE.std_logic_1164.all;
use IEEE.std_logic_arith.all;
 
package math_complex is
  type complex is record
        r :real;
        i :real;
        
    end record;
    function CMPLX(x,y: in complex ) return complex;
    function  mul(x, y: in complex ) return complex;
end math_complex; 
 
package body math_complex is  
function  CMPLX(x,y: in complex ) return complex is
 variable f:complex;
 begin 
 f.r:=x.r + y.r;
 f.i:=x.i + y.i;
 return f;
 end CMPLX ;
 
 function  mul(x, y: in complex) return complex is
 variable k:complex;
 begin 
----ERROR OCCURS IN THIS LINE       k.r:=(x.r * y.r) - (x.i * y.i);
                                             k.i:=(x.r * y.i) + (x.i * y.r);
 return k;
 end mul ;
end math_complex;
 
 
 
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
use work.math_complex.all;
entity mathS is 
port(g,h:in complex;
j,l:in  complex;
c,d:inout  complex;
y:out  complex);
end mathS;
architecture data of mathS is
begin
  c <= CMPLX(g,j);
  d <= CMPLX(h,l);
  y <= mul(c,d);
  
end data;

Code:
error occurs in the line k.r:=(x.r * y.r) - (x.i * y.i);
k.i:=(x.r * y.i) + (x.i * y.r);
.
 
Last edited:

no error occurs during compling....but in wave window wen i give run option the control is directed to the coding in which an arrow is indicating this line
k.r:=(x.r * y.r) - (x.i * y.i);
k.i:=(x.r * y.i) + (x.i * y.r);
 

what does test bench code means....i dont knw abt tat...
 

how do you stimulate the design? how do you set the values for the inputs?
 

When your simulator points to that line number, what message was displayed in the command port\transcript window. Dont say no, coz there will be a message displayed!!!....
Also which Sim are you using?.
 

When your simulator points to that line number, what message was displayed in the command port\transcript window. Dont say no, coz there will be a message displayed!!!....
Also which Sim are you using?.




ya.....it shows fatal error...i am using model sim
 

try a different version of modelsim?

What does the version of the ModelSim matter here?....

---------- Post added at 15:49 ---------- Previous post was at 15:48 ----------

ya.....it shows fatal error...i am using model sim

Again, no additional information along with the fatal error?....
Oops...Making it so hard

---------- Post added at 15:50 ---------- Previous post was at 15:49 ----------

What are the values you feed in TB, I mean is there any violation or does it exceed the integer range? or so...Did you check at that?
 

If the fatal error is causing modelsim to crash, its probably a bug in modelsim.
If its an erorr in the code, then dont change modelsim versions.

I suspect the OP has no testbench, hence the reals are initialising to real'low. Then when you get real'low * real'low (althought Im now sure if these attributes actually exist), you get an overflow (and then a fatal).
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top