#!/usr/bin/env python

from __future__ import print_function
import os, sys

while 1 :
	print("0  -  EXIT")
	print("######## WATCH ########")
	print("1  -  Netlist watch")
	print("2  -  ASM watch")
	print("3  -  OCAML watch")
	print("*c -  compiled mode")
	print("*m -  max speed")
	print("*t -  text mode")
	print("######## DIAG  ########")
	print("4  -  counter mod 10 diag")
	print("Choice : ",end="")

	s = raw_input()

	i = int(s[0])
	comp = False
	maxs = False
	text = False
	if s.find('c')!=-1 :
		comp = True
	if s.find('m')!=-1 :
		maxs = True
	if s.find('t')!=-1 :
		text = True

	command = ""
	if i==0 :
		sys.exit(0)

	# Watch
	args = "-n 0"
	if text :
		args += " --watch"
	else :
		args += " --watch2"

	if comp :
		args += " -c"

	if i==1 :
		if not maxs :
			args += " -p 0.0009765625"
		command = 'make netlists/watch.run SIM_FLAGS="%s"' % args
	if i==2 :
		if not maxs :
			args += " -p 0.005"
		command = 'make ../asm/tests/watch.asm.run SIM_FLAGS="%s"' % args
	if i==3 :
		if not maxs :
			args += " -p 0.0001"
		command = 'make ../mimo/testMicro/watch.ml.run SIM_FLAGS="%s"' % args

	# Diag
	if i==4 :
		command = 'make netlists/counter10.run SIM_FLAGS="--diag"'

	print("Execute : %s" % command)
	os.system(command)

	raw_input()

