aboutsummaryrefslogtreecommitdiffstats
path: root/testsuite/gna/issue456/gen_hex.py
blob: 28d08819fa1828ebd3d7c61a0b6b2ec7802757e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import sys
import random

n=1024
if len(sys.argv) > 1:
    n = int(sys.argv[1])

sys.stdout.write("library ieee;\n")
sys.stdout.write("use ieee.std_logic_1164.all;\n")
sys.stdout.write("\n")
sys.stdout.write("package data_pkg is\n")
sys.stdout.write("  type word_vector is array (natural range <>) of\n")
sys.stdout.write("      std_logic_vector(31 downto 0);\n")
sys.stdout.write("\n")
sys.stdout.write("  constant data : word_vector := (\n")
for i in range(n):
    sys.stdout.write("    ")
    for j in range(4):
        sys.stdout.write('x"{:08x}", '.format(random.getrandbits(32)))
    sys.stdout.write("\n")
sys.stdout.write('    x"{:08x}"\n'.format(random.getrandbits(32)))
sys.stdout.write("    );\n")
sys.stdout.write("end data_pkg;\n")