Giter Club home page Giter Club logo

atom-vhdl-entity-converter's People

Contributors

lechuck42 avatar sneakypete81 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

atom-vhdl-entity-converter's Issues

Generics not extracted reliably

When converting the following, the generics are lost:

entity test is
generic (
  GENERIC1   : integer;
  GENERIC2   : integer
);
port (
  clk   : in std_logic;
  reset : in std_logic;
  clear : in std_logic
);
end test;

Keep comment and empty lines

Thanks for the effort, this is a very useful package!

I would like the components to keep all comments and empty lines. I use comments and groups separated by empty line to make the entity more readable. Se example below.

entity my_component is
   port (
      -- System signals
      clk_in               : in  std_logic;  -- 10 MHz clock
      reset_in             : in  std_logic;  -- Syncronous reset

      -- Control port
      cmd_in               : in  std_logic_vector(15 downto 0) ;    -- Command Port
      cmd_valid_in         : in  std_logic;                          -- Command Valid, 1 cycle

      -- Data port
      data                 : out std_logic_vector(15 downto 0) ;    -- Data out Port
      data_valid           : out std_logic;                         -- Data Valid, 5 cycles

      -- Error Signals
      cmd_error            : out std_logic_vector -- Invalid command
   );
end my_component;


my_component_i : my_component
port map(
   -- System signals
   clk_in               => clk_in,     -- 10 MHz clock
   reset_in             => reset_in ,  -- Syncronous reset

   -- Control port
   cmd_in               => cmd_in,    -- Command Port
   cmd_valid_in         => cmd_valid_in,  -- Command Valid, 1 cycle

   -- Data port
   data                 => data      ,    -- Data out Port
   data_valid           => data_valid,    -- Data Valid, 5 cycles

   -- Error Signals
   cmd_error           => cmd_error  -- Invalid command
);

Best regards,
Anders

comments with colons break everything

copying an entity with colons in the comments, this lines are used as ports, when copying form entity to component:

entity test_entity is
port(
      -- some command without colons
      clk : in std_logic;
      -- one word: some description
      force_block_done_active_i   : in std_logic;
      -- direct access: set block_done signal to inactive
      force_block_done_inactive_i : in std_logic;
      -- direct access: directly output this manual values to DACs
      force_block_done_inactive_i : in std_logic
);
end entity;

the component will look like this:

component test_entity
port (
	clk    : in  std_logic;
	word   : some description        force_block_done_active_i   : in std_logic;
	access : set block_done signal to inactive        force_block_done_inactive_i : in std_logic;
	access : directly output this manual values to DACs        force_block_done_inactive_i : in std_logic
);
end component test_entity;

copy as instance:

test_entity_i : test_entity
port map (
	clk    => clk,
	word   => word,
	access => access,
	access => access
);

copy as signals:

signal clk    : std_logic;
signal word   : description        force_block_done_active_i   : in std_logic;
signal access : block_done signal to inactive        force_block_done_inactive_i : in std_logic;
signal access : output this manual values to DACs        force_block_done_inactive_i : in std_logic;

Copying as component is done badly

For example, when I copy the following entity as a component:

entity test is
    generic(
        constant something: integer := 40;
        constant another_thing: time := 1 ns
    );
    port(
        c: out std_logic
    );
end entity;

the result will be:

component test
generic (
    something     : integer := 40;
    another_thing : time := 1
);
port (
    c : out std_logic
);
end component test;

So, the problems are:

  • The indentation is not preserved.
  • Time unit is removed from the end of the another_thing generic (i.e. ns).
  • is keyword is removed from the end of the entity definition beginning.
  • There is some extra whitespace added, different from the style I wrote, which is something personally I don't like.

Maybe these are separated issues. These problems prevent me from using the extension, as it takes less time to replace two entity keywords with component than fixing all these problems.

By the way, thanks for the effort. :) I hope these problems to be gone soon.

Comma separated ports are ignored

-- this entity
entity mux2t1 is
Port (A,B : in std_logic_vector(7 downto 0);
SEL : in std_logic;
MUX_OUT : out std_logic_vector(7 downto 0));
end mux2t1;

-- gets copied as a component like this
component mux2t1
port (
B : in std_logic_vector(7 downto 0);
SEL : in std_logic;
MUX_OUT : out std_logic_vector(7 downto 0)
);
end component mux2t1;

-- The signal A in is gone

Template indents seem to be fixed at 2 spaces

Hi, nice plugin. I just started using Atom.
It seems like this plugin always generates code with fixed 2-space indents. I use 4-space indents for VHDL, it would be great if the plugin could obey the indent size configured for the source file type. Or just have its own configurable indent size would be OK too.
Cheers!

entities pasted as signals with a prefix

In my designs, I use prefix on signals. This may be personal taste.

diff --git a/lib/templates.js b/lib/templates.js
index ad9c748..d146854 100644
--- a/lib/templates.js
+++ b/lib/templates.js
@@ -68,7 +68,7 @@ function instanceTemplate(entity) {
     longest = longestinArray(entity.ports, "name")
     for (port of entity.ports) {
       name = port.name.rpad(" ", longest)
-      text += `  ${name} => ${port.name},\n`
+      text += `  ${name} => s_${port.name},\n`
     }
     // Strip the final comma
     text = text.slice(0, -2)
@@ -85,7 +85,7 @@ function signalsTemplate(entity) {
     longest = longestinArray(entity.ports, "name")
     for (port of entity.ports) {
       name = port.name.rpad(" ", longest)
-      text += `signal ${name} : ${port.type};\n`
+      text += `signal s_${name} : ${port.type};\n`
     }
   }
   return text

Replacement of end-of-line is too weak

If a vhdl file contains \r\n the regexps will not detect generics or ports
change
entityText = entityText.replace(/\n/g, " ")
to
entityText = entityText.replace(/\r*\n/g, " ")

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.