35 lines
604 B
C++
35 lines
604 B
C++
/*
|
|
* Utils.cpp
|
|
*
|
|
* Created on: Mar 12, 2014
|
|
* Author: jonny
|
|
*/
|
|
|
|
#include "Utils.h"
|
|
|
|
unsigned int getStartAddress(Bank bank)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
sc_time delayByConstraint(sc_time previous, sc_time start, sc_time constraint)
|
|
{
|
|
if (previous + constraint > start)
|
|
return previous + constraint - start;
|
|
else
|
|
return SC_ZERO_TIME;
|
|
}
|
|
|
|
const sc_time clkAlign(sc_time time, sc_time clk, Alignment alignment)
|
|
{
|
|
if (alignment == UP)
|
|
return ceil(time / clk) * clk;
|
|
else
|
|
return floor(time / clk) * clk;
|
|
}
|
|
|
|
bool isClkAligned(sc_time time, sc_time clk)
|
|
{
|
|
return !((time / clk) - ceil(time / clk));
|
|
}
|