yosys-slang: OSS CAD suite apparently distributing stale (broken) build

Hi,

I am fairly new to Yosys, so far I have only read Verilog files. Now I would like to read SystemVerilog files with this plugin. However I cannot get a basic example like the fifo below to be read. I wonder if anyone could help or point me in some direction.

yosys> debug read_slang ../rtl/design/test/fifo.v --top fifo -D DEBUG

1. Executing SLANG frontend.
Adding clk (Variable)
Adding rst (Variable)
Adding wrdata_i (Variable)
Adding wr_i (Variable)
Adding rddata_o (Variable)
Adding rd_i (Variable)
Adding s_mem_flat (Variable)
Adding s_wr_ptr (Variable)
Adding s_rd_ptr (Variable)
ERROR: Exception: vector::_M_range_check: __n (which is 0) >= this->size() (which is 0)

The file does compile in the slang explorer: https://sv-lang.com/explore/

fifo.v:

module fifo (
    input logic clk,
    input logic rst,
    input logic [7:0] wrdata_i,
    input logic wr_i,
    output logic [7:0] rddata_o,
    input logic rd_i
);

    logic [127:0] s_mem_flat; // DEPTH=16, WIDTH=8
    logic [3:0] s_wr_ptr, s_rd_ptr; // PTR_WIDTH=4

    always_ff @(posedge clk or negedge rst) begin
        if (!rst) begin
            s_mem_flat <= '0;
        end else if (wr_i) begin
            s_mem_flat[(s_wr_ptr * 8) +: 8] <= wrdata_i;
        end
    end

    always_ff @(posedge clk) begin
        if (rd_i) begin
            rddata_o <= s_mem_flat[(s_rd_ptr * 8) +: 8];
        end
    end
endmodule

Is there something we should be doing different? Any help would be great. Thanks in advance.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (16 by maintainers)

Most upvoted comments

It should build and work fine with the last few yosys releases, including the latest. I think I will document this and make the CI validate it. Building with yosys master is a moving target so I can’t assure it.