Git Product home page Git Product logo

pysvinst's People

Contributors

gitter-badger avatar sgherbst avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

pysvinst's Issues

Instance name defined in a text macro doesn't work

Example:

`define MOD_INST u_mysubmod
module mymod;
mysubmod `MOD_INST (); 
endmodule

Output:

files:
  - file_name: "some_file.sv"
    defs:
      - mod_name: "mymod"
        insts:

Expected:

files:
  - file_name: "some_file.sv"
    defs:
      - mod_name: "mymod"
        insts:
          - mod_name: "mysubmod"
            inst_name: "u_mysubmod"

Instances within generate block

It seems that generate blocks are ignored in svinst/pysvinst. If you save the SV code as top.sv and the Python code as test.py, then python test.py will prove the concept. There are 16 instances described in top.sv, but only one identified by pysvinst.

// top.sv
module top (
  input logic i_clk,
  output logic [15:0] o_clks
);

  genvar i;
  generate 
    for (i=0; i < 16; i++) begin : generate_test
      my_module my_module_inst (
        .i_clk(i_clk),
        .o_clk(o_clks[i])
      );
    end : generate_test
  endgenerate

endmodule
# test.py
defs = svinst.get_defs("top.sv")
print("len(defs):", len(defs))
print("len(defs[0].insts):", len(defs[0].insts))
print("defs[0].insts[0]:", defs[0].insts[0])
# result:
"""
len(defs): 1
len(defs[0].insts): 1
defs[0].insts[0]: ModInst("my_module", "my_module_inst")
"""

It might be a little tricky to add such functionality but I don't think it would necessitate a full elaboration of the design. All that would be needed is to keep track of elab-time constants (defines/parameters/localparams/literal constants/etc...) in order to interpret a generate block's behavior accordingly. The only two constructs that would steer a generate block that I can think of are if/else (something is either instantiated or it isn't) and for loops (something is instantiated N times).

I haven't looked at the Rust code in svinst so I don't know how difficult it would be to add this functionality, but what's your guess? I'm no Rust aficionado but I'm happy to help if you reckon it ought to be within the scope of this project.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.