aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/bug011/phonybench.vhdl
blob: 040980454bc207f84ca263142f2471e6edfd5bca (plain)
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;

entity phonybench is
	generic (
		GENSTR   : string := "adrien";
		GENSTDLV : std_logic_vector(5 downto 0) := "111000";
		GENSTDL  : std_logic := '1';
		GENNAT   : natural := 22
	);
end phonybench;

architecture bench of phonybench is

	type char2std_t is array(character) of std_ulogic;

	constant char2std_c : char2std_t := (
		'U' => 'U',
		'X' => 'X',
		'0' => '0',
		'1' => '1',
		'Z' => 'Z',
		'W' => 'W',
		'L' => 'L',
		'H' => 'H',
		'-' => '-',
		others => 'X'
	);

	function str2std(arg : string) return std_logic_vector is
		variable result : std_logic_vector(arg'length - 1 downto 0);
		variable j : integer;
	begin
		j := arg'length - 1;
		for i in arg'range loop
			result(j) := char2std_c(arg(i));
			j := j - 1;
		end loop;
		return result;
	end function;

	signal sigvec1  : std_logic_vector(5 downto 0) := str2std(GENSTR);
	signal sigvec2  : std_logic_vector(5 downto 0) := GENSTDLV;
	signal siglog   : std_logic := GENSTDL;
	signal signat   : natural := GENNAT;

	signal clk : std_logic := '0';

begin

	clk <= not clk after 5 ms;

	sigvec1 <= str2std(GENSTR);
	sigvec2 <= GENSTDLV;
	siglog  <= GENSTDL;
	signat  <= GENNAT;

end architecture;