Giter Site home page Giter Site logo

m47812 / hdl_converter Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 2.0 373 KB

A simple tool that can be used to convert the header syntax of a verilog module or VHDL entity to an instantiation syntax and create testbench structures (top level and verify). The project is aimed at removing the need for tedious refactoring of module headers when instantiating modules or verifying individual modules with testbenches.

License: GNU Affero General Public License v3.0

C# 100.00%
verilog hdl small-tools fpga hardware-description-language testbench verification vhdl

hdl_converter's People

Contributors

m47812 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

surelion jihanjoo

hdl_converter's Issues

Module crashes when using comment as first line

Example of problem

module test
#(
parameter myParam1 = 12,
parameter myParam2 = 2
)
(
//==========> !!!!THIS COMMENT IS A PROBLEM!!!! <<==============
input wire clock, //No problem
input wire reset,
//This comment is fine
output wire [7:0] busOut,
inout wire someSignal
//This is also ok
);

Problems when using "," in comments

Verilog uses "," as a separate character. When also using "," in the signal description comments the separation by "," does not work. Error was attempted to fix with the following method to clean the split. It was Removed again because it leads to other possibly more severe issues in the last signal which does not have a comma in Verilog. A Better solution would be to rebuild separate elements and use a different method to separate the elements.

        /// This Function Cleans splits that happend from comments containing a separation charracter like "," 
        /// that is used in code.
        /// </summary>
        /// <param name="input">A string splited by the separation character of the HDL language (Verilog --> ,)</param>
        /// <param name="commentChar">The Syntax for a Comment in the HDL (Verilog --> "//")</param>
        /// <returns>the cleand verion of the input data</returns>
        public static string[] cleanSplitedElements(string[] input, string commentChar)
        {
            if (input.Length == 1) return input;
            List<string> correctedSplited = new List<string>();
            for (int i = 0; i < input.Length - 1; i++)
            {
                if (input[i].Contains(commentChar) && !input[i].Contains(System.Environment.NewLine))
                {
                    correctedSplited.Add(input[i] +" "+ input[i + 1]);
                    i++;
                }
                else
                {
                    correctedSplited.Add(input[i]);
                    if(i == input.Length - 2) correctedSplited.Add(input[i+1]);
                }
            }
            return correctedSplited.ToArray();
        }

Instantiation name placed wrong

For instantiations with parameters in Verilog.
The instance name is currently paced right after the module name but should be between parameters and IO Ports.

Should be:

mymodule
#(
//Some Parameters
)
 inst_mymodule
(
//Some IOs
)

Currently is:

mymodule inst_mymodule
#(
//Some Parameters
)
(
//Some IOs
)

Unsupported Syntax versions for Verilog

The Following Syntax versions lead to problems with the decoding mechanism.

reg instead of wire:
output reg signal_valid

Debug Wires:
(* mark_debug = "true" *) input wire valid_signal0,

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.