google / xls

XLS: Accelerated HW Synthesis
http://google.github.io/xls/
Apache License 2.0
1.21k stars 178 forks source link

Want token close-paren; Error in Netlist Interpreter (may be related to VAST) #419

Open vincent-mirian-google opened 3 years ago

vincent-mirian-google commented 3 years ago

When using the verilog file:

module aa(
  input wire clk,
  output wire [31:0] out
);
  // ===== Pipe stage 0:
  wire [31:0] p0_literal_1_comb;
  assign p0_literal_1_comb = 32'h0000_0001;

  // Registers for pipe stage 0:
  reg [31:0] p0_literal_1;
  always_ff @ (posedge clk) begin
    p0_literal_1 <= p0_literal_1_comb;
  end
  assign out = p0_literal_1;
endmodule

I receive the following error.

F0502 19:53:11.853288 1026329 netlist_interpreter_main.cc:170] Check failed: ::absl::OkStatus() == (xls::RealMain(netlist_path, cell_library_path, cell_library_proto_path, module_name, inputs, output_type, dump_cells)) (OK vs. UNIMPLEMENTED: Want token close-paren; got Token{kName, @2:9, "wire"}.) 

The error is referring to the line containing:

  input wire clk,

I suspect the following line will also fail.

  output wire [31:0] out

The commandline is:

bazel run //xls/tools:netlist_interpreter_main -- --cell_library=$PWD/cells.lib --netlist=$PWD/a.v --module_name=aa --input="high"

The contents of cells.lib does not seem relevant to the error.

This bug is related to: https://github.com/google/xls/issues/418

cdleary commented 3 years ago

I think this is happening because the netlist interpreter can only interpret very limited forms of structural descriptions that relate directly to a cell library (which provides us the boolean formulas) -- behavioral constructs are unsupported, but we should give a better error message than the one shown.

@RobSpringer can you do a short write-up of what the netlist interpreter can/cannot handle as tool documentation? I think informally we made it support whatever netlists we were happening to see, but I think we could write a few paragraphs to make it more clear what the boundaries roughly are.