"sim/prsim/TODO"
#	$Id: TODO,v 1.8 2009/02/01 07:21:43 fang Exp $

===============================================================================
Simulation:

	Little buglet:
	* when interpreter reports syntax error, position is wrong because
		the construction of each token-position uses the 
		hackt-lexer/AST's global node_position.  
		the instref-lexer is incrementing only it's own private
		position counter.  This can be addressed by using a 
		stack of token positions, once we get to more advanced
		lexer generation manipulation.  Then each lexer/parser
		may use it's own and temporarily save away the previous
		counter.  

prsim:
	Add guile/Scheme interface for static queries and simulation control!
	
	category of 'debug' commands for inspecting state, etc...
		memory analysis, invariant checking

	weak vs. possible: rename formerly 'weak' anomalies to 'possible'
		to avoid confusion with weak-rules.  (poor naming)

	direction-specific breakpoints

	breakpoint policies *per-node*
	breakpoint options: halt or error-out

	breakpoint might want to return to interaction with user
		momentarily (fix and continue), and let a 'continue'
		command return to the previous point in the script.  
		In batch-mode, will just continue.  
		Also needs a 'where' command to show file-stack and 
			line positions for reference.

	channel commands:
		channel-auto : auto-infer channel type
			what about initial ack? (leave that to bucket)
		channel-type (map types to defchan)
		test bundles
		delay control for setting and resetting source/sinks
		value formatting input and output

	timestamp last causes -- automatic cycle time
		Will cost some more memory per node.
		Difficulty: easy (hour)
		Consider the cost of increased memory! 'memstats'
		alternative: support trace files

	causes: sometimes a rule firing is attributed to the opposite
		pull turning *off* ... do we attribute the cause to the
		rule that turned off or the rule that was on?
		Is there a clean way to keep track? with cause flags?

	'backtrace' add optional starting value argument, 
		default uses current value.

	unstab attribute: is checked on nodes, but only applied to rules
		so this needs to be fixed to check for rules.  
		Should wipe it from node attributes.
		Difficulty: easy (few hours)
		Q: what should unstable policy do? dequeue? re-queue overtake?
		This would require events to track which *rule* caused firing.

	interpreter commands:
		interp key [value]
			for interpreter mode flags:
			termination conditions: assert, syntax error, 
				bad-argument,...
			echo on, echo off (only heeded in batch mode)
		watch processes and structures?
		'getall-unique' (remove duplicates)
		vector support:
			Q: do we allow nodes to belong to multiple vectors?
				current state of old prsims cannot.
		use getopt-style interpretation?
		fix 'getall' to work with arrays (getall x, where x is array)
			dies on member arrays, but not top-level arrays
		line-continuation with '\'

	concept of environment variables?

	far future: expression evaluation! variable expansion!
		make use of existing interpreter functions in parser/
		better yet: attach guile Scheme interpreter (gprsim)

	Q: should initialize clear the watching state?
		in the old prsim, watch/break points are preserved
		so we keep that behavior for now.  

	for cleanliness:
		rewrite event queuing system to go through
			a pending map first before entering queue.
		rationale: current algorithm is a mess of cases.

	checking: mode to verify that all rules are CMOS implementable

	minor bug: fanout prints duplicate rules because literal
		may appear in different branches of same rule.  
		fix: collect unique-list (or set), then print

	trace recording, playback, and analysis (like chpsim)
		[actively developing...]

graph-dumping:
	after restructuring rule maps by process (like chpsim),
	print out graph node in process clusters

execution model:
	weak rules (drive floating nodes, overpowered by normal rules)
		[status: drafted]
	TODO: interaction with coerced exclusive hi/lo rings?

mk and check rings:
	sort/order rings to eliminate duplicates which arise from
		poor hierarchy in the source.  
		e.g. use lexicograpichal ordering.  
		[difficulty: easy]
	filter rings that are strict subsets of others (redundancy)
		[difficulty: more difficult, got algorithm?]

further memory scalability:
	after the -prsim-10 merge, which brought significant memory 
	improvement, there is still room for improvement.
	A large chunk of the remaining memory lies in the frame maps
	and global entries of large empty processes that are just
	for the sake of connection in the hierarchy.  
	Can these be reduced?

sprsim:
	size-based timing prsim
	connect with chpsim in mixed simulation
	back for back-annotating sized-based delays to chpsim

grusim (pronounced 'gruesome')
	the GRand Unified SIMulator, haha.

parallelization:
	be able to run multiple instances of a manually partitioned
		hacprsim, by connecting their top-level instances
		through an interface, and managing through a 
		meta simulator (one simulator to combine them).  
		Might be able to multi-thread this way?
	Might be easier now, with per-process structuring...

===============================================================================
