"zlotawy" <(E-Mail Removed)_SPAM.pl> wrote in message

news:fcgrc2$mkn$(E-Mail Removed)...

>

> Uzytkownik "David Bishop" <(E-Mail Removed)> napisal w wiadomosci

> news:46ebdfc0$0$32511$(E-Mail Removed)...

>

>

> hmm.. thanks but i can not use it..

>

> library IEEE;

> use IEEE.STD_LOGIC_1164.all;

> use IEEE.MATH_REAL.ALL;

> package PKG is

> constant one: Integer := ceil(7/ 2);

> end PKG_SRAM;

>

>

>

> And i receive error: "ceil can not have such operands in this context.".

> Can I not generateconstatnt by ceil function?

>
Yes, you can. The errors you're getting are because the data types that you

are using do not have a 'ceil' function defined for it. The function

declaration for 'ceil' in the ieee.math_real package.

function CEIL (X : real ) return real;

In ieee.math_real ceil takes a 'real' as the input parameter and returns a

real type. Since you'd like to use integers you simply need to cast them

appropriately.

The correct way for your example would be

constant one: Integer := natural(ceil(real(7)/real(2)));

or equivalently...

constant one: Integer := natural(ceil(7.0/2.0));

KJ