+ Post New Thread
Page 2 of 2 FirstFirst 1 2
Results 21 to 30 of 30
  1. #21
    Full Member level 4
    Points: 1,401, Level: 8

    Join Date
    Aug 2016
    Posts
    210
    Helped
    31 / 31
    Points
    1,401
    Level
    8

    Re: Converting Verilog to VHDL

    Quote Originally Posted by joniengr View Post
    The problem is that the code is big and I need to write VHDL for the whole code. I have done most of it but have some Verilog statements on which I have a doubt.
    ...
    Yes, I understand that. I'm just considering how you can save time for waiting for reply.

    For these short ones, you could just create two simple templates, one for Verilog and the other for VHDL. Your can cut and paste to create ports and body of codes in both, run synthesis and check the outcome. If they aren't the same, then you could ask here for the equivalent. I think that would save you some time.
    -------------
    --Akanimo.



  2. #22
    Member level 2
    Points: 226, Level: 2

    Join Date
    Nov 2018
    Posts
    43
    Helped
    0 / 0
    Points
    226
    Level
    2

    Re: Converting Verilog to VHDL

    Hi,

    I get an error on "bool_to_std_logic" function. I need to add the library but I guess it is fine if I use post #19 code instead of "bool_to_std_logic" function because it also compares two std_logic and assign std_logic to empty.

    Here I have another problem. It is left shift and power. Any idea how to convert to VHDL ?

    Code:
    wr_ptr_gray_next = wr_ptr_next ^ (wr_ptr_next >> 1);



    •   AltAdvertisment

        
       

  3. #23
    Super Moderator
    Points: 29,773, Level: 42
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    6,857
    Helped
    1635 / 1635
    Points
    29,773
    Level
    42

    Re: Converting Verilog to VHDL

    ^ is XOR not "power"
    Also >> is RIGHT shift not LEFT shift. >> 1 means dropping the least significant bit, while shifting in a 0 at the most significant bit.


    1 members found this post helpful.

  4. #24
    Member level 2
    Points: 226, Level: 2

    Join Date
    Nov 2018
    Posts
    43
    Helped
    0 / 0
    Points
    226
    Level
    2

    Re: Converting Verilog to VHDL

    This means that the equivalent VHDL of verilog statement in #22 is
    Code:
    wr_ptr_gray_next <= wr_ptr_next xor  ('0' & wr_ptr_next(GC_ADDR_WIDTH-1 downto 0));
    where the signals are already defined as
    Code:
    signal wr_ptr_next      : std_logic_vector(GC_ADDR_WIDTH downto 0);  
    signal wr_ptr_gray_next : std_logic_vector(GC_ADDR_WIDTH downto 0);



    •   AltAdvertisment

        
       

  5. #25
    Super Moderator
    Points: 29,773, Level: 42
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    6,857
    Helped
    1635 / 1635
    Points
    29,773
    Level
    42

    Re: Converting Verilog to VHDL

    Correct, that should be the equivalent VHDL version.



  6. #26
    Advanced Member level 3
    Points: 5,707, Level: 17

    Join Date
    Feb 2015
    Posts
    942
    Helped
    269 / 269
    Points
    5,707
    Level
    17

    Re: Converting Verilog to VHDL

    wr_ptr_gray_next <= wr_ptr_next xor ('0' & wr_ptr_next(wr_ptr_next'high downto wr_ptr_next'low+1));

    VHDL also has an ASR operator but I don't recall what the issues were.



    •   AltAdvertisment

        
       

  7. #27
    Member level 2
    Points: 226, Level: 2

    Join Date
    Nov 2018
    Posts
    43
    Helped
    0 / 0
    Points
    226
    Level
    2

    Re: Converting Verilog to VHDL

    Hi,

    Another statement in Verilog which is bit strange.

    Code:
    assign mem_write_data = {s00_axis_tlast, s00_axis_tdata }; 
    assign {m00_axis_tlast, m00_axis_tdata} = m00_data_reg;
    where
    m00_axis_tdata and s00_axis_tdata are 32 bit wide
    m00_axis_tlast and s00_axis_tlast are 1 bit
    m00_data_reg and mem_write_data are 34 bit wide

    I don't understand how Verilog works in assign statements because there is a mismatch of 1 bit. The tdata is 32 and tlast is 1 bit which is assigned to 34 bit wide wire in Verilog and there is no error in compilation.



  8. #28
    Super Moderator
    Points: 250,799, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    43,665
    Helped
    13281 / 13281
    Points
    250,799
    Level
    100

    Re: Converting Verilog to VHDL

    You would want to read Verilog LRM "10.7 Assignment extension and truncation". In Verilog, bit padding and truncation is performed in similar situations. VHDL in contrast requires exact matching of bit widths in assignments, you can e.g. use resize() or manual padding/truncation.



  9. #29
    Full Member level 5
    Points: 2,050, Level: 10

    Join Date
    May 2014
    Posts
    245
    Helped
    24 / 24
    Points
    2,050
    Level
    10

    Re: Converting Verilog to VHDL

    Quote Originally Posted by TrickyDicky View Post
    A google search would have helped you
    But why do you want to? all tools allow mixed language.
    I once worked at surrey satellites only to discover their license of modelsim did not allow multiple languages. You could either have only vcoms or vlibs, but heaven forbid you used both. It was probably some quirk associated to microsemi.

    Anyway, your quote although true is also false.



  10. #30
    Super Moderator
    Points: 29,773, Level: 42
    ads-ee's Avatar
    Join Date
    Sep 2013
    Location
    USA
    Posts
    6,857
    Helped
    1635 / 1635
    Points
    29,773
    Level
    42

    Re: Converting Verilog to VHDL

    Quote Originally Posted by wesleytaylor View Post
    I once worked at surrey satellites only to discover their license of modelsim did not allow multiple languages. You could either have only vcoms or vlibs, but heaven forbid you used both. It was probably some quirk associated to microsemi.

    Anyway, your quote although true is also false.
    Don't you mean you could only use vcom or vlog to compile VHDL or Verilog?

    Microsemi now ships with a version of Modelsim Pro that allows mixed simulations as they don't ship the tools with precompiled libraries for all the cores in both languages. Pretty much all tools now have default mixed support as IP cores come in one or the other and are seldom available in both.

    Oh and it wasn't a quirk with Microsemi...Modeltech (and then Mentor) always made you pay twice for Modelsim, a license to support VHDL and a license to support Verilog. It's only been relatively recent that Mentor consolidated the licensing to default to mixed simulations. I think this was around the time they dropped SE and started pushing Questa.



--[[ ]]--