Search code examples
modelsim

Is it possible to create an IP address radix in modelsim?


Is there anyway to make ip address words display in the decimal dotted format in the waves window?


Solution

  • As far as I know, not... But you could create virtual signals for the 4 parts ('virtual signal ...').
    Display those as decimal ('-radix unsigned').
    And create a group with those 4 virtual signals ('add wave ... -group ...) .

    I found creating virtual signals and groups easier in the GUI then typing it yourself in the DO file ('Tools' -> 'Virtual Builder').

    A test VHDL file:

    library ieee;
    use ieee.std_logic_1164.all;
    
    entity test is
    end entity test;
    
    architecture rtl of test is
        signal ip : std_logic_vector(31 downto 0) := x"AC_10_41_3D";  -- 172.16.65.61
    begin  -- architecture rtl
    end architecture rtl;
    

    The important parts of a wave.do file:

    quietly virtual signal -install /test { /test/ip(31 downto 24)} ip_3
    quietly virtual signal -install /test { /test/ip(23 downto 16)} ip_2
    quietly virtual signal -install /test { /test/ip(15 downto 8)} ip_1
    quietly virtual signal -install /test { /test/ip(7 downto 0)} ip_0
    add wave -noupdate /test/ip; # without formatting
    # group the 4 parts of the IP address and display them as decimal
    add wave -noupdate -expand -group {IP_formatted} -radix unsigned /test/ip_3
    add wave -noupdate -expand -group {IP_formatted} -radix unsigned /test/ip_2
    add wave -noupdate -expand -group {IP_formatted} -radix unsigned /test/ip_1
    add wave -noupdate -expand -group {IP_formatted} -radix unsigned /test/ip_0