1

edit: I just reinstalled lattice diamond and the updates, Active-hdl was installed automatically, but the simulation still gives me the same error. when i change library machXO3; use machXO3.all; to library machXO2; use machXO2.all; it compiles..

I'm trying to write a test bench for a simple implementation of OSCH, but I am not being able to get the testbench to work.

I managed to get it to work a few months ago but I lost the file I was working on.

this is the vhdl code I have:

library  ieee;
use  ieee.std_logic_1164.all;

-- For Main Clock --
library machXO3;
use machXO3.all;
--------------------

entity Clock is
     port (stdby : in std_logic;
           osc_int: out std_logic
           );
end Clock;

architecture Clock_behav of Clock is

    COMPONENT OSCH
    -- synthesis translate_off
        GENERIC (NOM_FREQ: string := "2.56");
    -- synthesis translate_on
        PORT (STDBY : IN std_logic;
              OSC : OUT std_logic
                );
    END COMPONENT;

begin

    Clock: OSCH
    -- synthesis translate_off
    GENERIC MAP( NOM_FREQ => "2.56" )
    -- synthesis translate_on
    PORT MAP (  STDBY => stdby,
                OSC => osc_int
    );

end Clock_behav;

This is the testbench, most of it was generated by lattice-diamond I only added stdby <= '0';

LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.numeric_std.ALL;

ENTITY testbench IS
END testbench;

ARCHITECTURE behavior OF testbench IS 

    COMPONENT Clock
    PORT(
        stdby : IN std_logic;          
        osc_int : OUT std_logic
        );
    END COMPONENT;

    SIGNAL stdby :  std_logic;
    SIGNAL osc_int :  std_logic;

BEGIN

-- Please check and add your generic clause manually
    uut: Clock PORT MAP(
        stdby => stdby,
        osc_int => osc_int
    );
    stdby <= '0';

-- *** Test Bench - User Defined Section ***
   tb : PROCESS
   BEGIN
      --wait; -- will wait forever
   END PROCESS;
-- *** End Test Bench - User Defined Section ***

END;

Lattice-diamond is telling me that everything is okay, but when I run everything in Active-hdl, to simulate, I get these errors:

# Error: COMP96_0059: Main.vhd : (5, 1): Library "machXO3" not found.
# Error: COMP96_0078: Main.vhd : (6, 5): Unknown identifier "machXO3".
# Compile Architecture "Clock_behav" of Entity "Clock"
# Error: COMP96_0056: Main.vhd : (15, 1): Cannot find referenced entity declaration "Clock".
# Compile failure 3 Errors 0 Warnings  Analysis time :  16.0 [ms]  
user169808
  • 503
  • 1
  • 6
  • 27
  • 1
    Your simulation software lack `machXO3` library. You need a simulation model for the component you are trying to simulate, this is not part of vhdl language and is not shipped with your simulator. Make sure you have Active HDL - Lattice Edition, and if your version supports MachXO3 family. – mucka Feb 07 '19 at 16:55
  • Active HDL was installed with Lattice-Diamond so I think it is the lattice edition. I was able to make it work a few months ago but I don't remember how. Is there A way to see the compilers for Active HDL to see if I can include the library? – user169808 Feb 08 '19 at 01:56
  • Your deleted question [Vhdl is ignoring generic property value](https://stackoverflow.com/questions/54961410/vhdl-is-ignoring-generic-property-value) appears to be missing an attribute declaration and specification for the instantiated OSCH in clock.vhd. Declare the attribute `attribute NOM_FREQ : string;` Specify the attribute `attribute NOM_FREQ of Clock : label is "133.0";` (it's unclear if table 14 or table 15 value is needed). The `-- synthesis_translate_off`guarantees the generic is not paid attention to in synthesis (but would be for simulation). The attribute would be. –  Mar 02 '19 at 20:03
  • [MachXO2 sysCLOCK PLL Design and Usage Guide](www.latticesemi.com/dynamic/view_document.cfm?document_id=39080) Internal Oscillator (OSCH) Page 28 thru 30. Tables 14, 15 and the attribute declaration and specification (which should be in the enclosing declarative region for the instantiation of OSCH, the architecture declarative part for Clock_Behave of Clock in clock.vhd). –  Mar 02 '19 at 20:07
  • Also see [Lattice Fpga Internal clock](https://stackoverflow.com/questions/50426149/lattice-fpga-internal-clock) where the attribute is shown in the question but not your answer. –  Mar 02 '19 at 20:26
  • Thanks I had deleted the question because I had found the error. I also updated the answer on the other question after reading your comments, thanks – user169808 Mar 11 '19 at 10:35

1 Answers1

2

Looking at C:\lscc\diamond\3.10_x64\active-hdl\vlib\, there seems to be no machXO3 library, but there is a machxo, machxo2 and a machxo3l library. changing library machXO3; use machXO3.all; to library machXO3l; use machXO3l.all; to making some small modifications to the test bench, everything seems to work out fine.

new testbench

    -- VHDL Test Bench Created from source file Clock.vhd -- Fri Feb 22 13:56:19 2019

    --
    -- Notes: 
    -- 1) This testbench template has been automatically generated using types
    -- std_logic and std_logic_vector for the ports of the unit under test.
    -- Lattice recommends that these types always be used for the top-level
    -- I/O of a design in order to guarantee that the testbench will bind
    -- correctly to the timing (post-route) simulation model.
    -- 2) To use this template as your testbench, change the filename to any
    -- name of your choice with the extension .vhd, and use the "source->import"
    -- menu in the ispLEVER Project Navigator to import the testbench.
    -- Then edit the user defined section below, adding code to generate the 
    -- stimulus for your design.
    -- 3) VHDL simulations will produce errors if there are Lattice FPGA library 
    -- elements in your design that require the instantiation of GSR, PUR, and
    -- TSALL and they are not present in the testbench. For more information see
    -- the How To section of online help.  
    --
    LIBRARY ieee;
    USE ieee.std_logic_1164.ALL;
    USE ieee.numeric_std.ALL;

    ENTITY testbench IS
    END testbench;

    ARCHITECTURE behavior OF testbench IS 

        COMPONENT Clock
        PORT(
            stdby : IN std_logic;          
            osc_int : OUT std_logic
            );
        END COMPONENT;

        SIGNAL stdby :  std_logic;
        SIGNAL osc_int :  std_logic;  
        constant PERIOD : time := 20 ns;

    BEGIN

    -- Please check and add your generic clause manually
        uut: Clock PORT MAP(
            stdby => stdby,
            osc_int => osc_int
        );


    -- *** Test Bench - User Defined Section ***
       tb : PROCESS
       BEGIN  
           stdby <= '0';  
           wait for PERIOD ;
          wait; -- will wait forever
       END PROCESS;
    -- *** End Test Bench - User Defined Section ***

    END;





user169808
  • 503
  • 1
  • 6
  • 27