Ver código fonte

Removed "ActiveCells" flag and all dependencies thereof

git-svn-id: https://svn.inf.ethz.ch/svn/lecturers/a2/trunk@6538 8c9fc860-2736-0410-a75d-ab315db34111
felixf 9 anos atrás
pai
commit
5854ff35c9

+ 2 - 2
source/FoxCSharpFrontend.Mod

@@ -10,9 +10,9 @@ TYPE
 		scanner: Scanner.Scanner;
 		parser: Parser.Parser;
 		
-		PROCEDURE Initialize*(diagnostics: Diagnostics.Diagnostics; reader: Streams.Reader; CONST fileName: ARRAY OF CHAR; pos: LONGINT; activeCells: BOOLEAN);
+		PROCEDURE Initialize*(diagnostics: Diagnostics.Diagnostics; reader: Streams.Reader; CONST fileName: ARRAY OF CHAR; pos: LONGINT);
 		BEGIN
-			Initialize^(diagnostics, reader, fileName, pos, activeCells);
+			Initialize^(diagnostics, reader, fileName, pos);
 			scanner := Scanner.NewScanner(fileName, reader, pos, diagnostics);
 			parser := Parser.NewParser( scanner, diagnostics );
 		END Initialize;

+ 0 - 8
source/FoxCSharpParser.Mod

@@ -117,7 +117,6 @@ TYPE
         recentComment: SyntaxTree.Comment;
         moduleScope: SyntaxTree.ModuleScope;
         error-: BOOLEAN;
-        activeCellsSupport: BOOLEAN;
 
         initStatements: SyntaxTree.StatementSequence;
         initOuter: SyntaxTree.Statement;
@@ -175,8 +174,6 @@ TYPE
             NEW(localIdentTable);
             (* debugging *)
             indent := 0;
-            activeCellsSupport := FALSE;
-
         END Init;
 
         PROCEDURE InitDelegateModifiers;
@@ -219,11 +216,6 @@ TYPE
             StringPool.GetIndex(Global.LynxSelidx, lynxSelidx);
         END InitSystemNames;
 
-        PROCEDURE ActiveCellsSupport*;
-        BEGIN 
-            activeCellsSupport := TRUE
-        END ActiveCellsSupport;
-
         PROCEDURE S(CONST s: ARRAY OF CHAR);    (* for debugging purposes only *)
             VAR i: LONGINT;
         BEGIN

+ 1 - 7
source/FoxCompiler.Mod

@@ -15,7 +15,6 @@ CONST
 	TraceError* = 3;
 	Info* = 4;
 	FindPC* = 5;
-	ActiveCellsFlag*=6;
 	Warnings*=7;
 	ForceModuleBodies*=8;
 	UseDarwinCCalls*=9;	(* use Darwin stack alignment for ext. C procedures *)	(*fld*)
@@ -161,7 +160,7 @@ TYPE
 
 		IF (options.objectFile # NIL) & (options.objectFile.ForceModuleBodies()) THEN INCL(flags, ForceModuleBodies) END;
 
-		options.frontend.Initialize(diagnostics, reader, source, position, ActiveCellsFlag IN flags);
+		options.frontend.Initialize(diagnostics, reader, source, position);
 		REPEAT
 			(** first phase: scan and parse **)
 			module := options.frontend.Parse();
@@ -193,10 +192,6 @@ TYPE
 					IF ChangeCase IN flags THEN module.SetCase(1-module.case) END;
 				END;
 
-				IF (ActiveCellsFlag IN flags) & ~(CellsAreObjects IN flags) THEN
-					Global.GetSymbolName(module,name);
-				END;
-
 				(** third phase: generate code, can consist of sub-phases (such as intermediate backend / hardware backend) **)
 				IF options.backend # NIL THEN
 					options.backend.Initialize(diagnostics, log, flags, checker, system);
@@ -435,7 +430,6 @@ TYPE
 			IF options.GetFlag("darwinHost") THEN INCL(compilerOptions.flags,UseDarwinCCalls) END;	(*fld*)
 			IF options.GetFlag("singleModule") THEN INCL(compilerOptions.flags,SingleModule) END;
 			IF options.GetFlag("oberon07") THEN INCL(compilerOptions.flags, Oberon07) END;
-			IF options.GetFlag("activeCells") THEN INCL(compilerOptions.flags, ActiveCellsFlag) END;
 			IF options.GetFlag("cooperative") THEN INCL(compilerOptions.flags, Cooperative) END;
 			IF options.GetFlag("cellsAreObjects") THEN INCL(compilerOptions.flags, CellsAreObjects) END;
 			IF ~options.GetString("srcPath", compilerOptions.srcPath) THEN compilerOptions.srcPath := "" END;

+ 2 - 2
source/FoxFrontend.Mod

@@ -9,11 +9,11 @@ TYPE
 	VAR		
 		PROCEDURE & InitFrontEnd*;
 		BEGIN
-			Initialize(NIL, NIL, "", 0, FALSE);
+			Initialize(NIL, NIL, "", 0);
 		END InitFrontEnd;
 		
 		(* initialize frontend for usage *)
-		PROCEDURE Initialize*(diagnostics: Diagnostics.Diagnostics; reader: Streams.Reader;CONST fileName: ARRAY OF CHAR; pos: LONGINT; activeCellsSupport: BOOLEAN);
+		PROCEDURE Initialize*(diagnostics: Diagnostics.Diagnostics; reader: Streams.Reader;CONST fileName: ARRAY OF CHAR; pos: LONGINT);
 		BEGIN
 		END Initialize;
 

+ 2 - 3
source/FoxOberonFrontend.Mod

@@ -10,12 +10,11 @@ TYPE
 		scanner: Scanner.Scanner;
 		parser: Parser.Parser;
 		
-		PROCEDURE Initialize*(diagnostics: Diagnostics.Diagnostics; reader: Streams.Reader; CONST fileName: ARRAY OF CHAR; pos: LONGINT; activeCells: BOOLEAN);
+		PROCEDURE Initialize*(diagnostics: Diagnostics.Diagnostics; reader: Streams.Reader; CONST fileName: ARRAY OF CHAR; pos: LONGINT);
 		BEGIN
-			Initialize^(diagnostics, reader, fileName, pos, activeCells);
+			Initialize^(diagnostics, reader, fileName, pos);
 			scanner := Scanner.NewScanner(fileName, reader, pos, diagnostics);
 			parser := Parser.NewParser( scanner, diagnostics );
-			IF activeCells THEN parser.ActiveCellsSupport END;
 		END Initialize;
 		
 		PROCEDURE Parse*(): SyntaxTree.Module;

+ 0 - 6
source/FoxParser.Mod

@@ -175,7 +175,6 @@ TYPE
 		recentComment: SyntaxTree.Comment;
 		moduleScope: SyntaxTree.ModuleScope;
 		error-: BOOLEAN;
-		activeCellsSupport: BOOLEAN;
 
 		indent: LONGINT;   (* for debugging purposes only *)
 
@@ -212,13 +211,8 @@ TYPE
 			recentCommentItem := NIL; recentComment := NIL;
 			(* debugging *)
 			indent := 0;
-			activeCellsSupport := FALSE;
 		END Init;
 
-		PROCEDURE ActiveCellsSupport*;
-		BEGIN activeCellsSupport := TRUE
-		END ActiveCellsSupport;
-
 		(** output error message and / or given code *)
 		PROCEDURE Error(position: LONGINT; code: LONGINT; CONST message: ARRAY OF CHAR);
 		VAR errorMessage: ARRAY 256 OF CHAR;

+ 16 - 490
source/FoxTRMTools.Mod

@@ -1,23 +1,19 @@
-MODULE FoxTRMTools; (** AUTHOR ""; PURPOSE ""; *)
-(*! deprecated -- not used any more in Active Cells3 *)
-IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, Random, Machine, ActiveCells := FoxActiveCells, Streams, WinApplications, Hardware := FoxHardware,
-		BitSets,ObjectFile;
-
-VAR
-	random: Random.Generator;
+MODULE FoxTRMTools;
+IMPORT Files,Commands,Options,Strings,Basic := FoxBasic, Diagnostics, BitSets,ObjectFile;
 
+	(*! check spartan 6 emission *)
 	PROCEDURE PatchSpartan6(this: ARRAY OF CHAR; VAR result: ARRAY OF CHAR; line: LONGINT);
 
-		(*
-			decode 36 bits 2 instruction big endian format
-				35 ... 18				17 .. 0
-				ins2_bit17 ... ins2_bit0 ins1_bit17 .. ins1_bit0
+	(*
+		decode 36 bits 2 instruction big endian format
+			35 ... 18				17 .. 0
+			ins2_bit17 ... ins2_bit0 ins1_bit17 .. ins1_bit0
 
-			to 2 x 18 bits instructions in the following form
-				35			34			33..16					15..0
-				ins2_bit17, ins2_bit16 ins1_bit17 ... inst1_bit0 ins2_bit15.. ins2_bit_0
+		to 2 x 18 bits instructions in the following form
+			35			34			33..16					15..0
+			ins2_bit17, ins2_bit16 ins1_bit17 ... inst1_bit0 ins2_bit15.. ins2_bit_0
 
-		*)
+	*)
 
 	VAR inpos, outpos, i, bits, i1, i2, val: LONGINT;
 
@@ -173,10 +169,7 @@ VAR
 		RETURN TRUE
 	END SplitColumns;
 
-
-
-
-
+	
 	PROCEDURE DoSplitFiles*(CONST source, dest, extension: ARRAY OF CHAR; blocks, blockSize: LONGINT; verbose,strided,patchSpartan6: BOOLEAN; diagnostics: Diagnostics.Diagnostics): BOOLEAN;
 	VAR line: LONGINT; fileName: Files.FileName; oldFile: Files.File;
 		newFiles: POINTER TO ARRAY OF Files.File;
@@ -280,103 +273,10 @@ VAR
 		END;
 	END SplitFiles;
 
-	PROCEDURE GenerateTestFile*(context: Commands.Context);
-	VAR fileName, sourceFileName: Files.FileName; size, value: LONGINT; options: Options.Options; file: Files.File; writer: Files.Writer; i: LONGINT; i1, i2: LONGINT;
-		 source: Files.File; reader: Files.Reader;
-
-		PROCEDURE WriteInt(i: LONGINT);
-		VAR c: CHAR;
-		BEGIN
-			IF i < 0AH THEN c := CHR(i + ORD('0'))
-			ELSIF i < 10H THEN c := CHR(i-10 + ORD('A'))
-			ELSE HALT(100)
-			END;
-			writer.Char(c);
-		END WriteInt;
-
-		PROCEDURE WriteHex36(i1, i2: LONGINT);
-		VAR i,j: LONGINT; c: ARRAY 9 OF LONGINT;
-		BEGIN
-			FOR i := 0 TO 3 DO
-				c[j] := i1 MOD 10H; i1 := i1 DIV 10H; INC(j);
-			END;
-			c[j] := i1 + (i2 MOD 4H) * 4H; i2 := i2 DIV 4H;
-			INC(j);
-			FOR i := 0 TO 3 DO
-				c[j] := i2 MOD 10H; i2 := i2 DIV 10H; INC(j);
-			END;
-
-			FOR j := 8 TO 0 BY -1 DO WriteInt(c[j]) END; writer.Ln;
-		END WriteHex36;
-
-	BEGIN
-		NEW(options);
-		options.Add("s","size",Options.Integer);
-		options.Add("v","value",Options.Integer);
-		options.Add("r","random",Options.Flag);
-		options.Add("f","sourceFile",Options.String);
-
-		IF ~options.Parse (context.arg, context.error) THEN context.result := Commands.CommandParseError; RETURN; END;
-		IF ~options.GetInteger("size",size) THEN size := 4096 END;
-		IF ~options.GetInteger("value",value) THEN value := 0 END;
-		IF options.GetString("sourceFile", sourceFileName) THEN
-			source := Files.Old(sourceFileName);
-			NEW(reader, source, 0);
-			ASSERT(source # NIL);
-		END;
-
-		IF context.arg.GetString(fileName) THEN
-			file := Files.New(fileName);
-			ASSERT(file # NIL);
-			NEW(writer, file, 0);
-			IF source = NIL THEN
-				FOR i := 0 TO size -1 DO
-					IF options.GetFlag("random") THEN
-						i1 := random.Dice(40000H);
-						i2 := random.Dice(40000H);
-					ELSE
-					i1 := value; i2 := value;
-					END;
-					WriteHex36(i1, i2);
-				END;
-			ELSE
-				WHILE reader.Available()>0 DO
-					reader.RawLInt(i1); reader.RawLInt(i2);
-					WriteHex36(i1,i2);
-				END;
-			END;
-			writer.Update;
-			Files.Register(file);
-			context.out.String("written file "); context.out.String(fileName); context.out.Ln;
-		END;
-
-	END GenerateTestFile;
-
 	PROCEDURE CompareFiles*(context: Commands.Context);
-	VAR f1,f2,f3: Files.File; name1, name2, matrixname: Files.FileName; r1, r2: Files.Reader;  x,y: ARRAY 32 OF CHAR; i: LONGINT; line1, line2: LONGINT;
+	VAR f1,f2,f3: Files.File; name1, name2, matrixname: Files.FileName; r1, r2: Files.Reader;  x,y: ARRAY 32 OF CHAR; i: LONGINT; line1: LONGINT;
 		matrix: ARRAY 16 OF ARRAY 16 OF LONGINT; j: LONGINT; p1, p2: LONGINT; writer: Files.Writer;
 
-		PROCEDURE WriteBit(x: LONGINT);
-		BEGIN
-			IF ODD(x) THEN context.out.Char("1") ELSE context.out.Char("0") END;
-		END WriteBit;
-
-		PROCEDURE WriteBits(c: CHAR);
-		VAR v: LONGINT;
-		BEGIN
-			CASE c OF
-				'0' .. '9': v :=  ORD(c)- ORD('0')
-				|'A'..'F': v :=  ORD(c) - ORD('A') + 10
-				|'a'..'f': v :=  ORD(c) - ORD('a') + 10
-			ELSE HALT(100) (* to be on the safe side *)
-			END;
-			WriteBit(ORD(c) DIV 8);
-			WriteBit(ORD(c) DIV 4);
-			WriteBit(ORD(c) DIV 2);
-			WriteBit(ORD(c));
-
-		END WriteBits;
-
 		PROCEDURE Value(c: CHAR): LONGINT;
 		BEGIN
 			CASE c OF
@@ -388,12 +288,6 @@ VAR
 
 		END Value;
 
-
-		PROCEDURE WriteLn;
-		BEGIN
-			context.out.Ln;
-		END WriteLn;
-
 	BEGIN
 		IF context.arg.GetString(name1) & context.arg.GetString(name2) &  context.arg.GetString(matrixname) THEN
 			f1 := Files.Old(name1); f2 := Files.Old(name2); f3 := Files.New(matrixname);
@@ -471,7 +365,7 @@ VAR
 			Files.Register(f3);
 		END;
 	END CompareFiles;
-
+	(*
 	PROCEDURE SameFiles(CONST filename1, filename2: ARRAY OF CHAR): BOOLEAN;
 	VAR
 		file1, file2 : Files.File; reader1, reader2 : Files.Reader; ch1, ch2 : CHAR;
@@ -503,20 +397,8 @@ VAR
 			RETURN FALSE;
 		END;
 	END SameFiles;
-
-	PROCEDURE IsEngine(instance: ActiveCells.Instance): BOOLEAN;
-	VAR type: ActiveCells.Type;
-	BEGIN
-		type := instance.instanceType;
-		IF type.scope.name = "Engines" THEN
-			IF type.name = "Adder" THEN RETURN TRUE
-			ELSE RETURN FALSE (* unknown engine in Engines module *)
-			END;
-		ELSE (* not in Engines module *)
-			RETURN FALSE
-		END;
-	END IsEngine;
-
+	*)
+	(*
 	PROCEDURE DeleteFiles(CONST fileSelectionMask: ARRAY OF CHAR; context: Commands.Context; VAR res: LONGINT);
 	VAR
 		enum: Files.Enumerator;
@@ -539,365 +421,9 @@ VAR
 			END;
 		END;
 	END DeleteFiles;
-
-	(* Execute a command line command given a path *)
-	PROCEDURE ExecuteInPath(CONST cmd: ARRAY OF CHAR; CONST path: ARRAY OF CHAR; VAR res: LONGINT);
-	VAR
-		file: Files.File;
-		w: Files.Writer;
-	BEGIN
-		file := Files.New("temp.bat"); ASSERT(file # NIL);
-		Files.Register(file);
-		NEW(w,file,0);
-		w.String("cd \"); w.Ln;
-		w.String("cd ");
-		w.String(path); w.Ln;
-		w.String(cmd); w.Ln;
-		w.Update;
-		file.Close;
-
-		res := WinApplications.Call("temp.bat","");
-	END ExecuteInPath;
-
-	PROCEDURE SizeInBlocks(sizeInUnits, blockSize: LONGINT): LONGINT;
-	BEGIN
-		RETURN (sizeInUnits-1) DIV blockSize +1
-	END SizeInBlocks;
-
-	(* Get the execution status of an impact batch command
-
-		cmdPath - the path where impact command was issued
-		success - TRUE for success
-		res - result code (0 in case if status was determined successfully)
 	*)
-	PROCEDURE GetImpactCmdStatus(CONST cmdPath: ARRAY OF CHAR; VAR success: BOOLEAN; VAR res: LONGINT);
-	VAR
-		file: Files.File;
-		fileName: Files.FileName;
-		r: Files.Reader;
-		str: ARRAY 128 OF CHAR;
-		overwrite: BOOLEAN;
-		k: LONGINT;
-	BEGIN
-		res := 0;
-
-		Files.JoinPath(cmdPath,"_impactbatch.log",fileName);
-
-
-		file := Files.Old(fileName);
-		IF file = NIL THEN res := -1; RETURN; END;
-		NEW(r,file,0);
-
-		REPEAT
-			r.Ln(str);
-			(*success := str = "'1': Programmed successfully.";*)
-			k := Strings.Find(str,0,':');
-			IF k > 0 THEN
-				Strings.Delete(str,0,k+1);
-				Strings.TrimWS(str);
-				success := str = "Programmed successfully.";
-			END;
-		UNTIL success OR (r.res = Streams.EOF);
-
-	FINALLY
-		file.Close();
-	END GetImpactCmdStatus;
-
-	(**
-		Command for building ActiveCells hardware
 
-		syntax:
-
-		BuildHardware -p=platformId -f=specificationName ~
-
-		where
-
-		platformId - a string with an ActiveCells platform ID
-		specificationName - a string with the name of hardware specification (file name without ".spec" extension)
-	*)
-	PROCEDURE BuildHardware*(context: Commands.Context);
-	CONST BuiltPrefix = "built-";
-	VAR
-		options: Options.Options;
-		specName, builtSpecName, specPath, hwPath, str: Files.FileName;
-		platformId: Files.FileName;
-		spec, builtSpec: ActiveCells.Specification;
-		instance: ActiveCells.Instance;
-		description: Hardware.Description;
-		changes: BOOLEAN;
-
-		res: LONGINT;
-		diagnostics: Diagnostics.StreamDiagnostics;
-
-		PROCEDURE Exists(CONST path, name, ext: ARRAY OF CHAR): BOOLEAN;
-		VAR fileName: Files.FileName;
-		BEGIN
-			Files.JoinPath(path,name,fileName);
-			Files.JoinExtension(fileName,ext,fileName);
-			RETURN Files.Old(fileName) # NIL;
-		END Exists;
-
-		PROCEDURE CopyAsBuilt(CONST path, name, ext: ARRAY OF CHAR; CONST dstPath: ARRAY OF CHAR; VAR res: LONGINT);
-		VAR
-			overwrite: BOOLEAN;
-			fileName, builtFileName: Files.FileName;
-		BEGIN
-			Files.JoinExtension(name,ext,fileName);
-			Files.JoinPath(path,fileName,fileName);
-
-			Strings.Concat(BuiltPrefix,name,builtFileName);
-			Files.JoinExtension(builtFileName,ext,builtFileName);
-			Files.JoinPath(dstPath,builtFileName,builtFileName);
-
-			overwrite := TRUE;
-			Files.CopyFile(fileName,builtFileName,overwrite,res);
-			IF res # 0 THEN context.error.String("failed to copy file "); context.error.String(fileName); context.error.String(" to "); context.error.String(builtFileName); context.error.Ln; context.error.Update; RETURN; END;
-		END CopyAsBuilt;
-
-		PROCEDURE SameAsBuilt(CONST path, name, ext: ARRAY OF CHAR): BOOLEAN;
-		VAR fileName, builtFileName: Files.FileName;
-		BEGIN
-			Files.JoinExtension(name,ext,fileName);
-			Files.JoinPath(path,fileName,fileName);
-
-			Strings.Concat(BuiltPrefix,name,builtFileName);
-			Files.JoinExtension(builtFileName,ext,builtFileName);
-			Files.JoinPath(path,builtFileName,builtFileName);
-
-			RETURN SameFiles(fileName,builtFileName);
-		END SameAsBuilt;
-
-		PROCEDURE PatchAndConfigure(VAR res: LONGINT);
-		VAR
-			insBlockSize, dataBlockSize: LONGINT;
-			file: Files.File;
-			w: Files.Writer;
-			iBlock, numBlocks: LONGINT;
-			k: LONGINT;
-			blockName, instanceName: Files.FileName;
-			tempOut, success: BOOLEAN;
-			numPatched: LONGINT;
-		BEGIN
-			(* instruction and data memory block sizes *)
-			(*! query these parameters from FoxActiveCells!!! *)
-			IF platformId = "ML505" THEN insBlockSize := 2048; dataBlockSize := 1024;
-			ELSIF platformId = "AVSP6LX75T" THEN insBlockSize := 1024; dataBlockSize := 512;
-			ELSIF platformId = "TL400" THEN insBlockSize := 1024; dataBlockSize := 512;
-			ELSIF platformId = "Spartan_XC3S200" THEN insBlockSize := 1024; dataBlockSize := 512;
-			ELSIF platformId = "Spartan_XC3S500e" THEN insBlockSize := 1024; dataBlockSize := 512;
-			ELSE HALT(100);
-			END;
-
-			file := Files.New("temp.bat"); ASSERT(file # NIL);
-			NEW(w,file,0);
-			w.String("cd \"); w.Ln;
-			w.String("cd "); w.String(hwPath); w.Ln;
-
-			tempOut := TRUE;
-			numPatched := 0;
-
-			FOR k := 0 TO spec.instances.Length()-1 DO
-
-				instance := spec.instances.GetInstance(k);
-				IF ~IsEngine(instance) THEN
-
-					(** process instruction memory files *)
-					instance.GetFullName(instanceName,NIL);
-					Files.JoinExtension(instanceName,ActiveCells.CodeFileExtension,instanceName);
-					iBlock := 0; numBlocks := SizeInBlocks(instance.instructionMemorySize,insBlockSize);
-					WHILE iBlock < numBlocks DO
-
-						ActiveCells.NormalizeName(instanceName,blockName);
-						Basic.AppendNumber(blockName,iBlock);
-						Files.JoinExtension(blockName,"mem",blockName);
-
-						IF ~SameAsBuilt(hwPath,blockName,"") THEN
-
-							IF ~Exists(hwPath,blockName,"") THEN res := -1; diagnostics.Error(blockName,Diagnostics.Invalid,Diagnostics.Invalid," file does not exist"); RETURN; END;
-
-							w.String("data2mem -bm "); ActiveCells.WriteName(w,spec,"","bd"); w.String(".bmm  -bt  .\");
-							IF tempOut THEN w.String(builtSpecName); ELSE w.String("temp"); END;
-							w.String(".bit  -bd "); w.String(blockName);
-							w.String(" tag "); ActiveCells.WriteName(w,instance.scope,instance.name,"ins"); w.Int(iBlock,1);
-							w.String(" -o b .\");
-							IF tempOut THEN w.String("temp"); ELSE w.String(builtSpecName); END; tempOut := ~tempOut;
-							w.String(".bit");
-							w.Ln;
-
-							CopyAsBuilt(hwPath,blockName,"",hwPath,res);
-							IF res # 0 THEN RETURN; END;
-
-							INC(numPatched);
-						END;
-
-						INC(iBlock);
-					END;
-
-					(** process data memory files *)
-					instance.GetFullName(instanceName,NIL);
-					Files.JoinExtension(instanceName,ActiveCells.DataFileExtension,instanceName);
-					iBlock := 0; numBlocks := SizeInBlocks(instance.dataMemorySize,dataBlockSize);
-					WHILE iBlock < numBlocks DO
-						ActiveCells.NormalizeName(instanceName,blockName);
-						Basic.AppendNumber(blockName,iBlock);
-						Files.JoinExtension(blockName,"mem",blockName);
-
-						IF ~SameAsBuilt(hwPath,blockName,"") THEN
-
-							IF ~Exists(hwPath,blockName,"") THEN res := -1; diagnostics.Error(blockName,Diagnostics.Invalid,Diagnostics.Invalid," file does not exist"); END;
-
-							w.String("data2mem -bm "); ActiveCells.WriteName(w,spec,"","bd"); w.String(".bmm  -bt  .\");
-							IF tempOut THEN w.String(builtSpecName); ELSE w.String("temp"); END;
-							w.String(".bit  -bd "); w.String(blockName);
-							w.String(" tag "); ActiveCells.WriteName(w,instance.scope,instance.name,"dat"); w.Int(iBlock,1);
-							w.String(" -o b .\");
-							IF tempOut THEN w.String("temp"); ELSE w.String(builtSpecName); END; tempOut := ~tempOut;
-							w.String(".bit");
-							w.Ln;
-
-							CopyAsBuilt(hwPath,blockName,"",hwPath,res);
-							IF res # 0 THEN RETURN; END;
-
-							INC(numPatched);
-						END;
-
-						INC(iBlock);
-					END;
-
-				END;
-			END;
-
-			IF numPatched > 0 THEN
-				IF ~tempOut THEN (* copy final bitstream stored in temp.bit to builtSpecName.bit *)
-					w.String("copy /B /Y /V temp.bit "); w.String(builtSpecName); w.String(".bit"); w.Ln;
-				END;
-				w.String("del temp.bit"); w.Ln;
-			END;
-
-			w.String("copy /B /Y /V "); w.String(builtSpecName); w.String(".bit"); w.String(" df.bit"); w.Ln;
-			w.String("copy /B /Y /V ..\download.cmd  download.cmd"); w.Ln;
-			w.String("impact -batch download.cmd"); w.Ln;
-			w.String("del df.bit"); w.Ln;
-
-			w.Update;
-			Files.Register(file);
-			file.Close;
-
-			(* execute the script *)
-			context.out.String("configuring the FPGA ... "); context.out.Update;
-			res := WinApplications.Call("temp.bat","");
-			IF res # 0 THEN context.error.String("failed to configure the FPGA, cmd batch res="); context.error.Int(res,0); context.error.Ln; context.error.Update; RETURN; END;
-
-			GetImpactCmdStatus(hwPath,success,res);
-			IF res # 0 THEN context.error.String("failed to determine status of Xilinx Impact command execution!"); RETURN; END;
-
-			IF success THEN
-				context.out.String("Ok"); context.out.Ln; context.out.Update;
-			ELSE
-				res := -1;
-				Files.JoinPath(hwPath,"_impactbatch.log",str);
-				context.error.String("failed to configure the FPGA: see "); context.error.String(str); context.error.String(" for details about the error!"); context.error.Ln; context.error.Update;
-			END;
-		END PatchAndConfigure;
-
-	BEGIN
-		NEW(options);
-		options.Add("p","platform",Options.String);
-		options.Add("f","specName",Options.String);
-		options.Add("n","forceNew",Options.Flag);
-		IF ~options.Parse(context.arg,context.error) THEN RETURN; END;
-
-		IF ~options.GetString("platform",platformId) THEN
-			context.error.String("platform string ID is expected!"); context.error.Ln; RETURN;
-		END;
-
-		IF ~options.GetString("specName",specName) THEN
-			context.error.String("specification file name is expected!"); context.error.Ln; RETURN;
-		END;
-
-		NEW(diagnostics,context.error);
-
-		spec := ActiveCells.LoadSpecification(specName,diagnostics,context.out);
-		IF spec = NIL THEN
-			context.error.String("failed to load specification from file "); context.error.String(specName); context.error.String(".spec"); context.error.Ln; RETURN;
-		END;
-
-		description := Hardware.GetDescription(platformId);
-		IF description = NIL THEN
-			context.error.String("failed to instantiate hardware description "); context.error.String(platformId); context.error.Ln; RETURN;
-		END;
-
-
-		(* get the hardware path *)
-		description.GetHardwarePath(hwPath);
-
-		(* remove the path from the specification name *)
-		Files.SplitPath(specName,specPath,specName); IF specPath = "" THEN specPath := "WORK:"; END;
-
-		Strings.Concat(BuiltPrefix,specName,builtSpecName);
-		Files.JoinPath(hwPath,builtSpecName,str);
-		builtSpec := ActiveCells.LoadSpecification(str,diagnostics,context.out);
-
-		changes := (builtSpec = NIL) OR ~spec.Same(builtSpec,{});
-
-		IF changes OR options.GetFlag("forceNew") THEN (* have to compile the hardware *)
-
-			IF changes THEN
-				context.out.String("detected changes in hardware specification, ");
-			END;
-			context.out.String("compiling FPGA hardware design ... "); context.out.Update;
-
-			(* remove old bit file *)
-			Files.JoinExtension(specName,"bit",str);
-			Files.JoinPath(hwPath,str,str);
-			DeleteFiles(str,context,res);
-
-			(* execute TCL script *)
-			Strings.Concat("xtclsh ",specName,str);
-			Strings.Concat(str,".tcl",str);
-			ExecuteInPath(str,hwPath,res);
-
-			(* get the result of compilation *)
-			IF res # 0 THEN context.error.String("failed to compile FPGA hardware design, cmd batch res="); context.error.Int(res,0); context.error.Ln; RETURN; END;
-
-			context.out.String("Ok"); context.out.Ln; context.out.Update;
-
-			(* remove old built bitstream *)
-			Files.JoinExtension(builtSpecName,"bit",str);
-			Files.JoinPath(hwPath,str,str);
-			DeleteFiles(str,context,res);
-			IF res # 0 THEN RETURN; END;
-
-			(* remove old built mem-files *)
-			Strings.Concat(builtSpecName,"*.mem",str);
-			Files.JoinPath(hwPath,str,str);
-			DeleteFiles(str,context,res);
-			IF res # 0 THEN RETURN; END;
-
-			(*
-				make a copy of the bitstream and use it as a built version
-			*)
-			CopyAsBuilt(hwPath,specName,"bit",hwPath,res);
-			IF res # 0 THEN RETURN; END;
-
-			(*
-				remember the current specification as already built
-			*)
-			CopyAsBuilt(specPath,specName,"spec",hwPath,res);
-			IF res # 0 THEN RETURN; END;
-		END;
-
-		PatchAndConfigure(res);
-
-		IF res = 0 THEN
-			context.out.String("successfully built ActiveCells hardware!"); context.out.Ln;
-		ELSE context.result := Commands.CommandError
-		END;
-	END BuildHardware;
 
-BEGIN
-	NEW(random);
-	random.InitSeed(SHORT(Machine.GetTimer()));
 END FoxTRMTools.
 
 FoxTRMTools.Test ~