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 /frontends/verilog | |
| 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 'frontends/verilog')
| -rw-r--r-- | frontends/verilog/const2ast.cc | 24 | ||||
| -rw-r--r-- | frontends/verilog/verilog_parser.y | 8 | 
2 files changed, 16 insertions, 16 deletions
| diff --git a/frontends/verilog/const2ast.cc b/frontends/verilog/const2ast.cc index f6a17b242..4bf5b1cf5 100644 --- a/frontends/verilog/const2ast.cc +++ b/frontends/verilog/const2ast.cc @@ -99,7 +99,7 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le  	if (base == 10) {  		while (!digits.empty()) -			data.push_back(my_decimal_div_by_two(digits) ? RTLIL::S1 : RTLIL::S0); +			data.push_back(my_decimal_div_by_two(digits) ? State::S1 : State::S0);  	} else {  		int bits_per_digit = my_ilog2(base-1);  		for (auto it = digits.rbegin(), e = digits.rend(); it != e; it++) { @@ -115,17 +115,17 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le  				else if (*it == 0xf2)  					data.push_back(RTLIL::Sa);  				else -					data.push_back((*it & bitmask) ? RTLIL::S1 : RTLIL::S0); +					data.push_back((*it & bitmask) ? State::S1 : State::S0);  			}  		}  	}  	int len = GetSize(data); -	RTLIL::State msb = data.empty() ? RTLIL::S0 : data.back(); +	RTLIL::State msb = data.empty() ? State::S0 : data.back();  	if (len_in_bits < 0) {  		if (len < 32) -			data.resize(32, msb == RTLIL::S0 || msb == RTLIL::S1 ? RTLIL::S0 : msb); +			data.resize(32, msb == State::S0 || msb == State::S1 ? RTLIL::S0 : msb);  		return;  	} @@ -133,11 +133,11 @@ static void my_strtobin(std::vector<RTLIL::State> &data, const char *str, int le  		log_file_error(current_filename, get_line_num(), "Unsized constant must have width of 1 bit, but have %d bits!\n", len);  	for (len = len - 1; len >= 0; len--) -		if (data[len] == RTLIL::S1) +		if (data[len] == State::S1)  			break; -	if (msb == RTLIL::S0 || msb == RTLIL::S1) { +	if (msb == State::S0 || msb == State::S1) {  		len += 1; -		data.resize(len_in_bits, RTLIL::S0); +		data.resize(len_in_bits, State::S0);  	} else {  		len += 2;  		data.resize(len_in_bits, msb); @@ -169,7 +169,7 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn  		for (int i = 0; i < len; i++) {  			unsigned char ch = str[len - i];  			for (int j = 0; j < 8; j++) { -				data.push_back((ch & 1) ? RTLIL::S1 : RTLIL::S0); +				data.push_back((ch & 1) ? State::S1 : State::S0);  				ch = ch >> 1;  			}  		} @@ -190,8 +190,8 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn  	if (*endptr == 0) {  		std::vector<RTLIL::State> data;  		my_strtobin(data, str, -1, 10, case_type, false); -		if (data.back() == RTLIL::S1) -			data.push_back(RTLIL::S0); +		if (data.back() == State::S1) +			data.push_back(State::S0);  		return AstNode::mkconst_bits(data, true);  	} @@ -237,8 +237,8 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn  			}  		}  		if (len_in_bits < 0) { -			if (is_signed && data.back() == RTLIL::S1) -				data.push_back(RTLIL::S0); +			if (is_signed && data.back() == State::S1) +				data.push_back(State::S0);  		}  		return AstNode::mkconst_bits(data, is_signed, is_unsized);  	} diff --git a/frontends/verilog/verilog_parser.y b/frontends/verilog/verilog_parser.y index 0fec445fa..4afd72b73 100644 --- a/frontends/verilog/verilog_parser.y +++ b/frontends/verilog/verilog_parser.y @@ -274,7 +274,7 @@ hierarchical_id:  		$$ = $1;  	} |  	hierarchical_id TOK_PACKAGESEP TOK_ID { -		if ($3->substr(0, 1) == "\\") +		if ($3->compare(0, 1, "\\") == 0)  			*$1 += "::" + $3->substr(1);  		else  			*$1 += "::" + *$3; @@ -282,7 +282,7 @@ hierarchical_id:  		$$ = $1;  	} |  	hierarchical_id '.' TOK_ID { -		if ($3->substr(0, 1) == "\\") +		if ($3->compare(0, 1, "\\") == 0)  			*$1 += "." + $3->substr(1);  		else  			*$1 += "." + *$3; @@ -2184,7 +2184,7 @@ basic_expr:  		$$ = $1;  	} |  	'(' expr ')' TOK_CONSTVAL { -		if ($4->substr(0, 1) != "'") +		if ($4->compare(0, 1, "'") != 0)  			frontend_verilog_yyerror("Cast operation must be applied on sized constants e.g. (<expr>)<constval> , while %s is not a sized constant.", $4->c_str());  		AstNode *bits = $2;  		AstNode *val = const2ast(*$4, case_type_stack.size() == 0 ? 0 : case_type_stack.back(), !lib_mode); @@ -2194,7 +2194,7 @@ basic_expr:  		delete $4;  	} |  	hierarchical_id TOK_CONSTVAL { -		if ($2->substr(0, 1) != "'") +		if ($2->compare(0, 1, "'") != 0)  			frontend_verilog_yyerror("Cast operation must be applied on sized constants, e.g. <ID>\'d0, while %s is not a sized constant.", $2->c_str());  		AstNode *bits = new AstNode(AST_IDENTIFIER);  		bits->str = *$1; | 
