tlm_noc_sim/scripts/gen_map_random.py

26 lines
464 B
Python

import random
NET_SIZE_X = 4
NET_SIZE_Y = 4
NET_SIZE_Z = 1
NUM_TASKS = 84
MAP_START = """<?xml version="1.0" ?>
<map xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">"""
BIND = """ <bind>
<task value="{}"/>
<node value="{}"/>
</bind>"""
MAP_END = "</map>"
NUM_NODES = NET_SIZE_X*NET_SIZE_Y*NET_SIZE_Z
print(MAP_START)
for i in range(NUM_TASKS):
node_id = random.randint(0, NUM_NODES-1)
print(BIND.format(i, node_id))
print(MAP_END)