Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

how can i execute this program?

Status
Not open for further replies.

moh_monem43

Member level 1
Joined
Nov 16, 2005
Messages
39
Helped
2
Reputation
4
Reaction score
0
Trophy points
1,286
Location
EGYPT- SAUDI ARABIA
Activity points
1,570
how can i execute this program?
---------------my_package-----------------------
library ieee;
use ieee.std_logic_1164.all;
package my_package is
constant limit : integer := 255;
procedure sort (signal in1, in2 : in integer range 0 to limit;
signal min, max : out integer range 0 to limit);
end my_package;
package body my_package is
procedure sort ( signal in1, in2 : in integer range 0 to limit;
signal min, max : out integer range 0 to limit) is
begin
if (in1 > in2) then
max <= in1;
min <= in2;
else
max <= in2;
min <= in1;
end if;
end sort;
end my_package;
-----------------------------------------------------------------------------
---------------min_max1---------------------------
library ieee;
use ieee.std_logic_1164.all;
use work.my_package.all;
entity min_max1 is
generic (limit : integer := 255);
port ( ena : in bit;
inp1, inp2 : in integer range 0 to limit;
min_out, max_out : out integer range 0 to limit);
end min_max1;
architecture my_architecture of min_max1 is
begin
process(ena)
begin
if (ena = '1') then sort (inp1, inp2, min_out, max_out);
end if;
end process;
end my_architecture;
-----------------------------------------------------------------------

if i make this program in one file, compilation ok. but when divided this program into two file (my_package + min_max1), compilation not succeed.

can any one explain the steps for implementing this program (in details).
note: this is example 11.10 in circuit design with VHDL (pedroni).
thanks.
 

---------------my_package-----------------------
library ieee;
use ieee.std_logic_1164.all;
package my_package is
constant limit : integer := 255;
procedure sort (signal in1, in2 : in integer range 0 to limit;
signal min, max : out integer range 0 to limit);
end my_package;
package body my_package is
procedure sort ( signal in1, in2 : in integer range 0 to limit;
signal min, max : out integer range 0 to limit) is
begin
if (in1 > in2) then
max <= in1;
min <= in2;
else
max <= in2;
min <= in1;
end if;
end sort;
end my_package;

---------------min_max1---------------------------
library ieee;
use ieee.std_logic_1164.all;

library work; --You missed this line
use work.my_package.all;

entity min_max1 is
generic (limit : integer := 255);
port ( ena : in bit;
inp1, inp2 : in integer range 0 to limit;
min_out, max_out : out integer range 0 to limit);
end min_max1;
architecture my_architecture of min_max1 is
begin
process(ena)
begin
if (ena = '1') then sort (inp1, inp2, min_out, max_out);
end if;
end process;
end my_architecture;
-----------------------------------------------------------------------

make sure that you compile my_package first then min_max1.
hope this help
 

keano said:
make sure that you compile my_package first then min_max1.
hope this help

compilation of my_package nt successful, it give me this mesaage
Error: Node instance instantiates undefined entity my_package
 

moh_monem43 said:
keano said:
make sure that you compile my_package first then min_max1.
hope this help

compilation of my_package nt successful, it give me this mesaage
Error: Node instance instantiates undefined entity my_package

WHich tool do you use? Show us clearly what your command lines were. In VCSMX I would do:

vhdlan my_package.vhdl
vhdlan design.vhdl

This should work!

Regards
Ajeetha, CVC
www.noveldv.com
 

I use ModelSIM.
Compilation is successful.
 

it's not "program"!
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top