~ruther/jesd204b-vhdl

ref: bccdb9575b3284a7d712fa5b39756a07e534596a jesd204b-vhdl/testbench/data_link/functions.vhd -rw-r--r-- 605 bytes
bccdb957 — František Boháček fix: make char alignment work for part characters correctly 2 years ago
                                                                                
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
library ieee;
use ieee.std_logic_1164.all;

package testing_functions is
  function vec2str(vec: std_logic_vector) return string;
end package testing_functions;

package body testing_functions is

  function vec2str(vec: std_logic_vector) return string is
    variable result: string(vec'left + 1 downto 1);
  begin
    for i in vec'reverse_range loop
      if (vec(i) = '1') then
        result(i + 1) := '1';
      elsif (vec(i) = '0') then
        result(i + 1) := '0';
      else
        result(i + 1) := 'X';
      end if;
    end loop;
    return result;
  end;

end package body testing_functions;
Do not follow this link