+ Post New Thread
Results 1 to 4 of 4
  1. #1

    [Moved]How to convert a vhdl code to verilog code

    this is the code for converting decimal to binary in vhdl.How to cinvert a vhdl code to verilog code

    Code VHDL - [expand]
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    
    library IEEE;
     use ieee.std_logic_1164.all;
    use IEEE.numeric_std.all;
    --
     
    entity decimal is
    end decimal;
     
    architecture beh of decimal is
    signal  my_sulv1 : std_ulogic_vector(15 downto 0);
    signal my_int : integer range 0 to 100;
    signal  my_sulv2 : std_ulogic_vector(15 downto 0);
    --
    begin
    my_int <= to_integer(unsigned(my_sulv1));
     
    my_sulv2 <= std_ulogic_vector(to_unsigned(my_int, 16));
    end beh;
    Last edited by ads-ee; 13th November 2017 at 17:03. Reason: added syntax tags

    •   Alt11th November 2017, 18:58

      advertising

        
       

  2. #2
    Member level 3
    Points: 429, Level: 4

    Join Date
    Apr 2017
    Posts
    67
    Helped
    12 / 12
    Points
    429
    Level
    4

    Re: How to cinvert a vhdl code to verilog code

    You can use for example this translator: http://www.edautils.com/vhdl2verilog.html



    •   Alt11th November 2017, 20:57

      advertising

        
       

  3. #3
    Super Moderator
    Points: 236,290, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    40,849
    Helped
    12488 / 12488
    Points
    236,290
    Level
    100

    Re: How to cinvert a vhdl code to verilog code

    I believe the question involves a misunderstanding. The VHDL integer type isn't specifically related to decimal number representation. Integer quantities can be represented with different base, e.g. decimal, hexadecimal, octal, binary.

    Integer is a general-purpose type that can be either used abstracted from logic hardware, or infer signed and unsigned numbers in hardware.

    The shown code doesn't involve an actual conversion, except for a number truncation to 7 bit unsigned (in hardware synthesis) or 0 to 100 range check in simulation.



    •   Alt12th November 2017, 12:17

      advertising

        
       

  4. #4
    Advanced Member level 3
    Points: 6,795, Level: 19
    Achievements:
    7 years registered Created Blog entry
    dpaul's Avatar
    Join Date
    Jan 2008
    Location
    Germay
    Posts
    983
    Helped
    218 / 218
    Points
    6,795
    Level
    19
    Blog Entries
    1

    Re: How to cinvert a vhdl code to verilog code

    Other than the correctness of the code, I have inhibitions on the free software/s that claim to convert VHDL to Verilog and vice-versa (#2).
    Basically the best way is to do it manually. But this not necessary (if this is not your homework assignment) as most simulators and synth engines support mixed mode HDL designs.
    Also you have posted this in the wrong sub-forum.
    .....yes, I do this for fun!



--[[ ]]--