VHDL AMS -smash software

Thread Starter

snehal_rt

Joined Feb 6, 2008
3
Hi everyone...

I am new to the software Smash....To get familiar with it i was trying to run some simple code.

when i was trying to run the code for resistor...
i get error saying unable to parse the device(syntax error).this error is in the first two lines
ie library ieee;use ieee.electrical_systems.all;

its quite strange ,i tried to check everthing but i dnt knw what the error can be.....

my code for resistor
library ieee;

use ieee.electrical_systems.all;

entity resistor is
generic(
R : resistance := 1.0 -- [Ohm]
);
port(

terminal t1, t2 : electrical
);
end entity resistor;

architecture simple of resistor is
quantity v across t1 to t2;
quantity i through t1 to t2;
begin
v==i*R;
end architecture simple;


Can ayone please help me......
 

Dave

Joined Nov 17, 2003
6,969
Try:

Rich (BB code):
library IEEE;

use IEEE.electrical_systems.all;

entity resistor is
generic(R : resistance := 1.0);
port(terminal t1, t2 : electrical);
end entity resistor;

architecture simple of resistor is
quantity v across t1 to t2;
quantity i through t1 to t2;
begin
v==i*R;
end architecture simple;
Dave
 

Thread Starter

snehal_rt

Joined Feb 6, 2008
3
Hi Dave ,

thanks for ur reply :) .

I have question ....while writing the code for resistor i understood from example code that the first line should be >>> VHDL...is it true ??

i tried the code u gave with the above line inserted but i still have 4 errors.Error Electrical_systems is not a primary unit of library
1. Do i need to mention any packages or so?

2.I am saving the file as resistor.nsx, i hope its right way of saving

3.Is that i am getting the error as resistor component is already defined in electrical systems library...

Please help....

Snehal
 

Dave

Joined Nov 17, 2003
6,969
Hi Dave ,

thanks for ur reply :) .

I have question ....while writing the code for resistor i understood from example code that the first line should be >>> VHDL...is it true ??
No.

i tried the code u gave with the above line inserted but i still have 4 errors.Error Electrical_systems is not a primary unit of library
1. Do i need to mention any packages or so?
I cannot find anything on this error, and I've never come across it before. Could you get me a screenshot of the exact error message?

For a simple resistor, you only need mention the packages as stated above.

2.I am saving the file as resistor.nsx, i hope its right way of saving
I have never heard of a NSX-file. A look indicates it is an Apollo Database Engine Index file; ref. http://filext.com/file-extension/NSX

The packages I use save the models as VHD-files.

3.Is that i am getting the error as resistor component is already defined in electrical systems library...

Please help....

Snehal
How about if we try another way of creating the resistor:

Rich (BB code):
library IEEE;
use IEEE.ELECTRICAL_SYSTEMS.all;
entity RESISTOR is
generic(R : RESISTANCE := 1.0);
port (terminal P: ELECTRICAL;
terminal N: ELECTRICAL);
end entity RESISTOR;
architecture MODELICA of RESISTOR is
quantity P_V across P_I through P;
quantity N_V across N_I through N;
quantity V : REAL;
quantity I : REAL;
begin
V == P_V – N_V;
0.0 == P_I + N_I;
I == P_I;
R*I == V;
end architecture MODELICA;
Dave
 

Thread Starter

snehal_rt

Joined Feb 6, 2008
3
Thanks again for ur reply.....i tried the code but i am having the same error...
I have attached the screen shot..Please help me as what is wrong....

Snehal
 

Attachments

Top