mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 03:32:29 +00:00 
			
		
		
		
	Added cover() calls to RTLIL::SigSpec methods
This commit is contained in:
		
							parent
							
								
									9cf12570ba
								
							
						
					
					
						commit
						1b0d5fc22d
					
				
					 1 changed files with 93 additions and 5 deletions
				
			
		|  | @ -1516,6 +1516,7 @@ void RTLIL::SigSpec::pack() const | ||||||
| 	if (that->bits_.empty()) | 	if (that->bits_.empty()) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
|  | 	cover("kernel.rtlil.sigspec.pack"); | ||||||
| 	log_assert(that->chunks_.empty()); | 	log_assert(that->chunks_.empty()); | ||||||
| 
 | 
 | ||||||
| 	std::vector<RTLIL::SigBit> old_bits; | 	std::vector<RTLIL::SigBit> old_bits; | ||||||
|  | @ -1533,6 +1534,7 @@ void RTLIL::SigSpec::unpack() const | ||||||
| 	if (that->chunks_.empty()) | 	if (that->chunks_.empty()) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
|  | 	cover("kernel.rtlil.sigspec.unpack"); | ||||||
| 	log_assert(that->bits_.empty()); | 	log_assert(that->bits_.empty()); | ||||||
| 
 | 
 | ||||||
| 	that->bits_.reserve(that->width_); | 	that->bits_.reserve(that->width_); | ||||||
|  | @ -1553,9 +1555,10 @@ void RTLIL::SigSpec::hash() const | ||||||
| 	if (that->hash_ != 0) | 	if (that->hash_ != 0) | ||||||
| 		return; | 		return; | ||||||
| 
 | 
 | ||||||
|  | 	cover("kernel.rtlil.sigspec.hash"); | ||||||
| 	that->pack(); | 	that->pack(); | ||||||
| 	that->hash_ = 5381; |  | ||||||
| 
 | 
 | ||||||
|  | 	that->hash_ = 5381; | ||||||
| 	for (auto &c : that->chunks_) | 	for (auto &c : that->chunks_) | ||||||
| 		if (c.wire == NULL) { | 		if (c.wire == NULL) { | ||||||
| 			for (auto &v : c.data.bits) | 			for (auto &v : c.data.bits) | ||||||
|  | @ -1574,11 +1577,13 @@ void RTLIL::SigSpec::hash() const | ||||||
| void RTLIL::SigSpec::sort() | void RTLIL::SigSpec::sort() | ||||||
| { | { | ||||||
| 	unpack(); | 	unpack(); | ||||||
|  | 	cover("kernel.rtlil.sigspec.sort"); | ||||||
| 	std::sort(bits_.begin(), bits_.end()); | 	std::sort(bits_.begin(), bits_.end()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::sort_and_unify() | void RTLIL::SigSpec::sort_and_unify() | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.sort_and_unify"); | ||||||
| 	*this = this->to_sigbit_set(); | 	*this = this->to_sigbit_set(); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1589,6 +1594,11 @@ void RTLIL::SigSpec::replace(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::replace(const RTLIL::SigSpec &pattern, const RTLIL::SigSpec &with, RTLIL::SigSpec *other) const | 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(); | 	unpack(); | ||||||
| 	pattern.unpack(); | 	pattern.unpack(); | ||||||
| 	with.unpack(); | 	with.unpack(); | ||||||
|  | @ -1624,6 +1634,11 @@ void RTLIL::SigSpec::remove(const RTLIL::SigSpec &pattern, RTLIL::SigSpec *other | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::remove2(const RTLIL::SigSpec &pattern, RTLIL::SigSpec *other) | 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(); | 	unpack(); | ||||||
| 
 | 
 | ||||||
| 	if (other != NULL) { | 	if (other != NULL) { | ||||||
|  | @ -1655,6 +1670,11 @@ void RTLIL::SigSpec::remove2(const RTLIL::SigSpec &pattern, RTLIL::SigSpec *othe | ||||||
| 
 | 
 | ||||||
| RTLIL::SigSpec RTLIL::SigSpec::extract(RTLIL::SigSpec pattern, RTLIL::SigSpec *other) const | 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(); | 	pack(); | ||||||
| 	pattern.pack(); | 	pattern.pack(); | ||||||
| 
 | 
 | ||||||
|  | @ -1684,6 +1704,8 @@ RTLIL::SigSpec RTLIL::SigSpec::extract(RTLIL::SigSpec pattern, RTLIL::SigSpec *o | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::replace(int offset, const RTLIL::SigSpec &with) | void RTLIL::SigSpec::replace(int offset, const RTLIL::SigSpec &with) | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.replace"); | ||||||
|  | 
 | ||||||
| 	unpack(); | 	unpack(); | ||||||
| 	with.unpack(); | 	with.unpack(); | ||||||
| 
 | 
 | ||||||
|  | @ -1699,6 +1721,8 @@ void RTLIL::SigSpec::replace(int offset, const RTLIL::SigSpec &with) | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::remove_const() | void RTLIL::SigSpec::remove_const() | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.remove_const"); | ||||||
|  | 
 | ||||||
| 	unpack(); | 	unpack(); | ||||||
| 
 | 
 | ||||||
| 	std::vector<RTLIL::SigBit> new_bits; | 	std::vector<RTLIL::SigBit> new_bits; | ||||||
|  | @ -1716,6 +1740,8 @@ void RTLIL::SigSpec::remove_const() | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::remove(int offset, int length) | void RTLIL::SigSpec::remove(int offset, int length) | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.remove_pos"); | ||||||
|  | 
 | ||||||
| 	unpack(); | 	unpack(); | ||||||
| 
 | 
 | ||||||
| 	assert(offset >= 0); | 	assert(offset >= 0); | ||||||
|  | @ -1731,6 +1757,7 @@ void RTLIL::SigSpec::remove(int offset, int length) | ||||||
| RTLIL::SigSpec RTLIL::SigSpec::extract(int offset, int length) const | RTLIL::SigSpec RTLIL::SigSpec::extract(int offset, int length) const | ||||||
| { | { | ||||||
| 	unpack(); | 	unpack(); | ||||||
|  | 	cover("kernel.rtlil.sigspec.extract_pos"); | ||||||
| 	return std::vector<RTLIL::SigBit>(bits_.begin() + offset, bits_.begin() + offset + length); | 	return std::vector<RTLIL::SigBit>(bits_.begin() + offset, bits_.begin() + offset + length); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
|  | @ -1744,6 +1771,8 @@ void RTLIL::SigSpec::append(const RTLIL::SigSpec &signal) | ||||||
| 		return; | 		return; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
|  | 	cover("kernel.rtlil.sigspec.append"); | ||||||
|  | 
 | ||||||
| 	if (packed() != signal.packed()) { | 	if (packed() != signal.packed()) { | ||||||
| 		pack(); | 		pack(); | ||||||
| 		signal.pack(); | 		signal.pack(); | ||||||
|  | @ -1776,6 +1805,8 @@ void RTLIL::SigSpec::append_bit(const RTLIL::SigBit &bit) | ||||||
| { | { | ||||||
| 	if (packed()) | 	if (packed()) | ||||||
| 	{ | 	{ | ||||||
|  | 		cover("kernel.rtlil.sigspec.append_bit.packed"); | ||||||
|  | 
 | ||||||
| 		if (chunks_.size() == 0) | 		if (chunks_.size() == 0) | ||||||
| 			chunks_.push_back(bit); | 			chunks_.push_back(bit); | ||||||
| 		else | 		else | ||||||
|  | @ -1792,7 +1823,10 @@ void RTLIL::SigSpec::append_bit(const RTLIL::SigBit &bit) | ||||||
| 					chunks_.push_back(bit); | 					chunks_.push_back(bit); | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
|  | 	{ | ||||||
|  | 		cover("kernel.rtlil.sigspec.append_bit.unpacked"); | ||||||
| 		bits_.push_back(bit); | 		bits_.push_back(bit); | ||||||
|  | 	} | ||||||
| 
 | 
 | ||||||
| 	width_++; | 	width_++; | ||||||
| 
 | 
 | ||||||
|  | @ -1801,6 +1835,8 @@ void RTLIL::SigSpec::append_bit(const RTLIL::SigBit &bit) | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::extend(int width, bool is_signed) | void RTLIL::SigSpec::extend(int width, bool is_signed) | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.extend"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 
 | 
 | ||||||
| 	if (width_ > width) | 	if (width_ > width) | ||||||
|  | @ -1818,6 +1854,8 @@ void RTLIL::SigSpec::extend(int width, bool is_signed) | ||||||
| 
 | 
 | ||||||
| void RTLIL::SigSpec::extend_u0(int width, bool is_signed) | void RTLIL::SigSpec::extend_u0(int width, bool is_signed) | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.extend_0"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 
 | 
 | ||||||
| 	if (width_ > width) | 	if (width_ > width) | ||||||
|  | @ -1835,6 +1873,8 @@ void RTLIL::SigSpec::extend_u0(int width, bool is_signed) | ||||||
| 
 | 
 | ||||||
| RTLIL::SigSpec RTLIL::SigSpec::repeat(int num) const | RTLIL::SigSpec RTLIL::SigSpec::repeat(int num) const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.repeat"); | ||||||
|  | 
 | ||||||
| 	RTLIL::SigSpec sig; | 	RTLIL::SigSpec sig; | ||||||
| 	for (int i = 0; i < num; i++) | 	for (int i = 0; i < num; i++) | ||||||
| 		sig.append(*this); | 		sig.append(*this); | ||||||
|  | @ -1846,6 +1886,8 @@ void RTLIL::SigSpec::check() const | ||||||
| #ifndef NDEBUG | #ifndef NDEBUG | ||||||
| 	if (packed()) | 	if (packed()) | ||||||
| 	{ | 	{ | ||||||
|  | 		cover("kernel.rtlil.sigspec.check.packed"); | ||||||
|  | 
 | ||||||
| 		int w = 0; | 		int w = 0; | ||||||
| 		for (size_t i = 0; i < chunks_.size(); i++) { | 		for (size_t i = 0; i < chunks_.size(); i++) { | ||||||
| 			const RTLIL::SigChunk chunk = chunks_[i]; | 			const RTLIL::SigChunk chunk = chunks_[i]; | ||||||
|  | @ -1869,6 +1911,8 @@ void RTLIL::SigSpec::check() const | ||||||
| 	} | 	} | ||||||
| 	else | 	else | ||||||
| 	{ | 	{ | ||||||
|  | 		cover("kernel.rtlil.sigspec.check.unpacked"); | ||||||
|  | 
 | ||||||
| 		assert(width_ == SIZE(bits_)); | 		assert(width_ == SIZE(bits_)); | ||||||
| 		assert(chunks_.empty()); | 		assert(chunks_.empty()); | ||||||
| 	} | 	} | ||||||
|  | @ -1877,6 +1921,8 @@ void RTLIL::SigSpec::check() const | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::operator <(const RTLIL::SigSpec &other) const | bool RTLIL::SigSpec::operator <(const RTLIL::SigSpec &other) const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.comp_lt"); | ||||||
|  | 
 | ||||||
| 	if (this == &other) | 	if (this == &other) | ||||||
| 		return false; | 		return false; | ||||||
| 
 | 
 | ||||||
|  | @ -1896,14 +1942,18 @@ bool RTLIL::SigSpec::operator <(const RTLIL::SigSpec &other) const | ||||||
| 		return hash_ < other.hash_; | 		return hash_ < other.hash_; | ||||||
| 
 | 
 | ||||||
| 	for (size_t i = 0; i < chunks_.size(); i++) | 	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 chunks_[i] < other.chunks_[i]; | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 	return false; | 	return false; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::operator ==(const RTLIL::SigSpec &other) const | bool RTLIL::SigSpec::operator ==(const RTLIL::SigSpec &other) const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.comp_eq"); | ||||||
|  | 
 | ||||||
| 	if (this == &other) | 	if (this == &other) | ||||||
| 		return true; | 		return true; | ||||||
| 
 | 
 | ||||||
|  | @ -1923,14 +1973,18 @@ bool RTLIL::SigSpec::operator ==(const RTLIL::SigSpec &other) const | ||||||
| 		return false; | 		return false; | ||||||
| 
 | 
 | ||||||
| 	for (size_t i = 0; i < chunks_.size(); i++) | 	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 false; | ||||||
|  | 		} | ||||||
| 
 | 
 | ||||||
| 	return true; | 	return true; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::is_fully_const() const | bool RTLIL::SigSpec::is_fully_const() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.is_fully_const"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) | 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) | ||||||
| 		if (it->width > 0 && it->wire != NULL) | 		if (it->width > 0 && it->wire != NULL) | ||||||
|  | @ -1940,6 +1994,8 @@ bool RTLIL::SigSpec::is_fully_const() const | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::is_fully_def() const | bool RTLIL::SigSpec::is_fully_def() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.is_fully_def"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) { | 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) { | ||||||
| 		if (it->width > 0 && it->wire != NULL) | 		if (it->width > 0 && it->wire != NULL) | ||||||
|  | @ -1953,6 +2009,8 @@ bool RTLIL::SigSpec::is_fully_def() const | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::is_fully_undef() const | bool RTLIL::SigSpec::is_fully_undef() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.is_fully_undef"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) { | 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) { | ||||||
| 		if (it->width > 0 && it->wire != NULL) | 		if (it->width > 0 && it->wire != NULL) | ||||||
|  | @ -1966,6 +2024,8 @@ bool RTLIL::SigSpec::is_fully_undef() const | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::has_marked_bits() const | bool RTLIL::SigSpec::has_marked_bits() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.has_marked_bits"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) | 	for (auto it = chunks_.begin(); it != chunks_.end(); it++) | ||||||
| 		if (it->width > 0 && it->wire == NULL) { | 		if (it->width > 0 && it->wire == NULL) { | ||||||
|  | @ -1978,6 +2038,8 @@ bool RTLIL::SigSpec::has_marked_bits() const | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::as_bool() const | bool RTLIL::SigSpec::as_bool() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.as_bool"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	assert(is_fully_const() && SIZE(chunks_) <= 1); | 	assert(is_fully_const() && SIZE(chunks_) <= 1); | ||||||
| 	if (width_) | 	if (width_) | ||||||
|  | @ -1987,6 +2049,8 @@ bool RTLIL::SigSpec::as_bool() const | ||||||
| 
 | 
 | ||||||
| int RTLIL::SigSpec::as_int() const | int RTLIL::SigSpec::as_int() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.as_int"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	assert(is_fully_const() && SIZE(chunks_) <= 1); | 	assert(is_fully_const() && SIZE(chunks_) <= 1); | ||||||
| 	if (width_) | 	if (width_) | ||||||
|  | @ -1996,6 +2060,8 @@ int RTLIL::SigSpec::as_int() const | ||||||
| 
 | 
 | ||||||
| std::string RTLIL::SigSpec::as_string() const | std::string RTLIL::SigSpec::as_string() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.as_string"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	std::string str; | 	std::string str; | ||||||
| 	for (size_t i = chunks_.size(); i > 0; i--) { | 	for (size_t i = chunks_.size(); i > 0; i--) { | ||||||
|  | @ -2011,6 +2077,8 @@ std::string RTLIL::SigSpec::as_string() const | ||||||
| 
 | 
 | ||||||
| RTLIL::Const RTLIL::SigSpec::as_const() const | RTLIL::Const RTLIL::SigSpec::as_const() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.as_const"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	assert(is_fully_const() && SIZE(chunks_) <= 1); | 	assert(is_fully_const() && SIZE(chunks_) <= 1); | ||||||
| 	if (width_) | 	if (width_) | ||||||
|  | @ -2020,6 +2088,8 @@ RTLIL::Const RTLIL::SigSpec::as_const() const | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::match(std::string pattern) const | bool RTLIL::SigSpec::match(std::string pattern) const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.match"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	std::string str = as_string(); | 	std::string str = as_string(); | ||||||
| 	assert(pattern.size() == str.size()); | 	assert(pattern.size() == str.size()); | ||||||
|  | @ -2041,6 +2111,8 @@ bool RTLIL::SigSpec::match(std::string pattern) const | ||||||
| 
 | 
 | ||||||
| std::set<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_set() const | std::set<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_set() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.to_sigbit_set"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	std::set<RTLIL::SigBit> sigbits; | 	std::set<RTLIL::SigBit> sigbits; | ||||||
| 	for (auto &c : chunks_) | 	for (auto &c : chunks_) | ||||||
|  | @ -2051,12 +2123,16 @@ std::set<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_set() const | ||||||
| 
 | 
 | ||||||
| std::vector<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_vector() const | std::vector<RTLIL::SigBit> RTLIL::SigSpec::to_sigbit_vector() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.to_sigbit_vector"); | ||||||
|  | 
 | ||||||
| 	unpack(); | 	unpack(); | ||||||
| 	return bits_; | 	return bits_; | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| RTLIL::SigBit RTLIL::SigSpec::to_single_sigbit() const | RTLIL::SigBit RTLIL::SigSpec::to_single_sigbit() const | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.to_single_sigbit"); | ||||||
|  | 
 | ||||||
| 	pack(); | 	pack(); | ||||||
| 	log_assert(width_ == 1); | 	log_assert(width_ == 1); | ||||||
| 	for (auto &c : chunks_) | 	for (auto &c : chunks_) | ||||||
|  | @ -2082,6 +2158,8 @@ static int sigspec_parse_get_dummy_line_num() | ||||||
| 
 | 
 | ||||||
| bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str) | bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str) | ||||||
| { | { | ||||||
|  | 	cover("kernel.rtlil.sigspec.parse"); | ||||||
|  | 
 | ||||||
| 	std::vector<std::string> tokens; | 	std::vector<std::string> tokens; | ||||||
| 	sigspec_parse_split(tokens, str, ','); | 	sigspec_parse_split(tokens, str, ','); | ||||||
| 
 | 
 | ||||||
|  | @ -2095,6 +2173,7 @@ bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::stri | ||||||
| 			continue; | 			continue; | ||||||
| 
 | 
 | ||||||
| 		if ('0' <= netname[0] && netname[0] <= '9') { | 		if ('0' <= netname[0] && netname[0] <= '9') { | ||||||
|  | 			cover("kernel.rtlil.sigspec.parse.const"); | ||||||
| 			AST::get_line_num = sigspec_parse_get_dummy_line_num; | 			AST::get_line_num = sigspec_parse_get_dummy_line_num; | ||||||
| 			AST::AstNode *ast = VERILOG_FRONTEND::const2ast(netname); | 			AST::AstNode *ast = VERILOG_FRONTEND::const2ast(netname); | ||||||
| 			if (ast == NULL) | 			if (ast == NULL) | ||||||
|  | @ -2107,6 +2186,8 @@ bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::stri | ||||||
| 		if (module == NULL) | 		if (module == NULL) | ||||||
| 			return false; | 			return false; | ||||||
| 
 | 
 | ||||||
|  | 		cover("kernel.rtlil.sigspec.parse.net"); | ||||||
|  | 
 | ||||||
| 		if (netname[0] != '$' && netname[0] != '\\') | 		if (netname[0] != '$' && netname[0] != '\\') | ||||||
| 			netname = "\\" + netname; | 			netname = "\\" + netname; | ||||||
| 
 | 
 | ||||||
|  | @ -2134,9 +2215,11 @@ bool RTLIL::SigSpec::parse(RTLIL::SigSpec &sig, RTLIL::Module *module, std::stri | ||||||
| 		if (!indices.empty()) { | 		if (!indices.empty()) { | ||||||
| 			std::vector<std::string> index_tokens; | 			std::vector<std::string> index_tokens; | ||||||
| 			sigspec_parse_split(index_tokens, indices.substr(1, indices.size()-2), ':'); | 			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()))); | 				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 a = atoi(index_tokens.at(0).c_str()); | ||||||
| 				int b = atoi(index_tokens.at(1).c_str()); | 				int b = atoi(index_tokens.at(1).c_str()); | ||||||
| 				if (a > b) { | 				if (a > b) { | ||||||
|  | @ -2157,6 +2240,8 @@ bool RTLIL::SigSpec::parse_sel(RTLIL::SigSpec &sig, RTLIL::Design *design, RTLIL | ||||||
| 	if (str.empty() || str[0] != '@') | 	if (str.empty() || str[0] != '@') | ||||||
| 		return parse(sig, module, str); | 		return parse(sig, module, str); | ||||||
| 
 | 
 | ||||||
|  | 	cover("kernel.rtlil.sigspec.parse.sel"); | ||||||
|  | 
 | ||||||
| 	str = RTLIL::escape_id(str.substr(1)); | 	str = RTLIL::escape_id(str.substr(1)); | ||||||
| 	if (design->selection_vars.count(str) == 0) | 	if (design->selection_vars.count(str) == 0) | ||||||
| 		return false; | 		return false; | ||||||
|  | @ -2173,11 +2258,13 @@ bool RTLIL::SigSpec::parse_sel(RTLIL::SigSpec &sig, RTLIL::Design *design, RTLIL | ||||||
| bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str) | bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, RTLIL::Module *module, std::string str) | ||||||
| { | { | ||||||
| 	if (str == "0") { | 	if (str == "0") { | ||||||
|  | 		cover("kernel.rtlil.sigspec.parse.rhs_zeros"); | ||||||
| 		sig = RTLIL::SigSpec(RTLIL::State::S0, lhs.width_); | 		sig = RTLIL::SigSpec(RTLIL::State::S0, lhs.width_); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
| 
 | 
 | ||||||
| 	if (str == "~0") { | 	if (str == "~0") { | ||||||
|  | 		cover("kernel.rtlil.sigspec.parse.rhs_ones"); | ||||||
| 		sig = RTLIL::SigSpec(RTLIL::State::S1, lhs.width_); | 		sig = RTLIL::SigSpec(RTLIL::State::S1, lhs.width_); | ||||||
| 		return true; | 		return true; | ||||||
| 	} | 	} | ||||||
|  | @ -2187,6 +2274,7 @@ bool RTLIL::SigSpec::parse_rhs(const RTLIL::SigSpec &lhs, RTLIL::SigSpec &sig, R | ||||||
| 		long long int val = strtoll(p, &endptr, 10); | 		long long int val = strtoll(p, &endptr, 10); | ||||||
| 		if (endptr && endptr != p && *endptr == 0) { | 		if (endptr && endptr != p && *endptr == 0) { | ||||||
| 			sig = RTLIL::SigSpec(val, lhs.width_); | 			sig = RTLIL::SigSpec(val, lhs.width_); | ||||||
|  | 			cover("kernel.rtlil.sigspec.parse.rhs_dec"); | ||||||
| 			return true; | 			return true; | ||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue