---------------------------------------------------------------------------- -- -- -- Copyright (c) 1993 by Mentor Graphics -- -- -- -- This source file is proprietary information of Mentor Graphics,Inc. -- -- It may be distributed in whole without restriction provided that -- -- this copyright statement is not removed from the file and that -- -- any derivative work contains this copyright notice. -- -- -- -- Package Name : std_logic_arith -- -- -- -- Purpose : This package is to allow the synthesis of the 1164 package. -- -- This package add the capability of SIGNED/UNSIGNED math. -- -- -- ---------------------------------------------------------------------------- LIBRARY ieee ; PACKAGE std_logic_arith IS USE ieee.std_logic_1164.ALL; TYPE SIGNED IS ARRAY (Natural RANGE <>) OF STD_LOGIC ; TYPE UNSIGNED IS ARRAY (Natural RANGE <>) OF STD_LOGIC ; FUNCTION std_ulogic_wired_or ( input : std_ulogic_vector ) RETURN std_ulogic; FUNCTION std_ulogic_wired_and ( input : std_ulogic_vector ) RETURN std_ulogic; ------------------------------------------------------------------------------- -- Note that all functions that take two vector arguments will -- handle unequal argument lengths ------------------------------------------------------------------------------- ------------------------------------------------------------------- -- Conversion Functions ------------------------------------------------------------------- -- Except for the to_integer and conv_integer functions for the -- signed argument all others assume the input vector to be of -- magnitude representation. The signed functions assume -- a 2's complement representation. FUNCTION to_integer ( arg1 : STD_ULOGIC_VECTOR; x : INTEGER := 0 ) RETURN INTEGER; FUNCTION to_integer ( arg1 : STD_LOGIC_VECTOR; x : INTEGER := 0 ) RETURN INTEGER; FUNCTION to_integer ( arg1 : STD_LOGIC; x : INTEGER := 0 ) RETURN NATURAL; FUNCTION to_integer ( arg1 : UNSIGNED; x : INTEGER := 0 ) RETURN NATURAL; FUNCTION to_integer ( arg1 : SIGNED; x : INTEGER := 0 ) RETURN INTEGER; FUNCTION conv_integer ( arg1 : STD_ULOGIC_VECTOR; x : INTEGER := 0 ) RETURN INTEGER; FUNCTION conv_integer ( arg1 : STD_LOGIC_VECTOR; x : INTEGER := 0 ) RETURN INTEGER; FUNCTION conv_integer ( arg1 : STD_LOGIC; x : INTEGER := 0 ) RETURN NATURAL; FUNCTION conv_integer ( arg1 : UNSIGNED; x : INTEGER := 0 ) RETURN NATURAL; FUNCTION conv_integer ( arg1 : SIGNED; x : INTEGER := 0 ) RETURN INTEGER; -- Following functions will return the natural argument in magnitude representation. FUNCTION to_stdlogic ( arg1 : BOOLEAN ) RETURN STD_LOGIC; FUNCTION to_stdlogicvector ( arg1 : INTEGER; size : NATURAL ) RETURN STD_LOGIC_VECTOR; FUNCTION to_stdulogicvector ( arg1 : INTEGER; size : NATURAL ) RETURN STD_ULOGIC_VECTOR; FUNCTION to_unsigned ( arg1 : NATURAL; size : NATURAL ) RETURN UNSIGNED; FUNCTION conv_unsigned ( arg1 : NATURAL; size : NATURAL ) RETURN UNSIGNED; -- The integer argument is returned in 2's complement representation. FUNCTION to_signed ( arg1 : INTEGER; size : NATURAL ) RETURN SIGNED; FUNCTION conv_signed ( arg1 : INTEGER; size : NATURAL ) RETURN SIGNED; ------------------------------------------------------------------------------- -- sign/zero extend FUNCTIONs ------------------------------------------------------------------------------- -- The zero_extend functions will perform zero padding to the input vector, -- returning a vector of length equal to size (the second argument). Note that -- if size i
#include <iostream>
#include "Interpreter.h"
int main( int argc, char *argv[] )
{
std::string commands[] = {
"from time import time,ctime\n",
"print('Today is',ctime(time()))\n"
};
Interpreter::Initialize( );
Interpreter* interpreter = new Interpreter;
for ( int i = 0; i < 2; ++i )
{
int err;
std::string res = interpreter->interpret( commands[i], &err );
std::cout << res;
}
delete interpreter;
Interpreter::Finalize( );
return 0;
}