- 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:
2010-02-09 08:42:21 +00:00
parent 0c50e933f8
commit c7fa54ce6b
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -24,6 +24,7 @@
library IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
USE IEEE.MATH_REAL.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
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;
+2 -1
View File
@@ -24,6 +24,7 @@
library IEEE;
USE IEEE.STD_LOGIC_1164.ALL;
USE IEEE.NUMERIC_STD.ALL;
USE IEEE.MATH_REAL.ALL;
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
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 async_types;