+ Post New Thread
Results 1 to 12 of 12
  1. #1
    Junior Member level 2
    Points: 132, Level: 1

    Join Date
    Nov 2018
    Posts
    23
    Helped
    0 / 0
    Points
    132
    Level
    1

    Converting Verilog to VHDL

    Hello,

    Is there any tool exist which convert Verilog to VHDL ?

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 36,882, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,729
    Helped
    1963 / 1963
    Points
    36,882
    Level
    46

    Re: Converting Verilog to VHDL

    A google search would have helped you
    But why do you want to? all tools allow mixed language.



  3. #3
    Junior Member level 2
    Points: 132, Level: 1

    Join Date
    Nov 2018
    Posts
    23
    Helped
    0 / 0
    Points
    132
    Level
    1

    Re: Converting Verilog to VHDL

    I have found a working example in Verilog and I need to modify it but I need to do it in VHDL rather then Verilog.



    •   AltAdvertisment

        
       

  4. #4
    Full Member level 3
    Points: 1,197, Level: 7

    Join Date
    Aug 2016
    Posts
    173
    Helped
    22 / 22
    Points
    1,197
    Level
    7

    Re: Converting Verilog to VHDL

    WhI checked vendor's tool are you planning to use?
    -------------
    --Akanimo.



    •   AltAdvertisment

        
       

  5. #5
    Advanced Member level 5
    Points: 36,882, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,729
    Helped
    1963 / 1963
    Points
    36,882
    Level
    46

    Re: Converting Verilog to VHDL

    Quote Originally Posted by joniengr View Post
    I have found a working example in Verilog and I need to modify it but I need to do it in VHDL rather then Verilog.
    Why? All tools accept both languages. Maybe this gives the opportunity to learn Verilog? its not that hard to do if you understand VHDL.



  6. #6
    Member level 5
    Points: 643, Level: 5

    Join Date
    Dec 2017
    Location
    Bydgoszcz - Poland
    Posts
    80
    Helped
    16 / 16
    Points
    643
    Level
    5

    Re: Converting Verilog to VHDL

    Quote Originally Posted by joniengr View Post
    Hello,

    Is there any tool exist which convert Verilog to VHDL ?
    Hello,

    some time ago I found "Icarus Verilog" free tool:

    http://iverilog.icarus.com/

    It basically works, but translated code is such poor - that I decided to translate code "by7 hand".

    Regards



  7. #7
    Junior Member level 2
    Points: 132, Level: 1

    Join Date
    Nov 2018
    Posts
    23
    Helped
    0 / 0
    Points
    132
    Level
    1

    Re: Converting Verilog to VHDL

    Hi again,

    I can understand the I/O Deceleration and most of the code but the code in between where signals and variable are defined is difficult in Verilog. Can someone please explain or translate into VHDL ?

    Code Verilog - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    
    reg [C_AXIS_TDATA_WIDTH+2-1:0] mem[(2**ADDR_WIDTH)-1:0]; 
    reg [C_AXIS_TDATA_WIDTH+2-1:0] mem_read_data_reg = {C_AXIS_TDATA_WIDTH+2{1'b0}};  
    reg mem_read_data_valid_reg = 1'b0, mem_read_data_valid_next; 
    wire [C_AXIS_TDATA_WIDTH+2-1:0] mem_write_data; 
     
    reg [C_AXIS_TDATA_WIDTH+2-1:0] m00_data_reg = {C_AXIS_TDATA_WIDTH+2{1'b0}};  
      
    reg m00_axis_tvalid_reg = 1'b0, m00_axis_tvalid_next; 
     
    // full when first TWO MSBs do NOT match, but rest matches 
    // (gray code equivalent of first MSB different but rest same) 
    wire full = ((wr_ptr_gray_reg[ADDR_WIDTH] != rd_ptr_gray_sync2_reg[ADDR_WIDTH]) && 
                 (wr_ptr_gray_reg[ADDR_WIDTH-1] != rd_ptr_gray_sync2_reg[ADDR_WIDTH-1]) && 
                 (wr_ptr_gray_reg[ADDR_WIDTH-2:0] == rd_ptr_gray_sync2_reg[ADDR_WIDTH-2:0])); 
    // empty when pointers match exactly 
    wire empty = rd_ptr_gray_reg == wr_ptr_gray_sync2_reg; 
     
    // control signals 
    reg write; 
    reg read; 
    reg store_output; 
     
    assign s00_axis_tready = ~full & ~s00_rst_sync3_reg; 
     
    assign m00_axis_tvalid = m00_axis_tvalid_reg; 
     
    assign mem_write_data = {s00_axis_tlast, s00_axis_tdata}; 
    assign {m00_axis_tlast, m00_axis_tdata} = m00_data_reg;
    Last edited by andre_teprom; 10th December 2018 at 11:47. Reason: added SYNTAX tags



  8. #8
    Advanced Member level 5
    Points: 36,882, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,729
    Helped
    1963 / 1963
    Points
    36,882
    Level
    46

    Re: Converting Verilog to VHDL

    Why not find yourself a verilog tutorial?



    •   AltAdvertisment

        
       

  9. #9
    Super Moderator
    Points: 29,664, Level: 42
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    6,843
    Helped
    1628 / 1628
    Points
    29,664
    Level
    42

    Re: Converting Verilog to VHDL

    Code Verilog - [expand]
    1
    
    ]reg [C_AXIS_TDATA_WIDTH+2-1:0] mem[(2**ADDR_WIDTH)-1:0];
    use signal and a std_logic_vector array type.

    Code Verilog - [expand]
    1
    
    reg [C_AXIS_TDATA_WIDTH+2-1:0] mem_read_data_reg = {C_AXIS_TDATA_WIDTH+2{1'b0}};
    mem_read_data_reg is assigned an initial value of all 0's

    Code Verilog - [expand]
    1
    
    reg mem_read_data_valid_reg = 1'b0, mem_read_data_valid_next;
    This isn't correct, I'm suprised it compiles {} should be around the RHS stuff for concatenate.

    Code Verilog - [expand]
    1
    2
    3
    4
    5
    
    // full when first TWO MSBs do NOT match, but rest matches 
    // (gray code equivalent of first MSB different but rest same) 
    wire full = ((wr_ptr_gray_reg[ADDR_WIDTH] != rd_ptr_gray_sync2_reg[ADDR_WIDTH]) && 
                 (wr_ptr_gray_reg[ADDR_WIDTH-1] != rd_ptr_gray_sync2_reg[ADDR_WIDTH-1]) && 
                 (wr_ptr_gray_reg[ADDR_WIDTH-2:0] == rd_ptr_gray_sync2_reg[ADDR_WIDTH-2:0]));
    combined signal declaration of full and a continous assignment, in vhdl you will make a signal of std_logic, and then assign full with the RHS stuff.
    != is /=
    && is logic AND
    == is =

    Code Verilog - [expand]
    1
    
    assign s00_axis_tready = ~full & ~s00_rst_sync3_reg;
    ~ is NOT
    & is bit-wise AND

    Code Verilog - [expand]
    1
    
    assign m00_axis_tvalid = m00_axis_tvalid_reg;
    in VHDL
    signal m00_axis_tvalid : std_logic;
    m00_axis_tvalid <= m00_axis_tvalid_reg;


    Code Verilog - [expand]
    1
    
    assign mem_write_data = {s00_axis_tlast, s00_axis_tdata};
    { , } is & (contatenate)

    Code Verilog - [expand]
    1
    
    assign {m00_axis_tlast, m00_axis_tdata} = m00_data_reg;
    I don't think there is an equivalent in VHDL just assign the slices of m00_data_reg to the two LHS signals, you can use the 'left, 'right stuff to get the indicies to use based on the LHS signals.


    1 members found this post helpful.

  10. #10
    Advanced Member level 5
    Points: 36,882, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,729
    Helped
    1963 / 1963
    Points
    36,882
    Level
    46

    Re: Converting Verilog to VHDL

    I don't think there is an equivalent in VHDL
    Vhdl 2008 allows aggregate assignments

    (Bit1, vector2bit) <= vector3bit;



  11. #11
    Junior Member level 2
    Points: 132, Level: 1

    Join Date
    Nov 2018
    Posts
    23
    Helped
    0 / 0
    Points
    132
    Level
    1

    Re: Converting Verilog to VHDL

    Hi,

    Is it possible to use 'signal' in VHDL in place of 'wire' and 'reg' in Verilog ?

    The following syntax is confusing.

    parameter ADDR_WIDTH = 12,
    parameter C_AXIS_TDATA_WIDTH = 32
    reg [C_AXIS_TDATA_WIDTH+2-1:0] mem[(2**ADDR_WIDTH)-1:0];

    It create a reg 'mem' but the dimension 2^12 - 1 = 4096 - 1 = 4095 is not the same in LHS. Any explanation on this ?

    Why it is not written as
    reg [C_AXIS_TDATA_WIDTH+2-1:0] mem


    Also in the following. Is it defining two reg 'mem_read_data_valid_next' and 'mem_read_data_valid_reg' ? If yes then what are the dimensions of both ?
    reg mem_read_data_valid_reg = 1'b0, mem_read_data_valid_next;
    Last edited by joniengr; Yesterday at 14:53.



  12. #12
    Advanced Member level 5
    Points: 36,882, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,729
    Helped
    1963 / 1963
    Points
    36,882
    Level
    46

    Re: Converting Verilog to VHDL

    Is it possible to use 'signal' in VHDL in place of 'wire' and 'reg' in Verilog ?
    Yes


    reg [C_AXIS_TDATA_WIDTH+2-1:0] mem[(2**ADDR_WIDTH)-1:0];
    this is an array declaration - 4096 words (assuming ADDR_WIDTH = 12) @ (C_AXIS_TDATA_WIDTH+2) bits for each word
    equivolent to this:

    Code:
    type ram_t is array(2**ADDR_WIDTH-1 downto 0) of std_logic_vector(C_AXIS_TDATA_WIDTH+2-1 downto 0);
    signal mem : ram_t;
    You really should look into a verilog tutorial.



--[[ ]]--