0
votes


When I try to compile this code I keep getting an error that says:

line 13: Error, 'std_logic' is not a known type.

Line 13 is Clock : IN std_logic;in the ALU_tb entity.

I am confused by this error, because it is my understanding that the reason for said error is normally a missing library/package. I'm almost sure I have the appropriate libraries and packages. Plus none of the other signals of type std_logic are getting errors.

If anyone could help me figure this out, I would greatly appreciate it.

-- VHDL Entity ALU.ALU_tb.symbol
--
-- Created:
--          by - ClarkG.UNKNOWN (COELABS15)
--          at - 19:58:20 09/ 8/2014
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2011.1 (Build 18)
--


ENTITY ALU_tb IS
   PORT( 
      Clock   : IN     std_logic;
      Reset_N : IN     std_logic
   );

-- Declarations

END ALU_tb ;

--
-- VHDL Architecture ALU.ALU_tb.struct
--
-- Created:
--          by - ClarkG.UNKNOWN (COELABS15)
--          at - 19:58:20 09/ 8/2014
--
-- Generated by Mentor Graphics' HDL Designer(TM) 2011.1 (Build 18)
--
LIBRARY ieee;
USE ieee.std_logic_1164.ALL;
USE ieee.std_logic_arith.ALL;

LIBRARY ALU;

ARCHITECTURE struct OF ALU_tb IS

   -- Architecture declarations

   -- Internal signal declarations
   SIGNAL A        : std_logic_vector(31 DOWNTO 0);
   SIGNAL ALUOp    : std_logic_vector(3 DOWNTO 0);
   SIGNAL B        : std_logic_vector(31 DOWNTO 0);
   SIGNAL Overflow : std_logic;
   SIGNAL R        : std_logic_vector(31 DOWNTO 0);
   SIGNAL SHAMT    : std_logic_vector(4 DOWNTO 0);
   SIGNAL Zero     : std_logic;


   -- Component Declarations
   COMPONENT ALU
   PORT (
      A        : IN     std_logic_vector (31 DOWNTO 0);
      ALUOp    : IN     std_logic_vector (3 DOWNTO 0);
      B        : IN     std_logic_vector (31 DOWNTO 0);
      SHAMT    : IN     std_logic_vector (4 DOWNTO 0);
      Overflow : OUT    std_logic ;
      R        : OUT    std_logic_vector (31 DOWNTO 0);
      Zero     : OUT    std_logic 
   );
   END COMPONENT;
   COMPONENT ALU_tester
   PORT (
      A        : IN     std_logic_vector (31 DOWNTO 0);
      ALUOp    : IN     std_logic_vector (3 DOWNTO 0);
      B        : IN     std_logic_vector (31 DOWNTO 0);
      Clock    : IN     std_logic ;
      Overflow : IN     std_logic ;
      R        : IN     std_logic_vector (31 DOWNTO 0);
      Reset_N  : IN     std_logic ;
      SHAMT    : IN     std_logic_vector (4 DOWNTO 0);
      Zero     : IN     std_logic 
   );
   END COMPONENT;
   COMPONENT Test_transaction_generator
   PORT (
      Clock : IN     std_logic ;
      A     : OUT    std_logic_vector (31 DOWNTO 0);
      ALUOp : OUT    std_logic_vector (3 DOWNTO 0);
      B     : OUT    std_logic_vector (31 DOWNTO 0);
      SHAMT : OUT    std_logic_vector (4 DOWNTO 0)
   );
   END COMPONENT;

   -- Optional embedded configurations
   -- pragma synthesis_off
   FOR ALL : ALU USE ENTITY ALU.ALU;
   FOR ALL : ALU_tester USE ENTITY ALU.ALU_tester;
   FOR ALL : Test_transaction_generator USE ENTITY ALU.Test_transaction_generator;
   -- pragma synthesis_on


BEGIN

   -- Instance port mappings.
   U_0 : ALU
      PORT MAP (
         A        => A,
         ALUOp    => ALUOp,
         B        => B,
         SHAMT    => SHAMT,
         Overflow => Overflow,
         R        => R,
         Zero     => Zero
      );
   U_1 : ALU_tester
      PORT MAP (
         A        => A,
         ALUOp    => ALUOp,
         B        => B,
         Clock    => Clock,
         Overflow => Overflow,
         R        => R,
         Reset_N  => Reset_N,
         SHAMT    => SHAMT,
         Zero     => Zero
      );
   U_2 : Test_transaction_generator
      PORT MAP (
         Clock => Clock,
         A     => A,
         ALUOp => ALUOp,
         B     => B,
         SHAMT => SHAMT
      );

END struct;
2

2 Answers

2
votes

The context clause comprised of a library clauses and use clauses should be moved to before the entity declaration instead of just before the architecture body. An entity and an architecture form a common declarative region allowing those library and use clauses to be in effect across both instead of just the architecture, as in your code presently.

You also don't appear to be using package std_logic_arith in the code you've shown. (The architecture only contains components).

1
votes

At line 13, you have not yet imported the ieee libraries required to define std_logic which is why you're getting the error.