Git Product home page Git Product logo

Comments (2)

kraigher avatar kraigher commented on June 3, 2024

Should be fixed now. The component entity class of the attribute specification was missing. Now your sample code works except it contains a syntax error with a comma at the last port mapping in Inst_sample2.

from rust_hdl.

Xcodo avatar Xcodo commented on June 3, 2024

Thanks for that. I tried it on the libraries today. There's another couple of EntityClass needed to successfully parse the common standard libraries Xilinx uses.

Here's an updated sample with examples of the other types I encountered:

entity sample1 is
  port (
    CLK : in std_logic;
    nCLK : out std_logic
  );
end entity;

architecture a of sample1 is

  --From numeric_std.vhd line:1302
  function "abs" (ARG: SIGNED) return SIGNED is
    constant ARG_LEFT: INTEGER := ARG'LENGTH-1;
    alias XARG: SIGNED(ARG_LEFT downto 0) is ARG;
    variable RESULT: SIGNED(ARG_LEFT downto 0);
    -- Exemplar synthesis directives :
    attribute IS_SIGNED of ARG:constant is TRUE ;
    attribute SYNTHESIS_RETURN of RESULT:variable is "ABS" ;
  begin
    if ARG'LENGTH < 1 then return NAS;
    end if;
    RESULT := TO_01(XARG, 'X');
    if (RESULT(RESULT'LEFT)='X') then return RESULT;
    end if;
    if RESULT(RESULT'LEFT) = '1' then
      RESULT := -RESULT;
    end if;
    return RESULT;
  end "abs";
  
  --From std_logic_1164.vhd:42
  TYPE std_ulogic IS ( 'U',  -- Uninitialized
                       'X',  -- Forcing  Unknown
                       '0',  -- Forcing  0
                       '1',  -- Forcing  1
                       'Z',  -- High Impedance   
                       'W',  -- Weak     Unknown
                       'L',  -- Weak     0       
                       'H',  -- Weak     1       
                       '-'   -- Don't care
                      );

     ATTRIBUTE logic_type_encoding : string ;
     ATTRIBUTE logic_type_encoding of std_ulogic:type is
                     ('X','X','0','1','Z','X','0','1','X') ;

  component sample2 is
    port (
      CLK : in std_logic;
      nCLK : out std_logic
    );
  end component sample2;

  attribute BOX_TYPE : string;
  attribute BOX_TYPE of sample2 : component is "user_black_box";

begin

  Inst_sample2 : sample2
    port map	(
      CLK <= CLK,
      nCLK <= nCLK
    );
end a;

entity sample2 is
  port (
    CLK : in std_logic;
    nCLK : out std_logic
  );
end entity;

architecture a of sample2 is
  signal s_nclk : std_logic;
begin

  s_nclk <= not CLK;
  nCLK <= s_nclk;

end a;

I've no experience in Rust, but based on your change last night I went ahead and added the additional entity classes and re-tested. I can now parse my whole project including the libraries. I'll add a pull request now.

from rust_hdl.

Related Issues (20)

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.