Merge remote-tracking branch 'origin/eddie/fix1115' into xc7mux

This commit is contained in:
Eddie Hung 2019-06-20 16:08:58 -07:00
commit 99ff7b5c8c
4 changed files with 25 additions and 12 deletions

View File

@ -23,6 +23,7 @@ Yosys 0.8 .. Yosys 0.8-dev
- Added "synth_xilinx -abc9" (experimental) - Added "synth_xilinx -abc9" (experimental)
- Added "synth_ice40 -abc9" (experimental) - Added "synth_ice40 -abc9" (experimental)
- Extended "muxcover -mux{4,8,16}=<cost>" - Extended "muxcover -mux{4,8,16}=<cost>"
- Fixed sign extension of unsized constants with 'bx and 'bz MSB
- Added "synth -abc9" (experimental) - Added "synth -abc9" (experimental)
- "synth_xilinx" to now infer wide multiplexers (-nomux to disable) - "synth_xilinx" to now infer wide multiplexers (-nomux to disable)
@ -38,7 +39,7 @@ Yosys 0.7 .. Yosys 0.8
- Added "write_verilog -decimal" - Added "write_verilog -decimal"
- Added "scc -set_attr" - Added "scc -set_attr"
- Added "verilog_defines" command - Added "verilog_defines" command
- Remeber defines from one read_verilog to next - Remember defines from one read_verilog to next
- Added support for hierarchical defparam - Added support for hierarchical defparam
- Added FIRRTL back-end - Added FIRRTL back-end
- Improved ABC default scripts - Improved ABC default scripts

View File

@ -204,7 +204,7 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn
{ {
std::vector<RTLIL::State> data; std::vector<RTLIL::State> data;
bool is_signed = false; bool is_signed = false;
bool is_unsized = false; bool is_unsized = len_in_bits < 0;
if (*(endptr+1) == 's') { if (*(endptr+1) == 's') {
is_signed = true; is_signed = true;
endptr++; endptr++;
@ -213,25 +213,25 @@ AstNode *VERILOG_FRONTEND::const2ast(std::string code, char case_type, bool warn
{ {
case 'b': case 'b':
case 'B': case 'B':
my_strtobin(data, endptr+2, len_in_bits, 2, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 2, case_type, is_unsized);
break; break;
case 'o': case 'o':
case 'O': case 'O':
my_strtobin(data, endptr+2, len_in_bits, 8, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 8, case_type, is_unsized);
break; break;
case 'd': case 'd':
case 'D': case 'D':
my_strtobin(data, endptr+2, len_in_bits, 10, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 10, case_type, is_unsized);
break; break;
case 'h': case 'h':
case 'H': case 'H':
my_strtobin(data, endptr+2, len_in_bits, 16, case_type, false); my_strtobin(data, endptr+2, len_in_bits, 16, case_type, is_unsized);
break; break;
default: default:
char next_char = char(tolower(*(endptr+1))); char next_char = char(tolower(*(endptr+1)));
if (next_char == '0' || next_char == '1' || next_char == 'x' || next_char == 'z') { if (next_char == '0' || next_char == '1' || next_char == 'x' || next_char == 'z') {
my_strtobin(data, endptr+1, 1, 2, case_type, true);
is_unsized = true; is_unsized = true;
my_strtobin(data, endptr+1, 1, 2, case_type, is_unsized);
} else { } else {
return NULL; return NULL;
} }

View File

@ -3438,7 +3438,7 @@ void RTLIL::SigSpec::extend_u0(int width, bool is_signed)
if (width_ < width) { if (width_ < width) {
RTLIL::SigBit padding = width_ > 0 ? (*this)[width_ - 1] : RTLIL::State::Sx; RTLIL::SigBit padding = width_ > 0 ? (*this)[width_ - 1] : RTLIL::State::Sx;
if (padding != RTLIL::State::Sx && !is_signed) if (!is_signed)
padding = RTLIL::State::S0; padding = RTLIL::State::S0;
while (width_ < width) while (width_ < width)
append(padding); append(padding);

View File

@ -1,7 +1,13 @@
read_verilog -formal <<EOT read_verilog -formal <<EOT
module gate(input clk, output [1:0] o); module gate(input clk, output [32:0] o, p, q, r, s, t, u);
assign o = 1'bx; assign o = 'bx;
assign p = 1'bx;
assign q = 'bz;
assign r = 1'bz;
assign s = 1'b0;
assign t = 'b1;
assign u = -'sb1;
endmodule endmodule
EOT EOT
@ -10,8 +16,14 @@ proc
## Equivalence checking ## Equivalence checking
read_verilog -formal <<EOT read_verilog -formal <<EOT
module gold(input clk, output [1:0] o); module gold(input clk, output [32:0] o, p, q, r, s, t, u);
assign o = 2'bxx; assign o = {33{1'bx}};
assign p = {{32{1'b0}}, 1'bx};
assign q = {33{1'bz}};
assign r = {{32{1'b0}}, 1'bz};
assign s = {33{1'b0}};
assign t = {{32{1'b0}}, 1'b1};
assign u = {33{1'b1}};
endmodule endmodule
EOT EOT