if (that->bits_.empty())
return;
+ cover("kernel.rtlil.sigspec.pack");
log_assert(that->chunks_.empty());
std::vector<RTLIL::SigBit> old_bits;
if (that->chunks_.empty())
return;
+ cover("kernel.rtlil.sigspec.unpack");
log_assert(that->bits_.empty());
that->bits_.reserve(that->width_);
if (that->hash_ != 0)
return;
+ cover("kernel.rtlil.sigspec.hash");
that->pack();
- that->hash_ = 5381;
+ that->hash_ = 5381;
for (auto &c : that->chunks_)
if (c.wire == NULL) {
for (auto &v : c.data.bits)
void RTLIL::SigSpec::sort()
{
unpack();
+ cover("kernel.rtlil.sigspec.sort");
std::sort(bits_.begin(), bits_.end());
}
void RTLIL::SigSpec::sort_and_unify()
{
+ cover("kernel.rtlil.sigspec.sort_and_unify");
*this = this->to_sigbit_set();
}
void RTLIL::SigSpec::replace(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec &with, RTLIL::SigSpec *other) const
{
+ if (other)
+ cover("kernel.rtlil.sigspec.replace_other");
+ else
+ cover("kernel.rtlil.sigspec.replace");
+
unpack();
pattern.unpack();
with.unpack();
void RTLIL::SigSpec::remove2(const RTLIL::SigSpec &pattern, RTLIL::SigSpec *other)
{
+ if (other)
+ cover("kernel.rtlil.sigspec.remove_other");
+ else
+ cover("kernel.rtlil.sigspec.remove");
+
unpack();
if (other != NULL) {
RTLIL::SigSpec RTLIL::SigSpec::extract(RTLIL::SigSpec pattern, RTLIL::SigSpec *other) const
{
+ if (other)
+ cover("kernel.rtlil.sigspec.extract_other");
+ else
+ cover("kernel.rtlil.sigspec.extract");
+
pack();
pattern.pack();
void RTLIL::SigSpec::replace(int offset, const RTLIL::SigSpec &with)
{
+ cover("kernel.rtlil.sigspec.replace");
+
unpack();
with.unpack();
void RTLIL::SigSpec::remove_const()
{
+ cover("kernel.rtlil.sigspec.remove_const");
+
unpack();
std::vector<RTLIL::SigBit> new_bits;
void RTLIL::SigSpec::remove(int offset, int length)
{
+ cover("kernel.rtlil.sigspec.remove_pos");
+
unpack();
assert(offset >= 0);
RTLIL::SigSpec RTLIL::SigSpec::extract(int offset, int length) const
{
unpack();
+ cover("kernel.rtlil.sigspec.extract_pos");
return std::vector<RTLIL::SigBit>(bits_.begin() + offset, bits_.begin() + offset + length);
}
return;
}
+ cover("kernel.rtlil.sigspec.append");
+
if (packed() != signal.packed()) {
pack();
signal.pack();
{
if (packed())
{
+ cover("kernel.rtlil.sigspec.append_bit.packed");
+
if (chunks_.size() == 0)
chunks_.push_back(bit);
else
chunks_.push_back(bit);
}
else
+ {
+ cover("kernel.rtlil.sigspec.append_bit.unpacked");
bits_.push_back(bit);
+ }
width_++;
void RTLIL::SigSpec::extend(int width, bool is_signed)
{
+ cover("kernel.rtlil.sigspec.extend");
+
pack();
if (width_ > width)
void RTLIL::SigSpec::extend_u0(int width, bool is_signed)
{
+ cover("kernel.rtlil.sigspec.extend_0");
+
pack();
if (width_ > width)
RTLIL::SigSpec RTLIL::SigSpec::repeat(int num) const
{
+ cover("kernel.rtlil.sigspec.repeat");
+
RTLIL::SigSpec sig;
for (int i = 0; i < num; i++)
sig.append(*this);
#ifndef NDEBUG
if (packed())
{
+ cover("kernel.rtlil.sigspec.check.packed");
+
int w = 0;
for (size_t i = 0; i < chunks_.size(); i++) {
const RTLIL::SigChunk chunk = chunks_[i];
}
else
{
+ cover("kernel.rtlil.sigspec.check.unpacked");
+
assert(width_ == SIZE(bits_));
assert(chunks_.empty());
}
bool RTLIL::SigSpec::operator <(const RTLIL::SigSpec &other) const
{
+ cover("kernel.rtlil.sigspec.comp_lt");
+
if (this == &other)
return false;
return hash_ < other.hash_;
for (size_t i = 0; i < chunks_.size(); i++)
- if (chunks_[i] != other.chunks_[i])
+ if (chunks_[i] != other.chunks_[i]) {
+ cover("kernel.rtlil.sigspec.comp_lt.hash_collision");
return chunks_[i] < other.chunks_[i];
+ }
return false;
}
bool RTLIL::SigSpec::operator ==(const RTLIL::SigSpec &other) const
{
+ cover("kernel.rtlil.sigspec.comp_eq");
+
if (this == &other)
return true;
return false;
for (size_t i = 0; i < chunks_.size(); i++)
- if (chunks_[i] != other.chunks_[i])
+ if (chunks_[i] != other.chunks_[i]) {
+ cover("kernel.rtlil.sigspec.comp_eq.hash_collision");
return false;
+ }
return true;
}
bool RTLIL::SigSpec::is_fully_const() const
{
+ cover("kernel.rtlil.sigspec.is_fully_const");
+
pack();
for (auto it = chunks_.begin(); it != chunks_.end(); it++)
if (it->width > 0 && it->wire != NULL)
bool RTLIL::SigSpec::is_fully_def() const
{
+ cover("kernel.rtlil.sigspec.is_fully_def");
+
pack();
for (auto it = chunks_.begin(); it != chunks_.end(); it++) {
if (it->width > 0 && it->wire != NULL)
bool RTLIL::SigSpec::is_fully_undef() const
{
+ cover("kernel.rtlil.sigspec.is_fully_undef");
+
pack();
for (auto it = chunks_.begin(); it != chunks_.end(); it++) {
if (it->width > 0 && it->wire != NULL)
bool RTLIL::SigSpec::has_marked_bits() const
{
+ cover("kernel.rtlil.sigspec.has_marked_bits");
+
pack();
for (auto it = chunks_.begin(); it != chunks_.end(); it++)
if (it->width > 0 && it->wire == NULL) {
bool RTLIL::SigSpec::as_bool() const
{
+ cover("kernel.rtlil.sigspec.as_bool");
+
pack();
assert(is_fully_const() && SIZE(chunks_) <= 1);
if (width_)
int RTLIL::SigSpec::as_int() const
{
+ cover("kernel.rtlil.sigspec.as_int");
+
pack();
assert(is_fully_const() && SIZE(chunks_) <= 1);
if (width_)
std::string RTLIL::SigSpec::as_string() const
{
+ cover("kernel.rtlil.sigspec.as_string");
+
pack();
std::string str;
for (size_t i = chunks_.size(); i > 0; i--) {
RTLIL::Const RTLIL::SigSpec::as_const() const
{
+ cover("kernel.rtlil.sigspec.as_const");
+
pack();
assert(is_fully_const() && SIZE(chunks_) <= 1);
if (width_)
bool RTLIL::SigSpec::match(std::string pattern) const
{
+ cover("kernel.rtlil.sigspec.match");
+
pack();
std::string str = as_string();
assert(pattern.size() == str.size());
std::set<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_set() const
{
+ cover("kernel.rtlil.sigspec.to_sigbit_set");
+
pack();
std::set<RTLIL::SigBit> sigbits;
for (auto &c : chunks_)
std::vector<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_vector() const
{
+ cover("kernel.rtlil.sigspec.to_sigbit_vector");
+
unpack();
return bits_;
}
RTLIL::SigBit RTLIL::SigSpec::to_single_sigbit() const
{
+ cover("kernel.rtlil.sigspec.to_single_sigbit");
+
pack();
log_assert(width_ == 1);
for (auto &c : chunks_)
bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str)
{
+ cover("kernel.rtlil.sigspec.parse");
+
std::vector<std::string> tokens;
sigspec_parse_split(tokens, str, ',');
continue;
if ('0' <= netname[0] && netname[0] <= '9') {
+ cover("kernel.rtlil.sigspec.parse.const");
AST::get_line_num = sigspec_parse_get_dummy_line_num;
AST::AstNode *ast = VERILOG_FRONTEND::const2ast(netname);
if (ast == NULL)
if (module == NULL)
return false;
+ cover("kernel.rtlil.sigspec.parse.net");
+
if (netname[0] != '$' && netname[0] != '\\')
netname = "\\" + netname;
if (!indices.empty()) {
std::vector<std::string> index_tokens;
sigspec_parse_split(index_tokens, indices.substr(1, indices.size()-2), ':');
- if (index_tokens.size() == 1)
+ if (index_tokens.size() == 1) {
+ cover("kernel.rtlil.sigspec.parse.bit_sel");
sig.append(RTLIL::SigSpec(wire, atoi(index_tokens.at(0).c_str())));
- else {
+ } else {
+ cover("kernel.rtlil.sigspec.parse.part_sel");
int a = atoi(index_tokens.at(0).c_str());
int b = atoi(index_tokens.at(1).c_str());
if (a > b) {
if (str.empty() || str[0] != '@')
return parse(sig, module, str);
+ cover("kernel.rtlil.sigspec.parse.sel");
+
str = RTLIL::escape_id(str.substr(1));
if (design->selection_vars.count(str) == 0)
return false;
bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str)
{
if (str == "0") {
+ cover("kernel.rtlil.sigspec.parse.rhs_zeros");
sig = RTLIL::SigSpec(RTLIL::State::S0, lhs.width_);
return true;
}
if (str == "~0") {
+ cover("kernel.rtlil.sigspec.parse.rhs_ones");
sig = RTLIL::SigSpec(RTLIL::State::S1, lhs.width_);
return true;
}
long long int val = strtoll(p, &endptr, 10);
if (endptr && endptr != p && *endptr == 0) {
sig = RTLIL::SigSpec(val, lhs.width_);
+ cover("kernel.rtlil.sigspec.parse.rhs_dec");
return true;
}
}