#!/bin/csh -f

alias BEGIN 'cat <<END'

BEGIN
/* Output files for CAM chip (edf.v file) */

\`timescale 1 ns / 10 ps

module camout ;

	parameter cycle = 1000 ;

	// file output variables
	integer
		cam1file,	// displays opr, tr, midr, gidr, ecb, control signals
		cam2file,	// displays opr, regs 1-14
		cam3file,	// displays opr, regs 15, 17, 18
		cam4file,	// displays opr, regs 19-28
		cam5file;	// displays node logic

	always @(posedge system.sb_clk)
		if (system.idebug)
		begin
		#(cycle-1) ;
END


@ i = 0
while ( $i < $3 )

  @ j = 0
  while ( $j < $2 )

    @ k = 0
    while ( $k < $1 )

BEGIN

		\$fstrobe (cam1file, \$stime,
			" %h %h %h %h  %h %h %h  %h %h  %h %h %h %h  %h %h %h %h  %h%h%h%h%h %h%h%h%h%h %h%h%h%h",

			// opcode register
			{
			U${i}${j}.U0${k}.u1.u13.u16.\opc[4] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[3] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[2] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[1] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[0] 
			},

			// Module select ("target") register
			{
			U${i}${j}.U0${k}.u1.u13.u15.u193.q,
			U${i}${j}.U0${k}.u1.u13.u15.u192.q,
			U${i}${j}.U0${k}.u1.u13.u15.u191.q
			},

			// Module ID register
			U${i}${j}.U0${k}.u1.u13.u15.u237.q,

			// Group ID register
			U${i}${j}.U0${k}.u1.u13.u15.u177.q,

			// Module select signals
			U${i}${j}.U0${k}.u1.u13.u15.modsel_out,
			U${i}${j}.U0${k}.u1.u13.u15.modsel_en,
			U${i}${j}.U0${k}.u1.u13.u15.selected,

			// Write/read_n signal
			U${i}${j}.U0${k}.u1.u13.u16.w_r,
			U${i}${j}.status_out,

			// pbus signals
			U${i}${j}.n_dl,
			U${i}${j}.n_lsin,
			U${i}${j}.lsout,
			U${i}${j}.n_iosel,

			U${i}${j}.n_dr,
			U${i}${j}.n_rsin,
			U${i}${j}.rsout,
			U${i}${j}.ioout,

			// Node logic
			U${i}${j}.U0${k}.u1.u14.c_dout_en_n,
			U${i}${j}.U0${k}.u1.u14.c_dout,
			U${i}${j}.U0${k}.u1.u14.nbf,
			U${i}${j}.U0${k}.u1.u14.u34.wren_n,
			U${i}${j}.U0${k}.u1.u14.u34.rden_n,

			U${i}${j}.U0${k}.u1.u14.u34.rs1in,
			U${i}${j}.U0${k}.u1.u14.u34.rs2in,
			U${i}${j}.U0${k}.u1.u14.u34.lsin,
			U${i}${j}.U0${k}.u1.u14.u34.din,
			U${i}${j}.U0${k}.u1.u14.u34.dout,

			U${i}${j}.U0${k}.u1.u14.u34.ioout,
			U${i}${j}.U0${k}.u1.u14.u34.lsout,
			U${i}${j}.U0${k}.u1.u14.u34.rsout,
			U${i}${j}.U0${k}.u1.u14.u34.data_in_sel
			);

		\$fstrobe (cam2file, \$stime,
			"  %h  %h %h %h %h %h  %h %h %h %h %h  %h %h %h",

			// opcode register
			{
			U${i}${j}.U0${k}.u1.u13.u16.\opc[4] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[3] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[2] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[1] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[0] 
			},

			// Module select ("target") register
			// register 1 (run)
			{
			U${i}${j}.U0${k}.u1.u10.u6.u180\$1.q,
			U${i}${j}.U0${k}.u1.u10.u6.u180\$2.q,
			U${i}${j}.U0${k}.u1.u10.u6.u180\$3.q,
			U${i}${j}.U0${k}.u1.u10.u6.u180\$4.q,
			U${i}${j}.U0${k}.u1.u10.u6.u180\$5.q,
			U${i}${j}.U0${k}.u1.u10.u6.u180\$6.q
			},

			// register 2 (kick)
			{
			U${i}${j}.U0${k}.u1.u10.u3.u325\$1.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$2.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$3.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$4.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$5.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$6.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$7.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$8.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$9.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$10.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$11.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$12.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$13.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$14.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$15.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$16.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$17.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$18.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$19.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$20.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$21.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$22.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$23.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$24.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$25.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$26.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$27.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$28.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$29.q,
			U${i}${j}.U0${k}.u1.u10.u3.u325\$30.q
			},

			// register 3 (sa-bit)
			// for Verilog behavioral model
//			{
//			U${i}${j}.U0${k}.u1.u10.u1.u160.q4,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.q3,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.q2,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.q1,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.q0
//			},

//			{
//			U${i}${j}.U0${k}.u1.u10.u1.u160.\u56\$1 .q ,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.\u56\$1 .q ,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.\u56\$1 .q ,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.\u56\$1 .q ,
//			U${i}${j}.U0${k}.u1.u10.u1.u160.\u56\$1 .q 
//			},

			5'hx,

			// register 4 (lut-src)
			{
			U${i}${j}.U0${k}.u1.u11.u12.u344.u346\$1.q,
			U${i}${j}.U0${k}.u1.u11.u12.u344.u346\$2.q,
			U${i}${j}.U0${k}.u1.u11.u12.u344.u346\$3.q,
			U${i}${j}.U0${k}.u1.u11.u12.u344.u346\$4.q,
			U${i}${j}.U0${k}.u1.u11.u12.u344.u346\$5.q,
			U${i}${j}.U0${k}.u1.u11.u12.u344.u346\$6.q
			},

			// register 5 (fly-src)
			{
			U${i}${j}.U0${k}.u1.u11.u12.u345.u346\$1.q,
			U${i}${j}.U0${k}.u1.u11.u12.u345.u346\$2.q,
			U${i}${j}.U0${k}.u1.u11.u12.u345.u346\$3.q,
			U${i}${j}.U0${k}.u1.u11.u12.u345.u346\$4.q,
			U${i}${j}.U0${k}.u1.u11.u12.u345.u346\$5.q,
			U${i}${j}.U0${k}.u1.u11.u12.u345.u346\$6.q
			},

			// register 6 (site-src)
			{
			U${i}${j}.U0${k}.u1.u11.u12.u348.u346\$1.q,
			U${i}${j}.U0${k}.u1.u11.u12.u348.u346\$2.q,
			U${i}${j}.U0${k}.u1.u11.u12.u348.u346\$3.q,
			U${i}${j}.U0${k}.u1.u11.u12.u348.u346\$4.q,
			U${i}${j}.U0${k}.u1.u11.u12.u348.u346\$5.q,
			U${i}${j}.U0${k}.u1.u11.u12.u348.u346\$6.q
			},

			// register 7 (event-src)
			{
			U${i}${j}.U0${k}.u1.u11.u12.u346.u346\$1.q,
			U${i}${j}.U0${k}.u1.u11.u12.u346.u346\$2.q,
			U${i}${j}.U0${k}.u1.u11.u12.u346.u346\$3.q,
			U${i}${j}.U0${k}.u1.u11.u12.u346.u346\$4.q,
			U${i}${j}.U0${k}.u1.u11.u12.u346.u346\$5.q,
			U${i}${j}.U0${k}.u1.u11.u12.u346.u346\$6.q
			},

			// register 8 (display)
			{
			U${i}${j}.U0${k}.u1.u11.u12.u347.u346\$1.q,
			U${i}${j}.U0${k}.u1.u11.u12.u347.u346\$2.q,
			U${i}${j}.U0${k}.u1.u11.u12.u347.u346\$3.q,
			U${i}${j}.U0${k}.u1.u11.u12.u347.u346\$4.q,
			U${i}${j}.U0${k}.u1.u11.u12.u347.u346\$5.q,
			U${i}${j}.U0${k}.u1.u11.u12.u347.u346\$6.q
			},

			// register 9 (show-scan)
			U${i}${j}.U0${k}.u1.u10.u6.u94.q,

			// register 10 (event)
			{
			U${i}${j}.U0${k}.u1.u11.u10.u1.\q[4] ,
			U${i}${j}.U0${k}.u1.u11.u10.u1.\q[3] ,
			U${i}${j}.U0${k}.u1.u11.u10.u1.\q[2] ,
			U${i}${j}.U0${k}.u1.u11.u10.u1.\q[1] ,
			U${i}${j}.U0${k}.u1.u11.u10.u1.\q[0] 
			},

			// register 11 (lut-index)
			{
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[7] ,
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[6] ,
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[5] ,
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[4] ,
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[3] ,
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[2] ,
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[1] ,
			U${i}${j}.U0${k}.u1.u33.u23.u83.\q[0] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[7] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[6] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[5] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[4] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[3] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[2] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[1] ,
			U${i}${j}.U0${k}.u1.u33.u23.u84.\q[0] 
			},

			// register 12 (lut-perm)
			{
			U${i}${j}.U0${k}.u1.u33.u23.u87\$1.q,
			U${i}${j}.U0${k}.u1.u33.u23.u87\$2.q,
			U${i}${j}.U0${k}.u1.u33.u23.u87\$3.q,
			U${i}${j}.U0${k}.u1.u33.u23.u87\$4.q,
			U${i}${j}.U0${k}.u1.u33.u23.u87\$5.q
			},

			// register 14 (scan-index)
			{
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[7] ,
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[6] ,
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[5] ,
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[4] ,
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[3] ,
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[2] ,
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[1] ,
			U${i}${j}.U0${k}.u1.u10.u1.u3.\q[0] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[7] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[6] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[5] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[4] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[3] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[2] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[1] ,
			U${i}${j}.U0${k}.u1.u10.u1.u2.\q[0] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[7] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[6] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[5] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[4] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[3] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[2] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[1] ,
			U${i}${j}.U0${k}.u1.u10.u1.u1.\q[0] 
			}

			) ;

		\$fstrobe (cam3file, \$stime,
			"  %h  %h %h %h",

			// opcode register
			{
			U${i}${j}.U0${k}.u1.u13.u16.\opc[4] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[3] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[2] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[1] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[0] 
			},

			// register 15 (scan-perm)

			// Verilog behavioral model
			
/*			{
			U${i}${j}.U0${k}.u1.u10.u1.u159\$1.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$1.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$1.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$1.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$1.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$2.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$2.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$2.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$2.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$2.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$3.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$3.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$3.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$3.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$3.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$4.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$4.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$4.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$4.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$4.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$5.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$5.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$5.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$5.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$5.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$6.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$6.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$6.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$6.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$6.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$7.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$7.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$7.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$7.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$7.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$8.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$8.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$8.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$8.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$8.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$9.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$9.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$9.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$9.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$9.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$10.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$10.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$10.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$10.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$10.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$11.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$11.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$11.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$11.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$11.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$12.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$12.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$12.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$12.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$12.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$13.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$13.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$13.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$13.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$13.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$14.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$14.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$14.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$14.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$14.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$15.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$15.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$15.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$15.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$15.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$16.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$16.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$16.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$16.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$16.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$17.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$17.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$17.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$17.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$17.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$18.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$18.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$18.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$18.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$18.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$19.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$19.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$19.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$19.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$19.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$20.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$20.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$20.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$20.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$20.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$21.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$21.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$21.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$21.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$21.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$22.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$22.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$22.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$22.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$22.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$23.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$23.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$23.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$23.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$23.q0 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$24.q4 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$24.q3 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$24.q2 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$24.q1 ,
			U${i}${j}.U0${k}.u1.u10.u1.u159\$24.q0 
			},
*/
/*			{
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$1 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$1 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$1 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$1 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$1 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$2 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$2 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$2 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$2 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$2 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$3 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$3 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$3 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$3 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$3 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$4 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$4 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$4 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$4 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$4 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$5 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$5 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$5 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$5 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$5 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$6 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$6 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$6 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$6 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$6 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$7 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$7 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$7 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$7 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$7 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$8 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$8 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$8 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$8 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$8 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$9 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$9 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$9 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$9 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$9 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$10 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$10 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$10 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$10 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$10 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$11 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$11 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$11 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$11 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$11 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$12 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$12 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$12 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$12 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$12 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$13 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$13 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$13 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$13 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$13 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$14 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$14 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$14 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$14 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$14 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$15 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$15 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$15 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$15 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$15 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$16 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$16 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$16 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$16 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$16 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$17 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$17 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$17 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$17 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$17 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$18 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$18 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$18 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$18 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$18 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$19 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$19 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$19 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$19 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$19 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$20 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$20 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$20 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$20 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$20 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$21 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$21 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$21 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$21 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$21 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$22 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$22 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$22 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$22 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$22 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$23 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$23 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$23 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$23 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$23 .\u56\$5 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$24 .\u56\$1 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$24 .\u56\$2 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$24 .\u56\$3 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$24 .\u56\$4 .q ,
			U${i}${j}.U0${k}.u1.u10.u1.\u159\$24 .\u56\$5 .q 
			},
*/
			120'hx,

			// register 17 (scan-format)
/*			{
			U${i}${j}.U0${k}.u1.u10.u5.u180\$1.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$2.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$3.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$4.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$5.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$6.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$7.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$8.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$9.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$10.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$11.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$12.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$13.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$14.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$15.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$16.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$17.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$18.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$19.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$20.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$21.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$22.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$23.q,
			U${i}${j}.U0${k}.u1.u10.u5.u180\$24.q
			},
*/
			24'hx,

			// register 18 (offset)
			{
			U${i}${j}.U0${k}.u1.u10.u2.u192\$1.q,
			U${i}${j}.U0${k}.u1.u10.u2.u192\$2.q,
			U${i}${j}.U0${k}.u1.u10.u2.u192\$3.q,
			U${i}${j}.U0${k}.u1.u10.u2.u192\$4.q,
			U${i}${j}.U0${k}.u1.u10.u2.u192\$5.q,
			U${i}${j}.U0${k}.u1.u10.u2.u192\$6.q,
			U${i}${j}.U0${k}.u1.u10.u2.u192\$7.q,
			U${i}${j}.U0${k}.u1.u10.u2.u192\$8.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$1.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$2.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$3.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$4.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$5.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$6.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$7.q,
			U${i}${j}.U0${k}.u1.u10.u2.u193\$8.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$1.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$2.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$3.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$4.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$5.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$6.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$7.q,
			U${i}${j}.U0${k}.u1.u10.u2.u194\$8.q
			}

			) ;

		\$fstrobe (cam4file, \$stime,
			"  %h  %h %h %h %h %h  %h %h %h %h %h",

			// opcode register
			{
			U${i}${j}.U0${k}.u1.u13.u16.\opc[4] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[3] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[2] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[1] ,
			U${i}${j}.U0${k}.u1.u13.u16.\opc[0] 
			},

			// register 19 (dimension)
			{
			U${i}${j}.U0${k}.u1.u10.u4.u268\$1.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$2.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$3.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$4.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$5.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$6.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$7.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$8.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$9.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$10.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$11.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$12.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$13.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$14.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$15.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$16.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$17.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$18.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$19.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$20.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$21.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$22.q,
			U${i}${j}.U0${k}.u1.u10.u4.u268\$23.q
			},

			// register 20 (environment)
/*			{
			U${i}${j}.U0${k}.u1.u13.u20.u202\$1.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$2.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$3.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$4.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$5.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$6.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$7.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$8.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$9.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$10.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$11.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$12.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$13.q,
			U${i}${j}.U0${k}.u1.u13.u20.u202\$14.q
			},
*/
			15'hx,

			// register 21 (multi)
			{
			U${i}${j}.U0${k}.u1.u13.u35.u287\$1.q,
			U${i}${j}.U0${k}.u1.u13.u35.u287\$2.q,
			U${i}${j}.U0${k}.u1.u13.u35.u287\$3.q,
			U${i}${j}.U0${k}.u1.u13.u35.u287\$4.q,
			U${i}${j}.U0${k}.u1.u13.u35.u287\$5.q,
			U${i}${j}.U0${k}.u1.u13.u34.u287\$1.q,
			U${i}${j}.U0${k}.u1.u13.u34.u287\$2.q,
			U${i}${j}.U0${k}.u1.u13.u34.u287\$3.q,
			U${i}${j}.U0${k}.u1.u13.u34.u287\$4.q,
			U${i}${j}.U0${k}.u1.u13.u34.u287\$5.q
			},

			// register 22 (connect)
			{
			U${i}${j}.U0${k}.u1.u11.u8.u8.\slt[2] ,
			U${i}${j}.U0${k}.u1.u11.u8.u8.\slt[1] ,
			U${i}${j}.U0${k}.u1.u11.u8.u8.\slt[0] ,
			U${i}${j}.U0${k}.u1.u11.u8.u7.\slt[2] ,
			U${i}${j}.U0${k}.u1.u11.u8.u7.\slt[1] ,
			U${i}${j}.U0${k}.u1.u11.u8.u7.\slt[0] ,
			U${i}${j}.U0${k}.u1.u11.u8.u1.\slt[2] ,
			U${i}${j}.U0${k}.u1.u11.u8.u1.\slt[1] ,
			U${i}${j}.U0${k}.u1.u11.u8.u1.\slt[0] ,
			U${i}${j}.U0${k}.u1.u11.u8.u6.\slt[2] ,
			U${i}${j}.U0${k}.u1.u11.u8.u6.\slt[1] ,
			U${i}${j}.U0${k}.u1.u11.u8.u6.\slt[0] ,
			U${i}${j}.U0${k}.u1.u11.u8.u9.\slt[2] ,
			U${i}${j}.U0${k}.u1.u11.u8.u9.\slt[1] ,
			U${i}${j}.U0${k}.u1.u11.u8.u9.\slt[0] ,
			U${i}${j}.U0${k}.u1.u11.u8.u10.\slt[2] ,
			U${i}${j}.U0${k}.u1.u11.u8.u10.\slt[1] ,
			U${i}${j}.U0${k}.u1.u11.u8.u10.\slt[0] 
			},

			// register 23 (module id)
			U${i}${j}.U0${k}.u1.u13.u15.u237.q,

			// register 24 (group id)
			U${i}${j}.U0${k}.u1.u13.u15.u177.q,

			// register 25 (int-enable)
			{
			U${i}${j}.U0${k}.u1.u13.u19.u358\$1.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$2.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$3.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$4.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$5.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$6.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$7.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$8.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$9.q,
			U${i}${j}.U0${k}.u1.u13.u19.u358\$10.q
			},

			// register 26 (int-flags)
			{
			U${i}${j}.U0${k}.u1.u13.u19.u328\$1.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$2.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$3.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$4.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$5.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$6.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$7.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$8.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$9.q,
			U${i}${j}.U0${k}.u1.u13.u19.u328\$10.q
			},

			// register 27 (verify)
			{
			U${i}${j}.U0${k}.u1.u13.u36.u315.q,
			U${i}${j}.U0${k}.u1.u13.u36.u316.q,
			U${i}${j}.U0${k}.u1.u13.u36.u317.q
			},

			// register 28 (dram-count)
			{
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[7] ,
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[6] ,
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[5] ,
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[4] ,
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[3] ,
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[2] ,
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[1] ,
			U${i}${j}.U0${k}.u1.u11.u11.u104.\q[0] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[7] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[6] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[5] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[4] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[3] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[2] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[1] ,
			U${i}${j}.U0${k}.u1.u11.u11.u105.\q[0] 
			}

			) ;


		\$fstrobe (cam5file, \$stime,
			" %h%h%h%h%h %h%h%h%h%h %h%h%h%h %h%h%h%h %h%h%h%h%h %h%h %h%h%h%h%h  %h  %h %h",

			// Node logic
			U${i}${j}.U0${k}.u1.u14.c_dout_en_n,
			U${i}${j}.U0${k}.u1.u14.c_dout,
			U${i}${j}.U0${k}.u1.u14.nbf,
			U${i}${j}.U0${k}.u1.u14.u34.wren_n,
			U${i}${j}.U0${k}.u1.u14.u34.rden_n,

			U${i}${j}.U0${k}.u1.u14.u34.rs1in,
			U${i}${j}.U0${k}.u1.u14.u34.rs2in,
			U${i}${j}.U0${k}.u1.u14.u34.lsin,
			U${i}${j}.U0${k}.u1.u14.u34.din,
			U${i}${j}.U0${k}.u1.u14.u34.dout,

			U${i}${j}.U0${k}.u1.u14.u34.ioout,
			U${i}${j}.U0${k}.u1.u14.u34.lsout,
			U${i}${j}.U0${k}.u1.u14.u34.rsout,
			U${i}${j}.U0${k}.u1.u14.u34.data_in_sel,

			U${i}${j}.U0${k}.u1.u14.u34.u14.full ,
			U${i}${j}.U0${k}.u1.u14.u34.u3.accepted_n,
			U${i}${j}.U0${k}.u1.u14.u34.u3.valid_in_n,

			U${i}${j}.U0${k}.u1.u14.u34.u3.full,
//			U${i}${j}.U0${k}.u1.u14.u34.u3.f,

//			1'bx,
//			U${i}${j}.U0${k}.u1.u14.u34.u17.dout,


			U${i}${j}.U0${k}.u1.u14.u34.u3.u27.q,
//			1'bx,

			U${i}${j}.U0${k}.u1.u14.u34.u3.u4.z,
			U${i}${j}.U0${k}.u1.u14.u34.u3.u3.z,
			U${i}${j}.U0${k}.u1.u14.u34.u3.u9.z,
			U${i}${j}.U0${k}.u1.u14.u34.u3.u10.z,

			U${i}${j}.U0${k}.u1.u14.u34.u3.rdmode_d,
//			1'bx,

			U${i}${j}.U0${k}.u1.u14.u34.u3.wren_d,
//			1'bx,

			U${i}${j}.U0${k}.u1.u14.u34.u13.u2.rd_mode,
			U${i}${j}.U0${k}.u1.u14.u34.u13.flip_bus,
			U${i}${j}.U0${k}.u1.u14.u34.u13.w_to_r,
			U${i}${j}.U0${k}.u1.u14.u34.u13.full,
			U${i}${j}.U0${k}.u1.u14.u34.pclr_n,

			// rwfsm state
			{
			U${i}${j}.U0${k}.u1.u14.u34.u13.u2.sr3.q,
			U${i}${j}.U0${k}.u1.u14.u34.u13.u2.sr2.q,
			U${i}${j}.U0${k}.u1.u14.u34.u13.u2.sr1.q
			},

/*			{
			U${i}${j}.U0${k}.u1.u14.u34.u13.sr3.q,
			U${i}${j}.U0${k}.u1.u14.u34.u13.sr2.q,
			U${i}${j}.U0${k}.u1.u14.u34.u13.sr1.q
			},
*/
			// nodefsm state
			U${i}${j}.U0${k}.u1.u14.u34.u14.sr1.q,

			// clock enable
			system.U5.vector_enable
			);

END

    @ k = $k + 1
    end

  @ j = $j + 1
  end

@ i = $i + 1
end


BEGIN

		end

	initial
		begin
		wait (system.idebug !== 1'bx)
		if (system.idebug === 1'b1)
			begin
			cam1file = \$fopen ("camout.a") ;
			if (cam1file == 0) \$finish ;

			cam2file = \$fopen ("camout.b") ;
			if (cam2file == 0) \$finish ;

			cam3file = \$fopen ("camout.c") ;
			if (cam3file == 0) \$finish ;

			cam4file = \$fopen ("camout.d") ;
			if (cam4file == 0) \$finish ;

			cam5file = \$fopen ("camout.e") ;
			if (cam5file == 0) \$finish ;


\$fdisplay
	(cam1file, "            o m m g  m m s  w s  n l l n  n r r i  uuuuu uuuuu uuuu") ;
\$fdisplay
	(cam1file, "            p s i i  o o e  _ t  _ s s _  _ s s o  11133 33333 3333") ;
\$fdisplay
	(cam1file, "            c r d d  d d l  r a  d i o i  d i o o  44444 44444 4444") ;
\$fdisplay
	(cam1file, "            o q r r  s s e    t  l n u o  r n u u  ccnwr rrldd ilrd") ;
\$fdisplay
	(cam1file, "            d   q q  e e c    u      t s      t t  __brd sssio ossa") ;
\$fdisplay
	(cam1file, "            e        l l t    s        e           ddfee 12inu ooot") ;
\$fdisplay
	(cam1file, "                     _ _ e    _        l           oo nn iin t uuua") ;
\$fdisplay
	(cam1file, "                     o e d    o                    uu __ nn    ttt_") ;
\$fdisplay
	(cam1file, "                     u n      u                    tt nn          i") ;
\$fdisplay
	(cam1file, "                     t        t                    _              n") ;
\$fdisplay
	(cam1file, "                                                   e              _") ;
\$fdisplay
	(cam1file, "                                                   n              s") ;


\$fdisplay
	(cam2file, "            o   r     r     r  r  r   r  r  r r  r    r   r    r") ;
\$fdisplay
	(cam2file, "            p   e     e     e  e  e   e  e  e e  e    e   e    e") ;
\$fdisplay
	(cam2file, "            c   g     g     g  g  g   g  g  g g  g    g   g    g") ;
\$fdisplay
	(cam2file, "            o   1     2     3  4  5   6  7  8 9  1    1   1    1") ;
\$fdisplay
	(cam2file, "            d                                    0    1   2    4") ;

\$fdisplay
	(cam3file, "            o                 r                   r      r") ;
\$fdisplay
	(cam3file, "            p                 e                   e      e") ;
\$fdisplay
	(cam3file, "            c                 g                   g      g") ;
\$fdisplay
	(cam3file, "            o                 1                   1      1") ;
\$fdisplay
	(cam3file, "            d                 5                   7      8") ;

\$fdisplay
	(cam4file, "            o      r     r   r    r   r r  r   r  r   r") ;
\$fdisplay
	(cam4file, "            p      e     e   e    e   e e  e   e  e   e") ;
\$fdisplay
	(cam4file, "            c      g     g   g    g   g g  g   g  g   g") ;
\$fdisplay
	(cam4file, "            o      1     2   2    2   2 2  2   2  2   2") ;
\$fdisplay
	(cam4file, "            d      9     0   1    2   3 4  5   6  7   8") ;

\$fdisplay
	(cam5file, "           uuuuu uuuuu uuuu uuuu uuuuu rw uuuuu  r  n v") ;
\$fdisplay
	(cam5file, "           11133 33333 3333 1111 11111 dr 11111  w  o e") ;
\$fdisplay
	(cam5file, "           44444 44444 4444 8888 88888 me 88888  f  d c") ;
\$fdisplay
	(cam5file, "           ccnwr rrldd ilrd .... ..... on .....  s  e t") ;
\$fdisplay
	(cam5file, "           __brd sssio ossa uuuu uuuuu d_ uuurp  m  f o") ;
\$fdisplay
	(cam5file, "           ddfee 12inu ooot 1333 33333 ed 111cc     s r") ;
\$fdisplay
	(cam5file, "           oo nn iin t uuua 4... ..... _  333rl     m _") ;
\$fdisplay
	(cam5file, "           uu __ nn    ttt_ .avr uuuuu d  ...cr       e") ;
\$fdisplay
	(cam5file, "           tt nn          i fcac 24391    rrc _       n") ;
\$fdisplay
	(cam5file, "           _              n uclr 7...0    dsh n       a") ;
\$fdisplay
	(cam5file, "           e              _ lpic .zzz.    _tg         b") ;
\$fdisplay
	(cam5file, "           n              s ltd  q   z    mn_         l") ;
\$fdisplay
	(cam5file, "                          e  d_           odn         e") ;
\$fdisplay
	(cam5file, "                          l  _i           d_           ") ;
\$fdisplay
	(cam5file, "                             nn           en           ") ;
\$fdisplay
	(cam5file, "                              _                        ") ;
\$fdisplay
	(cam5file, "                              n                        ") ;

			end
		end
endmodule
END


