diff options
| author | Eddie Hung <eddie@fpgeh.com> | 2019-08-12 11:32:10 -0700 | 
|---|---|---|
| committer | Eddie Hung <eddie@fpgeh.com> | 2019-08-12 11:32:10 -0700 | 
| commit | f890cfb63b71ae7b09e19c290ec70c358dcbe9cd (patch) | |
| tree | ea7602c378e794b5e7448361ba2a41d2d6a49c13 /backends | |
| parent | ab1d63a56595f11e10a5326bd83ce84d08badabe (diff) | |
| parent | 78b30bbb1102047585d1a2eac89b1c7f5ca7344e (diff) | |
| download | yosys-f890cfb63b71ae7b09e19c290ec70c358dcbe9cd.tar.gz yosys-f890cfb63b71ae7b09e19c290ec70c358dcbe9cd.tar.bz2 yosys-f890cfb63b71ae7b09e19c290ec70c358dcbe9cd.zip | |
Merge remote-tracking branch 'origin/master' into xc7dsp
Diffstat (limited to 'backends')
| -rw-r--r-- | backends/aiger/xaiger.cc | 10 | ||||
| -rw-r--r-- | backends/blif/blif.cc | 2 | ||||
| -rw-r--r-- | backends/btor/btor.cc | 4 | ||||
| -rw-r--r-- | backends/firrtl/firrtl.cc | 12 | ||||
| -rw-r--r-- | backends/ilang/ilang_backend.cc | 8 | ||||
| -rw-r--r-- | backends/intersynth/intersynth.cc | 4 | ||||
| -rw-r--r-- | backends/smt2/smt2.cc | 4 | ||||
| -rw-r--r-- | backends/smv/smv.cc | 2 | ||||
| -rw-r--r-- | backends/verilog/verilog_backend.cc | 22 | 
9 files changed, 34 insertions, 34 deletions
| diff --git a/backends/aiger/xaiger.cc b/backends/aiger/xaiger.cc index 36a379e34..f49ecbeda 100644 --- a/backends/aiger/xaiger.cc +++ b/backends/aiger/xaiger.cc @@ -388,11 +388,11 @@ struct XAigerWriter  						RTLIL::SigSpec rhs;  						if (it != cell->connections_.end()) {  							if (GetSize(it->second) < GetSize(w)) -								it->second.append(RTLIL::SigSpec(RTLIL::S0, GetSize(w)-GetSize(it->second))); +								it->second.append(RTLIL::SigSpec(State::S0, GetSize(w)-GetSize(it->second)));  							rhs = it->second;  						}  						else { -							rhs = RTLIL::SigSpec(RTLIL::S0, GetSize(w)); +							rhs = RTLIL::SigSpec(State::S0, GetSize(w));  							cell->setPort(port_name, rhs);  						} @@ -400,10 +400,10 @@ struct XAigerWriter  						for (auto b : rhs.bits()) {  							SigBit I = sigmap(b);  							if (b == RTLIL::Sx) -								b = RTLIL::S0; +								b = State::S0;  							else if (I != b) {  								if (I == RTLIL::Sx) -									alias_map[b] = RTLIL::S0; +									alias_map[b] = State::S0;  								else  									alias_map[b] = I;  							} @@ -671,7 +671,7 @@ struct XAigerWriter  							if (holes_cell)  								port_wire.append(holes_wire);  							else -								holes_module->connect(holes_wire, RTLIL::S0); +								holes_module->connect(holes_wire, State::S0);  						}  						if (!port_wire.empty())  							holes_cell->setPort(w->name, port_wire); diff --git a/backends/blif/blif.cc b/backends/blif/blif.cc index f32b0f533..b6e38c16c 100644 --- a/backends/blif/blif.cc +++ b/backends/blif/blif.cc @@ -377,7 +377,7 @@ struct BlifDumper  				f << stringf("\n");  				RTLIL::SigSpec mask = cell->parameters.at("\\LUT");  				for (int i = 0; i < (1 << width); i++) -					if (mask[i] == RTLIL::S1) { +					if (mask[i] == State::S1) {  						for (int j = width-1; j >= 0; j--) {  							f << ((i>>j)&1 ? '1' : '0');  						} diff --git a/backends/btor/btor.cc b/backends/btor/btor.cc index 7bacce2af..7c054d655 100644 --- a/backends/btor/btor.cc +++ b/backends/btor/btor.cc @@ -616,8 +616,8 @@ struct BtorWorker  			if (initstate_nid < 0)  			{  				int sid = get_bv_sid(1); -				int one_nid = get_sig_nid(Const(1, 1)); -				int zero_nid = get_sig_nid(Const(0, 1)); +				int one_nid = get_sig_nid(State::S1); +				int zero_nid = get_sig_nid(State::S0);  				initstate_nid = next_nid++;  				btorf("%d state %d\n", initstate_nid, sid);  				btorf("%d init %d %d %d\n", next_nid++, sid, initstate_nid, one_nid); diff --git a/backends/firrtl/firrtl.cc b/backends/firrtl/firrtl.cc index 9ef6e311a..87db0edf7 100644 --- a/backends/firrtl/firrtl.cc +++ b/backends/firrtl/firrtl.cc @@ -122,9 +122,9 @@ struct FirrtlWorker  			// Current (3/13/2019) conventions:  			//  generate a constant 0 for clock and a constant 1 for enable if they are undefined.  			if (!clk.is_fully_def()) -				this->clk = SigSpec(RTLIL::Const(0, 1)); +				this->clk = SigSpec(State::S0);  			if (!ena.is_fully_def()) -				this->ena = SigSpec(RTLIL::Const(1, 1)); +				this->ena = SigSpec(State::S1);  		}  		string gen_read(const char * indent) {  			string addr_expr = make_expr(addr); @@ -297,7 +297,7 @@ struct FirrtlWorker  		std::string cell_type = fid(cell->type);  		std::string instanceOf;  		// If this is a parameterized module, its parent module is encoded in the cell type -		if (cell->type.substr(0, 8) == "$paramod") +		if (cell->type.begins_with("$paramod"))  		{  			std::string::iterator it;  			for (it = cell_type.begin(); it < cell_type.end(); it++) @@ -363,7 +363,7 @@ struct FirrtlWorker  				}  				// Check for subfield assignment.  				std::string bitsString = "bits("; -				if (sinkExpr.substr(0, bitsString.length()) == bitsString ) { +				if (sinkExpr.compare(0, bitsString.length(), bitsString) == 0) {  					if (sinkSig == nullptr)  						log_error("Unknown subfield %s.%s\n", cell_type.c_str(), sinkExpr.c_str());  					// Don't generate the assignment here. @@ -877,7 +877,7 @@ struct FirrtlWorker  			}  			// This may be a parameterized module - paramod. -			if (cell->type.substr(0, 8) == "$paramod") +			if (cell->type.begins_with("$paramod"))  			{  				process_instance(cell, wire_exprs);  				continue; @@ -943,7 +943,7 @@ struct FirrtlWorker  				register_reverse_wire_map(y_id, cell->getPort("\\Y"));  				continue;  			} -			log_warning("Cell type not supported: %s (%s.%s)\n", log_id(cell->type), log_id(module), log_id(cell)); +			log_error("Cell type not supported: %s (%s.%s)\n", log_id(cell->type), log_id(module), log_id(cell));  		}  		for (auto conn : module->connections()) diff --git a/backends/ilang/ilang_backend.cc b/backends/ilang/ilang_backend.cc index 313af7d5c..e06786220 100644 --- a/backends/ilang/ilang_backend.cc +++ b/backends/ilang/ilang_backend.cc @@ -40,8 +40,8 @@ void ILANG_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int wi  			for (int i = 0; i < width; i++) {  				log_assert(offset+i < (int)data.bits.size());  				switch (data.bits[offset+i]) { -				case RTLIL::S0: break; -				case RTLIL::S1: val |= 1 << i; break; +				case State::S0: break; +				case State::S1: val |= 1 << i; break;  				default: val = -1; break;  				}  			} @@ -54,8 +54,8 @@ void ILANG_BACKEND::dump_const(std::ostream &f, const RTLIL::Const &data, int wi  		for (int i = offset+width-1; i >= offset; i--) {  			log_assert(i < (int)data.bits.size());  			switch (data.bits[i]) { -			case RTLIL::S0: f << stringf("0"); break; -			case RTLIL::S1: f << stringf("1"); break; +			case State::S0: f << stringf("0"); break; +			case State::S1: f << stringf("1"); break;  			case RTLIL::Sx: f << stringf("x"); break;  			case RTLIL::Sz: f << stringf("z"); break;  			case RTLIL::Sa: f << stringf("-"); break; diff --git a/backends/intersynth/intersynth.cc b/backends/intersynth/intersynth.cc index b0e3cd252..809a0fa09 100644 --- a/backends/intersynth/intersynth.cc +++ b/backends/intersynth/intersynth.cc @@ -108,7 +108,7 @@ struct IntersynthBackend : public Backend {  			if (f.fail())  				log_error("Can't open lib file `%s'.\n", filename.c_str());  			RTLIL::Design *lib = new RTLIL::Design; -			Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.substr(filename.size()-3) == ".il") ? "ilang" : "verilog"); +			Frontend::frontend_call(lib, &f, filename, (filename.size() > 3 && filename.compare(filename.size()-3, std::string::npos, ".il") == 0 ? "ilang" : "verilog"));  			libs.push_back(lib);  		} @@ -183,7 +183,7 @@ struct IntersynthBackend : public Backend {  					if (param.second.bits.size() != 32) {  						node_code += stringf(" %s '", RTLIL::id2cstr(param.first));  						for (int i = param.second.bits.size()-1; i >= 0; i--) -							node_code += param.second.bits[i] == RTLIL::S1 ? "1" : "0"; +							node_code += param.second.bits[i] == State::S1 ? "1" : "0";  					} else  						node_code += stringf(" %s 0x%x", RTLIL::id2cstr(param.first), param.second.as_int());  				} diff --git a/backends/smt2/smt2.cc b/backends/smt2/smt2.cc index ddd680782..081dcda99 100644 --- a/backends/smt2/smt2.cc +++ b/backends/smt2/smt2.cc @@ -601,7 +601,7 @@ struct Smt2Worker  			if (cell->type == "$logic_and") return export_reduce(cell, "(and (or A) (or B))", false);  			if (cell->type == "$logic_or") return export_reduce(cell, "(or A B)", false); -			if (cell->type == "$mux" || cell->type == "$pmux") +			if (cell->type.in("$mux", "$pmux"))  			{  				int width = GetSize(cell->getPort("\\Y"));  				std::string processed_expr = get_bv(cell->getPort("\\A")); @@ -1476,7 +1476,7 @@ struct Smt2Backend : public Backend {  				int indent = 0;  				while (indent < GetSize(line) && (line[indent] == ' ' || line[indent] == '\t'))  					indent++; -				if (line.substr(indent, 2) == "%%") +				if (line.compare(indent, 2, "%%") == 0)  					break;  				*f << line << std::endl;  			} diff --git a/backends/smv/smv.cc b/backends/smv/smv.cc index e9586fae0..f755307bf 100644 --- a/backends/smv/smv.cc +++ b/backends/smv/smv.cc @@ -61,7 +61,7 @@ struct SmvWorker  		{  			string name = stringf("_%s", id.c_str()); -			if (name.substr(0, 2) == "_\\") +			if (name.compare(0, 2, "_\\") == 0)  				name = "_" + name.substr(2);  			for (auto &c : name) { diff --git a/backends/verilog/verilog_backend.cc b/backends/verilog/verilog_backend.cc index 776f4eacb..7b1db4776 100644 --- a/backends/verilog/verilog_backend.cc +++ b/backends/verilog/verilog_backend.cc @@ -200,9 +200,9 @@ void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int o  			int32_t val = 0;  			for (int i = offset+width-1; i >= offset; i--) {  				log_assert(i < (int)data.bits.size()); -				if (data.bits[i] != RTLIL::S0 && data.bits[i] != RTLIL::S1) +				if (data.bits[i] != State::S0 && data.bits[i] != State::S1)  					goto dump_hex; -				if (data.bits[i] == RTLIL::S1) +				if (data.bits[i] == State::S1)  					val |= 1 << (i - offset);  			}  			if (decimal) @@ -219,8 +219,8 @@ void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int o  			for (int i = offset; i < offset+width; i++) {  				log_assert(i < (int)data.bits.size());  				switch (data.bits[i]) { -				case RTLIL::S0: bin_digits.push_back('0'); break; -				case RTLIL::S1: bin_digits.push_back('1'); break; +				case State::S0: bin_digits.push_back('0'); break; +				case State::S1: bin_digits.push_back('1'); break;  				case RTLIL::Sx: bin_digits.push_back('x'); break;  				case RTLIL::Sz: bin_digits.push_back('z'); break;  				case RTLIL::Sa: bin_digits.push_back('?'); break; @@ -273,8 +273,8 @@ void dump_const(std::ostream &f, const RTLIL::Const &data, int width = -1, int o  			for (int i = offset+width-1; i >= offset; i--) {  				log_assert(i < (int)data.bits.size());  				switch (data.bits[i]) { -				case RTLIL::S0: f << stringf("0"); break; -				case RTLIL::S1: f << stringf("1"); break; +				case State::S0: f << stringf("0"); break; +				case State::S1: f << stringf("1"); break;  				case RTLIL::Sx: f << stringf("x"); break;  				case RTLIL::Sz: f << stringf("z"); break;  				case RTLIL::Sa: f << stringf("?"); break; @@ -380,9 +380,9 @@ void dump_attributes(std::ostream &f, std::string indent, dict<RTLIL::IdString,  	for (auto it = attributes.begin(); it != attributes.end(); ++it) {  		f << stringf("%s" "%s %s", indent.c_str(), as_comment ? "/*" : "(*", id(it->first).c_str());  		f << stringf(" = "); -		if (modattr && (it->second == Const(0, 1) || it->second == Const(0))) +		if (modattr && (it->second == State::S0 || it->second == Const(0)))  			f << stringf(" 0 "); -		else if (modattr && (it->second == Const(1, 1) || it->second == Const(1))) +		else if (modattr && (it->second == State::S1 || it->second == Const(1)))  			f << stringf(" 1 ");  		else  			dump_const(f, it->second, -1, 0, false, as_comment); @@ -604,7 +604,7 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell)  		return true;  	} -	if (cell->type.substr(0, 6) == "$_DFF_") +	if (cell->type.begins_with("$_DFF_"))  	{  		std::string reg_name = cellname(cell);  		bool out_is_reg_wire = is_reg_wire(cell->getPort("\\Q"), reg_name); @@ -645,7 +645,7 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell)  		return true;  	} -	if (cell->type.substr(0, 8) == "$_DFFSR_") +	if (cell->type.begins_with("$_DFFSR_"))  	{  		char pol_c = cell->type[8], pol_s = cell->type[9], pol_r = cell->type[10]; @@ -949,7 +949,7 @@ bool dump_cell_expr(std::ostream &f, std::string indent, RTLIL::Cell *cell)  		return true;  	} -	if (cell->type == "$dff" || cell->type == "$adff" || cell->type == "$dffe") +	if (cell->type.in("$dff", "$adff", "$dffe"))  	{  		RTLIL::SigSpec sig_clk, sig_arst, sig_en, val_arst;  		bool pol_clk, pol_arst = false, pol_en = false; | 
