- to_cycles() now correctly rounded
Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@735 cc03376c-175c-47c8-b038-4cd826a8556b
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
library IEEE;
|
library IEEE;
|
||||||
USE IEEE.STD_LOGIC_1164.ALL;
|
USE IEEE.STD_LOGIC_1164.ALL;
|
||||||
USE IEEE.NUMERIC_STD.ALL;
|
USE IEEE.NUMERIC_STD.ALL;
|
||||||
|
USE IEEE.MATH_REAL.ALL;
|
||||||
|
|
||||||
use work.sdram_config.all;
|
use work.sdram_config.all;
|
||||||
|
|
||||||
@@ -122,7 +123,7 @@ package body sdram_types is
|
|||||||
function to_cycles(T_ns : real; f_Mhz : real) return natural is
|
function to_cycles(T_ns : real; f_Mhz : real) return natural is
|
||||||
begin
|
begin
|
||||||
|
|
||||||
return natural(0.5 + 1.0E-3*T_ns*f_Mhz);
|
return natural(ceil(1.0E-3*T_ns*f_Mhz));
|
||||||
|
|
||||||
end to_cycles;
|
end to_cycles;
|
||||||
|
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
library IEEE;
|
library IEEE;
|
||||||
USE IEEE.STD_LOGIC_1164.ALL;
|
USE IEEE.STD_LOGIC_1164.ALL;
|
||||||
USE IEEE.NUMERIC_STD.ALL;
|
USE IEEE.NUMERIC_STD.ALL;
|
||||||
|
USE IEEE.MATH_REAL.ALL;
|
||||||
|
|
||||||
package async_types is
|
package async_types is
|
||||||
|
|
||||||
@@ -53,7 +54,7 @@ package body async_types is
|
|||||||
function to_cycles(T_ns : real; f_Mhz : real) return natural is
|
function to_cycles(T_ns : real; f_Mhz : real) return natural is
|
||||||
begin
|
begin
|
||||||
|
|
||||||
return natural(0.5 + 1.0E-3*T_ns*f_Mhz);
|
return natural(ceil(1.0E-3*T_ns*f_Mhz));
|
||||||
|
|
||||||
end to_cycles;
|
end to_cycles;
|
||||||
end async_types;
|
end async_types;
|
||||||
|
|||||||
Reference in New Issue
Block a user