VHDL AMS -smash software

Discussion in 'Embedded Systems and Microcontrollers' started by snehal_rt, Feb 6, 2008.

  1. snehal_rt

    Thread Starter New Member

    Feb 6, 2008
    3
    0
    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......
     
  2. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    Try:

    Code ( (Unknown Language)):
    1. library IEEE;
    2.  
    3. use IEEE.electrical_systems.all;
    4.  
    5. entity resistor is
    6. generic(R : resistance := 1.0);
    7. port(terminal t1, t2 : electrical);
    8. end entity resistor;
    9.  
    10. architecture simple of resistor is
    11. quantity v across t1 to t2;
    12. quantity i through t1 to t2;
    13. begin
    14. v==i*R;
    15. end architecture simple;
    Dave
     
  3. snehal_rt

    Thread Starter New Member

    Feb 6, 2008
    3
    0
    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
     
  4. Dave

    Retired Moderator

    Nov 17, 2003
    6,960
    144
    No.

    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.

    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.

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

    Code ( (Unknown Language)):
    1. library IEEE;
    2. use IEEE.ELECTRICAL_SYSTEMS.all;
    3. entity RESISTOR is
    4. generic(R : RESISTANCE := 1.0);
    5. port (terminal P: ELECTRICAL;
    6. terminal N: ELECTRICAL);
    7. end entity RESISTOR;
    8. architecture MODELICA of RESISTOR is
    9. quantity P_V across P_I through P;
    10. quantity N_V across N_I through N;
    11. quantity V : REAL;
    12. quantity I : REAL;
    13. begin
    14. V == P_V – N_V;
    15. 0.0 == P_I + N_I;
    16. I == P_I;
    17. R*I == V;
    18. end architecture MODELICA;
    Dave
     
  5. snehal_rt

    Thread Starter New Member

    Feb 6, 2008
    3
    0
    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
     
    • Doc1.doc
      File size:
      124.5 KB
      Views:
      15
Loading...