Loading files
/*****************************************************************************
GateGenerator.hpp
Copyright (c) 2020 Raphael DINGE
*Tab=3***********************************************************************/
#pragma once
/*\\\ INCLUDE FILES \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
namespace erb
{
/*\\\ PUBLIC \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*
==============================================================================
Name : set
==============================================================================
*/
void GateGenerator::set (bool val)
{
_mode = Mode::Constant;
_val.constant = val;
}
/*
==============================================================================
Name : pulse
==============================================================================
*/
void GateGenerator::pulse (uint64_t clock_ms, std::chrono::milliseconds duration)
{
_mode = Mode::Pulse;
_val.pulse_falling_edge_ms = clock_ms + uint64_t (duration.count ());
}
/*
==============================================================================
Name : process
==============================================================================
*/
bool GateGenerator::process (uint64_t clock_ms)
{
if (_mode == Mode::Pulse)
{
return clock_ms < _val.pulse_falling_edge_ms;
}
else
{
return _val.constant;
}
}
/*\\\ INTERNAL \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PROTECTED \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
/*\\\ PRIVATE \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
} // namespace erb
/*\\\ EOF \\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\*/
1c962d8cfThis file is pinned to the selected release. Download the original to open it in your design tool.