Index: mcctv/usb/rom_com1.qip
===================================================================
--- mcctv/usb/rom_com1.qip	(revision 281)
+++ mcctv/usb/rom_com1.qip	(nonexistent)
@@ -1,4 +0,0 @@
-set_global_assignment -name IP_TOOL_NAME "ROM: 1-PORT"
-set_global_assignment -name IP_TOOL_VERSION "10.0"
-set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "rom_com1.vhd"]
-set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "rom_com1.cmp"]
Index: mcctv/usb/rom_com.mif
===================================================================
--- mcctv/usb/rom_com.mif	(revision 281)
+++ mcctv/usb/rom_com.mif	(nonexistent)
@@ -1,2053 +0,0 @@
--- Copyright (C) 1991-2010 Altera Corporation
--- Your use of Altera Corporation's design tools, logic functions 
--- and other software and tools, and its AMPP partner logic 
--- functions, and any output files from any of the foregoing 
--- (including device programming or simulation files), and any 
--- associated documentation or information are expressly subject 
--- to the terms and conditions of the Altera Program License 
--- Subscription Agreement, Altera MegaCore Function License 
--- Agreement, or other applicable license agreement, including, 
--- without limitation, that your use is for the sole purpose of 
--- programming logic devices manufactured by Altera and sold by 
--- Altera or its authorized distributors.  Please refer to the 
--- applicable agreement for further details.
-
--- Quartus II generated Memory Initialization File (.mif)
-
-WIDTH=8;
-DEPTH=2048;
-
-ADDRESS_RADIX=HEX;
-DATA_RADIX=HEX;
-
-CONTENT BEGIN
-	000  :   04;
-	001  :   80;
-	002  :   2D;
-	003  :   00;
-	004  :   10;
-	005  :   0C;
-	006  :   80;
-	007  :   C3;
-	008  :   80;
-	009  :   06;
-	00A  :   00;
-	00B  :   01;
-	[00C..00D]  :   00;
-	00E  :   40;
-	00F  :   00;
-	010  :   DD;
-	011  :   94;
-	012  :   04;
-	013  :   80;
-	014  :   2D;
-	015  :   00;
-	016  :   10;
-	017  :   0C;
-	018  :   80;
-	019  :   C3;
-	01A  :   00;
-	01B  :   05;
-	01C  :   01;
-	[01D..021]  :   00;
-	022  :   EB;
-	023  :   25;
-	024  :   04;
-	025  :   80;
-	026  :   69;
-	027  :   00;
-	028  :   10;
-	029  :   01;
-	02A  :   02;
-	[02B..02C]  :   03;
-	[02D..02E]  :   04;
-	02F  :   05;
-	030  :   00;
-	031  :   01;
-	032  :   02;
-	033  :   03;
-	034  :   04;
-	[035..036]  :   05;
-	037  :   06;
-	038  :   00;
-	039  :   02;
-	03A  :   03;
-	03B  :   04;
-	03C  :   05;
-	[03D..03E]  :   06;
-	03F  :   07;
-	040  :   02;
-	041  :   80;
-	042  :   D2;
-	043  :   05;
-	044  :   06;
-	[045..046]  :   07;
-	047  :   08;
-	048  :   00;
-	049  :   02;
-	04A  :   04;
-	04B  :   05;
-	04C  :   06;
-	04D  :   07;
-	04E  :   08;
-	04F  :   09;
-	050  :   04;
-	051  :   80;
-	052  :   2D;
-	053  :   01;
-	054  :   E8;
-	055  :   0C;
-	056  :   80;
-	057  :   C3;
-	058  :   00;
-	059  :   09;
-	05A  :   01;
-	[05B..05F]  :   00;
-	060  :   27;
-	061  :   25;
-	062  :   04;
-	063  :   80;
-	064  :   69;
-	065  :   01;
-	066  :   E8;
-	067  :   0C;
-	068  :   01;
-	069  :   03;
-	06A  :   06;
-	06B  :   08;
-	06C  :   0A;
-	06D  :   0B;
-	06E  :   0C;
-	06F  :   0D;
-	070  :   04;
-	071  :   80;
-	072  :   2D;
-	073  :   01;
-	074  :   E8;
-	075  :   0C;
-	076  :   80;
-	077  :   C3;
-	078  :   21;
-	079  :   0A;
-	[07A..07F]  :   00;
-	080  :   D6;
-	081  :   20;
-	082  :   04;
-	083  :   80;
-	084  :   69;
-	085  :   01;
-	086  :   E8;
-	087  :   10;
-	088  :   01;
-	089  :   04;
-	08A  :   08;
-	08B  :   0A;
-	08C  :   0D;
-	08D  :   0F;
-	08E  :   10;
-	08F  :   11;
-	090  :   04;
-	091  :   80;
-	092  :   69;
-	093  :   81;
-	094  :   58;
-	095  :   0F;
-	096  :   11;
-	097  :   12;
-	098  :   01;
-	099  :   05;
-	09A  :   08;
-	09B  :   0C;
-	09C  :   0E;
-	09D  :   10;
-	09E  :   12;
-	09F  :   13;
-	0A0  :   01;
-	0A1  :   05;
-	0A2  :   09;
-	0A3  :   0C;
-	0A4  :   0F;
-	0A5  :   11;
-	0A6  :   13;
-	0A7  :   14;
-	0A8  :   02;
-	0A9  :   06;
-	0AA  :   09;
-	0AB  :   0D;
-	0AC  :   10;
-	0AD  :   12;
-	0AE  :   14;
-	0AF  :   15;
-	0B0  :   02;
-	0B1  :   06;
-	0B2  :   0A;
-	0B3  :   0E;
-	0B4  :   11;
-	0B5  :   13;
-	0B6  :   15;
-	0B7  :   16;
-	0B8  :   02;
-	0B9  :   06;
-	0BA  :   0A;
-	0BB  :   0E;
-	0BC  :   11;
-	0BD  :   14;
-	0BE  :   16;
-	0BF  :   17;
-	0C0  :   02;
-	0C1  :   07;
-	0C2  :   0B;
-	0C3  :   0F;
-	0C4  :   12;
-	0C5  :   15;
-	0C6  :   17;
-	0C7  :   18;
-	0C8  :   02;
-	0C9  :   07;
-	0CA  :   0B;
-	0CB  :   0F;
-	0CC  :   13;
-	0CD  :   16;
-	0CE  :   18;
-	0CF  :   19;
-	0D0  :   02;
-	0D1  :   07;
-	0D2  :   0C;
-	0D3  :   10;
-	0D4  :   14;
-	0D5  :   17;
-	0D6  :   19;
-	0D7  :   1A;
-	0D8  :   02;
-	0D9  :   07;
-	0DA  :   0C;
-	0DB  :   11;
-	0DC  :   14;
-	0DD  :   17;
-	0DE  :   19;
-	0DF  :   1B;
-	0E0  :   02;
-	0E1  :   08;
-	0E2  :   0D;
-	0E3  :   11;
-	0E4  :   15;
-	0E5  :   18;
-	0E6  :   1A;
-	0E7  :   1C;
-	0E8  :   02;
-	0E9  :   08;
-	0EA  :   0D;
-	0EB  :   12;
-	0EC  :   16;
-	0ED  :   19;
-	0EE  :   1B;
-	0EF  :   1D;
-	0F0  :   02;
-	0F1  :   08;
-	0F2  :   0E;
-	0F3  :   13;
-	0F4  :   17;
-	0F5  :   1A;
-	0F6  :   1C;
-	0F7  :   1E;
-	0F8  :   03;
-	0F9  :   09;
-	0FA  :   0E;
-	0FB  :   13;
-	0FC  :   18;
-	0FD  :   1B;
-	0FE  :   1D;
-	0FF  :   1F;
-	100  :   03;
-	101  :   09;
-	102  :   0F;
-	103  :   14;
-	104  :   18;
-	105  :   1C;
-	106  :   1E;
-	107  :   20;
-	108  :   03;
-	109  :   09;
-	10A  :   0F;
-	10B  :   15;
-	10C  :   19;
-	10D  :   1D;
-	10E  :   1F;
-	10F  :   21;
-	110  :   03;
-	111  :   09;
-	112  :   10;
-	113  :   15;
-	114  :   1A;
-	115  :   1E;
-	116  :   20;
-	117  :   22;
-	118  :   03;
-	119  :   0A;
-	11A  :   10;
-	11B  :   16;
-	11C  :   1B;
-	11D  :   1F;
-	11E  :   21;
-	11F  :   23;
-	120  :   03;
-	121  :   0A;
-	122  :   11;
-	123  :   16;
-	124  :   1B;
-	125  :   1F;
-	126  :   22;
-	127  :   24;
-	128  :   03;
-	129  :   0A;
-	12A  :   11;
-	12B  :   17;
-	12C  :   1C;
-	12D  :   20;
-	12E  :   23;
-	12F  :   25;
-	130  :   03;
-	131  :   0B;
-	132  :   11;
-	133  :   18;
-	134  :   1D;
-	135  :   21;
-	136  :   24;
-	137  :   26;
-	138  :   03;
-	139  :   0B;
-	13A  :   12;
-	13B  :   18;
-	13C  :   1E;
-	13D  :   22;
-	13E  :   25;
-	13F  :   27;
-	140  :   03;
-	141  :   0B;
-	142  :   12;
-	143  :   19;
-	144  :   1F;
-	145  :   23;
-	146  :   26;
-	147  :   28;
-	148  :   04;
-	149  :   0B;
-	14A  :   13;
-	14B  :   1A;
-	14C  :   1F;
-	14D  :   24;
-	14E  :   27;
-	14F  :   29;
-	150  :   04;
-	151  :   0C;
-	152  :   13;
-	153  :   1A;
-	154  :   20;
-	155  :   25;
-	156  :   28;
-	157  :   2A;
-	158  :   04;
-	159  :   0C;
-	15A  :   14;
-	15B  :   1B;
-	15C  :   21;
-	15D  :   26;
-	15E  :   29;
-	15F  :   2B;
-	160  :   04;
-	161  :   0C;
-	162  :   14;
-	163  :   1C;
-	164  :   22;
-	165  :   26;
-	166  :   2A;
-	167  :   2C;
-	168  :   04;
-	169  :   0D;
-	16A  :   15;
-	16B  :   1C;
-	16C  :   22;
-	16D  :   27;
-	16E  :   2B;
-	16F  :   2D;
-	170  :   04;
-	171  :   0D;
-	172  :   15;
-	173  :   1D;
-	174  :   23;
-	175  :   28;
-	176  :   2C;
-	177  :   2E;
-	178  :   04;
-	179  :   0D;
-	17A  :   16;
-	17B  :   1D;
-	17C  :   24;
-	17D  :   29;
-	17E  :   2D;
-	17F  :   2F;
-	180  :   04;
-	181  :   0E;
-	182  :   16;
-	183  :   1E;
-	184  :   25;
-	185  :   2A;
-	186  :   2E;
-	187  :   30;
-	188  :   04;
-	189  :   0E;
-	18A  :   17;
-	18B  :   1F;
-	18C  :   26;
-	18D  :   2B;
-	18E  :   2F;
-	18F  :   31;
-	190  :   04;
-	191  :   0E;
-	192  :   17;
-	193  :   1F;
-	194  :   26;
-	195  :   2C;
-	196  :   30;
-	197  :   32;
-	198  :   05;
-	199  :   0E;
-	19A  :   18;
-	19B  :   20;
-	19C  :   27;
-	19D  :   2D;
-	19E  :   31;
-	19F  :   33;
-	1A0  :   05;
-	1A1  :   0F;
-	1A2  :   18;
-	1A3  :   21;
-	1A4  :   28;
-	1A5  :   2E;
-	1A6  :   32;
-	1A7  :   34;
-	1A8  :   05;
-	1A9  :   0F;
-	1AA  :   19;
-	1AB  :   21;
-	1AC  :   29;
-	1AD  :   2E;
-	1AE  :   32;
-	1AF  :   35;
-	1B0  :   05;
-	1B1  :   0F;
-	1B2  :   19;
-	1B3  :   22;
-	1B4  :   29;
-	1B5  :   2F;
-	1B6  :   33;
-	1B7  :   36;
-	1B8  :   05;
-	1B9  :   10;
-	1BA  :   1A;
-	1BB  :   23;
-	1BC  :   2A;
-	1BD  :   30;
-	1BE  :   34;
-	1BF  :   37;
-	1C0  :   05;
-	1C1  :   10;
-	1C2  :   1A;
-	1C3  :   23;
-	1C4  :   2B;
-	1C5  :   31;
-	1C6  :   35;
-	1C7  :   38;
-	1C8  :   05;
-	1C9  :   10;
-	1CA  :   1A;
-	1CB  :   24;
-	1CC  :   2C;
-	1CD  :   32;
-	1CE  :   36;
-	1CF  :   39;
-	1D0  :   05;
-	1D1  :   10;
-	1D2  :   1B;
-	1D3  :   24;
-	1D4  :   2D;
-	1D5  :   33;
-	1D6  :   37;
-	1D7  :   3A;
-	1D8  :   05;
-	1D9  :   11;
-	1DA  :   1B;
-	1DB  :   25;
-	1DC  :   2D;
-	1DD  :   34;
-	1DE  :   38;
-	1DF  :   3B;
-	1E0  :   05;
-	1E1  :   11;
-	1E2  :   1C;
-	1E3  :   26;
-	1E4  :   2E;
-	1E5  :   35;
-	1E6  :   39;
-	1E7  :   3C;
-	1E8  :   06;
-	1E9  :   11;
-	1EA  :   1C;
-	1EB  :   26;
-	1EC  :   2F;
-	1ED  :   36;
-	1EE  :   3A;
-	1EF  :   3D;
-	1F0  :   06;
-	1F1  :   12;
-	1F2  :   1D;
-	1F3  :   27;
-	1F4  :   30;
-	1F5  :   36;
-	1F6  :   3B;
-	1F7  :   3E;
-	1F8  :   06;
-	1F9  :   12;
-	1FA  :   1D;
-	1FB  :   28;
-	1FC  :   30;
-	1FD  :   37;
-	1FE  :   3C;
-	1FF  :   3F;
-	200  :   06;
-	201  :   12;
-	202  :   1E;
-	203  :   28;
-	204  :   31;
-	205  :   38;
-	206  :   3D;
-	207  :   40;
-	208  :   06;
-	209  :   12;
-	20A  :   1E;
-	20B  :   29;
-	20C  :   32;
-	20D  :   39;
-	20E  :   3E;
-	20F  :   41;
-	210  :   06;
-	211  :   13;
-	212  :   1F;
-	213  :   2A;
-	214  :   33;
-	215  :   3A;
-	216  :   3F;
-	217  :   42;
-	218  :   06;
-	219  :   13;
-	21A  :   1F;
-	21B  :   2A;
-	21C  :   34;
-	21D  :   3B;
-	21E  :   40;
-	21F  :   43;
-	220  :   06;
-	221  :   13;
-	222  :   20;
-	223  :   2B;
-	224  :   34;
-	225  :   3C;
-	226  :   41;
-	227  :   44;
-	228  :   06;
-	229  :   14;
-	22A  :   20;
-	22B  :   2B;
-	22C  :   35;
-	22D  :   3D;
-	22E  :   42;
-	22F  :   45;
-	230  :   06;
-	231  :   14;
-	232  :   21;
-	233  :   2C;
-	234  :   36;
-	235  :   3E;
-	236  :   43;
-	237  :   46;
-	238  :   06;
-	239  :   14;
-	23A  :   21;
-	23B  :   2D;
-	23C  :   37;
-	23D  :   3E;
-	23E  :   44;
-	23F  :   47;
-	240  :   07;
-	241  :   15;
-	242  :   22;
-	243  :   2D;
-	244  :   37;
-	245  :   3F;
-	246  :   45;
-	247  :   48;
-	248  :   07;
-	249  :   15;
-	24A  :   22;
-	24B  :   2E;
-	24C  :   38;
-	24D  :   40;
-	24E  :   46;
-	24F  :   49;
-	250  :   07;
-	251  :   15;
-	252  :   23;
-	253  :   2F;
-	254  :   39;
-	255  :   41;
-	256  :   47;
-	257  :   4A;
-	258  :   07;
-	259  :   15;
-	25A  :   23;
-	25B  :   2F;
-	25C  :   3A;
-	25D  :   42;
-	25E  :   48;
-	25F  :   4B;
-	260  :   07;
-	261  :   16;
-	262  :   23;
-	263  :   30;
-	264  :   3B;
-	265  :   43;
-	266  :   49;
-	267  :   4C;
-	268  :   07;
-	269  :   16;
-	26A  :   24;
-	26B  :   31;
-	26C  :   3B;
-	26D  :   44;
-	26E  :   4A;
-	26F  :   4D;
-	270  :   07;
-	271  :   16;
-	272  :   24;
-	273  :   31;
-	274  :   3C;
-	275  :   45;
-	276  :   4B;
-	277  :   4E;
-	278  :   07;
-	279  :   17;
-	27A  :   25;
-	27B  :   32;
-	27C  :   3D;
-	27D  :   46;
-	27E  :   4B;
-	27F  :   4F;
-	280  :   07;
-	281  :   17;
-	282  :   25;
-	283  :   32;
-	284  :   3E;
-	285  :   46;
-	286  :   4C;
-	287  :   50;
-	288  :   07;
-	289  :   17;
-	28A  :   26;
-	28B  :   33;
-	28C  :   3E;
-	28D  :   47;
-	28E  :   4D;
-	28F  :   51;
-	290  :   08;
-	291  :   17;
-	292  :   26;
-	293  :   34;
-	294  :   3F;
-	295  :   48;
-	296  :   4E;
-	297  :   52;
-	298  :   08;
-	299  :   18;
-	29A  :   27;
-	29B  :   34;
-	29C  :   40;
-	29D  :   49;
-	29E  :   4F;
-	29F  :   53;
-	2A0  :   08;
-	2A1  :   18;
-	2A2  :   27;
-	2A3  :   35;
-	2A4  :   41;
-	2A5  :   4A;
-	2A6  :   50;
-	2A7  :   54;
-	2A8  :   08;
-	2A9  :   18;
-	2AA  :   28;
-	2AB  :   36;
-	2AC  :   42;
-	2AD  :   4B;
-	2AE  :   51;
-	2AF  :   55;
-	2B0  :   08;
-	2B1  :   19;
-	2B2  :   28;
-	2B3  :   36;
-	2B4  :   42;
-	2B5  :   4C;
-	2B6  :   52;
-	2B7  :   56;
-	2B8  :   08;
-	2B9  :   19;
-	2BA  :   29;
-	2BB  :   37;
-	2BC  :   43;
-	2BD  :   4D;
-	2BE  :   53;
-	2BF  :   57;
-	2C0  :   08;
-	2C1  :   19;
-	2C2  :   29;
-	2C3  :   38;
-	2C4  :   44;
-	2C5  :   4D;
-	2C6  :   54;
-	2C7  :   58;
-	2C8  :   08;
-	2C9  :   19;
-	2CA  :   2A;
-	2CB  :   38;
-	2CC  :   45;
-	2CD  :   4E;
-	2CE  :   55;
-	2CF  :   59;
-	2D0  :   08;
-	2D1  :   1A;
-	2D2  :   2A;
-	2D3  :   39;
-	2D4  :   45;
-	2D5  :   4F;
-	2D6  :   56;
-	2D7  :   5A;
-	2D8  :   08;
-	2D9  :   1A;
-	2DA  :   2B;
-	2DB  :   3A;
-	2DC  :   46;
-	2DD  :   50;
-	2DE  :   57;
-	2DF  :   5B;
-	2E0  :   09;
-	2E1  :   1A;
-	2E2  :   2B;
-	2E3  :   3A;
-	2E4  :   47;
-	2E5  :   51;
-	2E6  :   58;
-	2E7  :   5C;
-	2E8  :   09;
-	2E9  :   1B;
-	2EA  :   2C;
-	2EB  :   3B;
-	2EC  :   48;
-	2ED  :   52;
-	2EE  :   59;
-	2EF  :   5D;
-	2F0  :   09;
-	2F1  :   1B;
-	2F2  :   2C;
-	2F3  :   3B;
-	2F4  :   49;
-	2F5  :   53;
-	2F6  :   5A;
-	2F7  :   5E;
-	2F8  :   09;
-	2F9  :   1B;
-	2FA  :   2C;
-	2FB  :   3C;
-	2FC  :   49;
-	2FD  :   54;
-	2FE  :   5B;
-	2FF  :   5F;
-	300  :   09;
-	301  :   1C;
-	302  :   2D;
-	303  :   3D;
-	304  :   4A;
-	305  :   55;
-	306  :   5C;
-	307  :   60;
-	308  :   09;
-	309  :   1C;
-	30A  :   2D;
-	30B  :   3D;
-	30C  :   4B;
-	30D  :   55;
-	30E  :   5D;
-	30F  :   61;
-	310  :   09;
-	311  :   1C;
-	312  :   2E;
-	313  :   3E;
-	314  :   4C;
-	315  :   56;
-	316  :   5E;
-	317  :   62;
-	318  :   09;
-	319  :   1C;
-	31A  :   2E;
-	31B  :   3F;
-	31C  :   4C;
-	31D  :   57;
-	31E  :   5F;
-	31F  :   63;
-	320  :   09;
-	321  :   1D;
-	322  :   2F;
-	323  :   3F;
-	324  :   4D;
-	325  :   58;
-	326  :   60;
-	327  :   64;
-	328  :   09;
-	329  :   1D;
-	32A  :   2F;
-	32B  :   40;
-	32C  :   4E;
-	32D  :   59;
-	32E  :   61;
-	32F  :   65;
-	330  :   0A;
-	331  :   1D;
-	332  :   30;
-	333  :   41;
-	334  :   4F;
-	335  :   5A;
-	336  :   62;
-	337  :   66;
-	338  :   0A;
-	339  :   1E;
-	33A  :   30;
-	33B  :   41;
-	33C  :   50;
-	33D  :   5B;
-	33E  :   63;
-	33F  :   67;
-	340  :   0A;
-	341  :   1E;
-	342  :   31;
-	343  :   42;
-	344  :   50;
-	345  :   5C;
-	346  :   64;
-	347  :   68;
-	348  :   0A;
-	349  :   1E;
-	34A  :   31;
-	34B  :   42;
-	34C  :   51;
-	34D  :   5D;
-	34E  :   64;
-	34F  :   69;
-	350  :   0A;
-	351  :   1E;
-	352  :   32;
-	353  :   43;
-	354  :   52;
-	355  :   5D;
-	356  :   65;
-	357  :   6A;
-	358  :   0A;
-	359  :   1F;
-	35A  :   32;
-	35B  :   44;
-	35C  :   53;
-	35D  :   5E;
-	35E  :   66;
-	35F  :   6B;
-	360  :   0A;
-	361  :   1F;
-	362  :   33;
-	363  :   44;
-	364  :   53;
-	365  :   5F;
-	366  :   67;
-	367  :   6C;
-	368  :   0A;
-	369  :   1F;
-	36A  :   33;
-	36B  :   45;
-	36C  :   54;
-	36D  :   60;
-	36E  :   68;
-	36F  :   6D;
-	370  :   0A;
-	371  :   20;
-	372  :   34;
-	373  :   46;
-	374  :   55;
-	375  :   61;
-	376  :   69;
-	377  :   6E;
-	378  :   0A;
-	379  :   20;
-	37A  :   34;
-	37B  :   46;
-	37C  :   56;
-	37D  :   62;
-	37E  :   6A;
-	37F  :   6F;
-	380  :   0B;
-	381  :   20;
-	382  :   35;
-	383  :   47;
-	384  :   56;
-	385  :   63;
-	386  :   6B;
-	387  :   70;
-	388  :   0B;
-	389  :   20;
-	38A  :   35;
-	38B  :   48;
-	38C  :   57;
-	38D  :   64;
-	38E  :   6C;
-	38F  :   71;
-	390  :   0B;
-	391  :   21;
-	392  :   35;
-	393  :   48;
-	394  :   58;
-	395  :   65;
-	396  :   6D;
-	397  :   72;
-	398  :   0B;
-	399  :   21;
-	39A  :   36;
-	39B  :   49;
-	39C  :   59;
-	39D  :   65;
-	39E  :   6E;
-	39F  :   73;
-	3A0  :   0B;
-	3A1  :   21;
-	3A2  :   36;
-	3A3  :   49;
-	3A4  :   5A;
-	3A5  :   66;
-	3A6  :   6F;
-	3A7  :   74;
-	3A8  :   0B;
-	3A9  :   22;
-	3AA  :   37;
-	3AB  :   4A;
-	3AC  :   5A;
-	3AD  :   67;
-	3AE  :   70;
-	3AF  :   75;
-	3B0  :   0B;
-	3B1  :   22;
-	3B2  :   37;
-	3B3  :   4B;
-	3B4  :   5B;
-	3B5  :   68;
-	3B6  :   71;
-	3B7  :   76;
-	3B8  :   0B;
-	3B9  :   22;
-	3BA  :   38;
-	3BB  :   4B;
-	3BC  :   5C;
-	3BD  :   69;
-	3BE  :   72;
-	3BF  :   77;
-	3C0  :   0B;
-	3C1  :   23;
-	3C2  :   38;
-	3C3  :   4C;
-	3C4  :   5D;
-	3C5  :   6A;
-	3C6  :   73;
-	3C7  :   78;
-	3C8  :   0B;
-	3C9  :   23;
-	3CA  :   39;
-	3CB  :   4D;
-	3CC  :   5D;
-	3CD  :   6B;
-	3CE  :   74;
-	3CF  :   79;
-	3D0  :   0C;
-	3D1  :   23;
-	3D2  :   39;
-	3D3  :   4D;
-	3D4  :   5E;
-	3D5  :   6C;
-	3D6  :   75;
-	3D7  :   7A;
-	3D8  :   0C;
-	3D9  :   23;
-	3DA  :   3A;
-	3DB  :   4E;
-	3DC  :   5F;
-	3DD  :   6D;
-	3DE  :   76;
-	3DF  :   7B;
-	3E0  :   0C;
-	3E1  :   24;
-	3E2  :   3A;
-	3E3  :   4F;
-	3E4  :   60;
-	3E5  :   6D;
-	3E6  :   77;
-	3E7  :   7C;
-	3E8  :   0C;
-	3E9  :   24;
-	3EA  :   3B;
-	3EB  :   4F;
-	3EC  :   61;
-	3ED  :   6E;
-	3EE  :   78;
-	3EF  :   7D;
-	3F0  :   0C;
-	3F1  :   24;
-	3F2  :   3B;
-	3F3  :   50;
-	3F4  :   61;
-	3F5  :   6F;
-	3F6  :   79;
-	3F7  :   7E;
-	3F8  :   0C;
-	3F9  :   25;
-	3FA  :   3C;
-	3FB  :   50;
-	3FC  :   62;
-	3FD  :   70;
-	3FE  :   7A;
-	3FF  :   7F;
-	400  :   0C;
-	401  :   25;
-	402  :   3C;
-	403  :   51;
-	404  :   63;
-	405  :   71;
-	406  :   7B;
-	407  :   80;
-	408  :   0C;
-	409  :   25;
-	40A  :   3D;
-	40B  :   52;
-	40C  :   64;
-	40D  :   72;
-	40E  :   7C;
-	40F  :   81;
-	410  :   0C;
-	411  :   25;
-	412  :   3D;
-	413  :   52;
-	414  :   64;
-	415  :   73;
-	416  :   7D;
-	417  :   82;
-	418  :   0C;
-	419  :   26;
-	41A  :   3E;
-	41B  :   53;
-	41C  :   65;
-	41D  :   74;
-	41E  :   7D;
-	41F  :   83;
-	420  :   0D;
-	421  :   26;
-	422  :   3E;
-	423  :   54;
-	424  :   66;
-	425  :   74;
-	426  :   7E;
-	427  :   84;
-	428  :   0D;
-	429  :   26;
-	42A  :   3E;
-	42B  :   54;
-	42C  :   67;
-	42D  :   75;
-	42E  :   7F;
-	42F  :   85;
-	430  :   0D;
-	431  :   27;
-	432  :   3F;
-	433  :   55;
-	434  :   68;
-	435  :   76;
-	436  :   80;
-	437  :   86;
-	438  :   0D;
-	439  :   27;
-	43A  :   3F;
-	43B  :   56;
-	43C  :   68;
-	43D  :   77;
-	43E  :   81;
-	43F  :   87;
-	440  :   0D;
-	441  :   27;
-	442  :   40;
-	443  :   56;
-	444  :   69;
-	445  :   78;
-	446  :   82;
-	447  :   88;
-	448  :   0D;
-	449  :   27;
-	44A  :   40;
-	44B  :   57;
-	44C  :   6A;
-	44D  :   79;
-	44E  :   83;
-	44F  :   89;
-	450  :   0D;
-	451  :   28;
-	452  :   41;
-	453  :   57;
-	454  :   6B;
-	455  :   7A;
-	456  :   84;
-	457  :   8A;
-	458  :   0D;
-	459  :   28;
-	45A  :   41;
-	45B  :   58;
-	45C  :   6B;
-	45D  :   7B;
-	45E  :   85;
-	45F  :   8B;
-	460  :   0D;
-	461  :   28;
-	462  :   42;
-	463  :   59;
-	464  :   6C;
-	465  :   7C;
-	466  :   86;
-	467  :   8C;
-	468  :   0D;
-	469  :   29;
-	46A  :   42;
-	46B  :   59;
-	46C  :   6D;
-	46D  :   7C;
-	46E  :   87;
-	46F  :   8D;
-	470  :   0D;
-	471  :   29;
-	472  :   43;
-	473  :   5A;
-	474  :   6E;
-	475  :   7D;
-	476  :   88;
-	477  :   8E;
-	478  :   0E;
-	479  :   29;
-	47A  :   43;
-	47B  :   5B;
-	47C  :   6F;
-	47D  :   7E;
-	47E  :   89;
-	47F  :   8F;
-	480  :   0E;
-	481  :   2A;
-	482  :   44;
-	483  :   5B;
-	484  :   6F;
-	485  :   7F;
-	486  :   8A;
-	487  :   90;
-	488  :   0E;
-	489  :   2A;
-	48A  :   44;
-	48B  :   5C;
-	48C  :   70;
-	48D  :   80;
-	48E  :   8B;
-	48F  :   91;
-	490  :   0E;
-	491  :   2A;
-	492  :   45;
-	493  :   5D;
-	494  :   71;
-	495  :   81;
-	496  :   8C;
-	497  :   92;
-	498  :   0E;
-	499  :   2A;
-	49A  :   45;
-	49B  :   5D;
-	49C  :   72;
-	49D  :   82;
-	49E  :   8D;
-	49F  :   93;
-	4A0  :   0E;
-	4A1  :   2B;
-	4A2  :   46;
-	4A3  :   5E;
-	4A4  :   72;
-	4A5  :   83;
-	4A6  :   8E;
-	4A7  :   94;
-	4A8  :   0E;
-	4A9  :   2B;
-	4AA  :   46;
-	4AB  :   5E;
-	4AC  :   73;
-	4AD  :   84;
-	4AE  :   8F;
-	4AF  :   95;
-	4B0  :   0E;
-	4B1  :   2B;
-	4B2  :   47;
-	4B3  :   5F;
-	4B4  :   74;
-	4B5  :   84;
-	4B6  :   90;
-	4B7  :   96;
-	4B8  :   0E;
-	4B9  :   2C;
-	4BA  :   47;
-	4BB  :   60;
-	4BC  :   75;
-	4BD  :   85;
-	4BE  :   91;
-	4BF  :   97;
-	4C0  :   0E;
-	4C1  :   2C;
-	4C2  :   47;
-	4C3  :   60;
-	4C4  :   76;
-	4C5  :   86;
-	4C6  :   92;
-	4C7  :   98;
-	4C8  :   0F;
-	4C9  :   2C;
-	4CA  :   48;
-	4CB  :   61;
-	4CC  :   76;
-	4CD  :   87;
-	4CE  :   93;
-	4CF  :   99;
-	4D0  :   0F;
-	4D1  :   2C;
-	4D2  :   48;
-	4D3  :   62;
-	4D4  :   77;
-	4D5  :   88;
-	4D6  :   94;
-	4D7  :   9A;
-	4D8  :   0F;
-	4D9  :   2D;
-	4DA  :   49;
-	4DB  :   62;
-	4DC  :   78;
-	4DD  :   89;
-	4DE  :   95;
-	4DF  :   9B;
-	4E0  :   0F;
-	4E1  :   2D;
-	4E2  :   49;
-	4E3  :   63;
-	4E4  :   79;
-	4E5  :   8A;
-	4E6  :   96;
-	4E7  :   9C;
-	4E8  :   0F;
-	4E9  :   2D;
-	4EA  :   4A;
-	4EB  :   64;
-	4EC  :   79;
-	4ED  :   8B;
-	4EE  :   96;
-	4EF  :   9D;
-	4F0  :   0F;
-	4F1  :   2E;
-	4F2  :   4A;
-	4F3  :   64;
-	4F4  :   7A;
-	4F5  :   8C;
-	4F6  :   97;
-	4F7  :   9E;
-	4F8  :   0F;
-	4F9  :   2E;
-	4FA  :   4B;
-	4FB  :   65;
-	4FC  :   7B;
-	4FD  :   8C;
-	4FE  :   98;
-	4FF  :   9F;
-	500  :   0F;
-	501  :   2E;
-	502  :   4B;
-	503  :   65;
-	504  :   7C;
-	505  :   8D;
-	506  :   99;
-	507  :   A0;
-	508  :   0F;
-	509  :   2E;
-	50A  :   4C;
-	50B  :   66;
-	50C  :   7D;
-	50D  :   8E;
-	50E  :   9A;
-	50F  :   A1;
-	510  :   0F;
-	511  :   2F;
-	512  :   4C;
-	513  :   67;
-	514  :   7D;
-	515  :   8F;
-	516  :   9B;
-	517  :   A2;
-	518  :   10;
-	519  :   2F;
-	51A  :   4D;
-	51B  :   67;
-	51C  :   7E;
-	51D  :   90;
-	51E  :   9C;
-	51F  :   A3;
-	520  :   10;
-	521  :   2F;
-	522  :   4D;
-	523  :   68;
-	524  :   7F;
-	525  :   91;
-	526  :   9D;
-	527  :   A4;
-	528  :   10;
-	529  :   30;
-	52A  :   4E;
-	52B  :   69;
-	52C  :   80;
-	52D  :   92;
-	52E  :   9E;
-	52F  :   A5;
-	530  :   10;
-	531  :   30;
-	532  :   4E;
-	533  :   69;
-	534  :   80;
-	535  :   93;
-	536  :   9F;
-	537  :   A6;
-	538  :   10;
-	539  :   30;
-	53A  :   4F;
-	53B  :   6A;
-	53C  :   81;
-	53D  :   93;
-	53E  :   A0;
-	53F  :   A7;
-	540  :   10;
-	541  :   31;
-	542  :   4F;
-	543  :   6B;
-	544  :   82;
-	545  :   94;
-	546  :   A1;
-	547  :   A8;
-	548  :   10;
-	549  :   31;
-	54A  :   50;
-	54B  :   6B;
-	54C  :   83;
-	54D  :   95;
-	54E  :   A2;
-	54F  :   A9;
-	550  :   10;
-	551  :   31;
-	552  :   50;
-	553  :   6C;
-	554  :   84;
-	555  :   96;
-	556  :   A3;
-	557  :   AA;
-	558  :   10;
-	559  :   31;
-	55A  :   50;
-	55B  :   6D;
-	55C  :   84;
-	55D  :   97;
-	55E  :   A4;
-	55F  :   AB;
-	560  :   10;
-	561  :   32;
-	562  :   51;
-	563  :   6D;
-	564  :   85;
-	565  :   98;
-	566  :   A5;
-	567  :   AC;
-	568  :   11;
-	569  :   32;
-	56A  :   51;
-	56B  :   6E;
-	56C  :   86;
-	56D  :   99;
-	56E  :   A6;
-	56F  :   AD;
-	570  :   11;
-	571  :   32;
-	572  :   52;
-	573  :   6E;
-	574  :   87;
-	575  :   9A;
-	576  :   A7;
-	577  :   AE;
-	578  :   11;
-	579  :   33;
-	57A  :   52;
-	57B  :   6F;
-	57C  :   87;
-	57D  :   9B;
-	57E  :   A8;
-	57F  :   AF;
-	580  :   11;
-	581  :   33;
-	582  :   53;
-	583  :   70;
-	584  :   88;
-	585  :   9B;
-	586  :   A9;
-	587  :   B0;
-	588  :   11;
-	589  :   33;
-	58A  :   53;
-	58B  :   70;
-	58C  :   89;
-	58D  :   9C;
-	58E  :   AA;
-	58F  :   B1;
-	590  :   11;
-	591  :   33;
-	592  :   54;
-	593  :   71;
-	594  :   8A;
-	595  :   9D;
-	596  :   AB;
-	597  :   B2;
-	598  :   11;
-	599  :   34;
-	59A  :   54;
-	59B  :   72;
-	59C  :   8B;
-	59D  :   9E;
-	59E  :   AC;
-	59F  :   B3;
-	5A0  :   11;
-	5A1  :   34;
-	5A2  :   55;
-	5A3  :   72;
-	5A4  :   8B;
-	5A5  :   9F;
-	5A6  :   AD;
-	5A7  :   B4;
-	5A8  :   11;
-	5A9  :   34;
-	5AA  :   55;
-	5AB  :   73;
-	5AC  :   8C;
-	5AD  :   A0;
-	5AE  :   AE;
-	5AF  :   B5;
-	5B0  :   11;
-	5B1  :   35;
-	5B2  :   56;
-	5B3  :   74;
-	5B4  :   8D;
-	5B5  :   A1;
-	5B6  :   AF;
-	5B7  :   B6;
-	5B8  :   12;
-	5B9  :   35;
-	5BA  :   56;
-	5BB  :   74;
-	5BC  :   8E;
-	5BD  :   A2;
-	5BE  :   AF;
-	5BF  :   B7;
-	5C0  :   12;
-	5C1  :   35;
-	5C2  :   57;
-	5C3  :   75;
-	5C4  :   8E;
-	5C5  :   A3;
-	5C6  :   B0;
-	5C7  :   B8;
-	5C8  :   12;
-	5C9  :   35;
-	5CA  :   57;
-	5CB  :   75;
-	5CC  :   8F;
-	5CD  :   A3;
-	5CE  :   B1;
-	5CF  :   B9;
-	5D0  :   12;
-	5D1  :   36;
-	5D2  :   58;
-	5D3  :   76;
-	5D4  :   90;
-	5D5  :   A4;
-	5D6  :   B2;
-	5D7  :   BA;
-	5D8  :   12;
-	5D9  :   36;
-	5DA  :   58;
-	5DB  :   77;
-	5DC  :   91;
-	5DD  :   A5;
-	5DE  :   B3;
-	5DF  :   BB;
-	5E0  :   12;
-	5E1  :   36;
-	5E2  :   59;
-	5E3  :   77;
-	5E4  :   92;
-	5E5  :   A6;
-	5E6  :   B4;
-	5E7  :   BC;
-	5E8  :   12;
-	5E9  :   37;
-	5EA  :   59;
-	5EB  :   78;
-	5EC  :   92;
-	5ED  :   A7;
-	5EE  :   B5;
-	5EF  :   BD;
-	5F0  :   12;
-	5F1  :   37;
-	5F2  :   59;
-	5F3  :   79;
-	5F4  :   93;
-	5F5  :   A8;
-	5F6  :   B6;
-	5F7  :   BE;
-	5F8  :   12;
-	5F9  :   37;
-	5FA  :   5A;
-	5FB  :   79;
-	5FC  :   94;
-	5FD  :   A9;
-	5FE  :   B7;
-	5FF  :   BF;
-	600  :   12;
-	601  :   38;
-	602  :   5A;
-	603  :   7A;
-	604  :   95;
-	605  :   AA;
-	606  :   B8;
-	607  :   C0;
-	608  :   13;
-	609  :   38;
-	60A  :   5B;
-	60B  :   7B;
-	60C  :   95;
-	60D  :   AB;
-	60E  :   B9;
-	60F  :   C1;
-	610  :   13;
-	611  :   38;
-	612  :   5B;
-	613  :   7B;
-	614  :   96;
-	615  :   AB;
-	616  :   BA;
-	617  :   C2;
-	618  :   13;
-	619  :   38;
-	61A  :   5C;
-	61B  :   7C;
-	61C  :   97;
-	61D  :   AC;
-	61E  :   BB;
-	61F  :   C3;
-	620  :   13;
-	621  :   39;
-	622  :   5C;
-	623  :   7C;
-	624  :   98;
-	625  :   AD;
-	626  :   BC;
-	627  :   C4;
-	628  :   13;
-	629  :   39;
-	62A  :   5D;
-	62B  :   7D;
-	62C  :   99;
-	62D  :   AE;
-	62E  :   BD;
-	62F  :   C5;
-	630  :   13;
-	631  :   39;
-	632  :   5D;
-	633  :   7E;
-	634  :   99;
-	635  :   AF;
-	636  :   BE;
-	637  :   C6;
-	638  :   13;
-	639  :   3A;
-	63A  :   5E;
-	63B  :   7E;
-	63C  :   9A;
-	63D  :   B0;
-	63E  :   BF;
-	63F  :   C7;
-	640  :   13;
-	641  :   3A;
-	642  :   5E;
-	643  :   7F;
-	644  :   9B;
-	645  :   B1;
-	646  :   C0;
-	647  :   C8;
-	648  :   13;
-	649  :   3A;
-	64A  :   5F;
-	64B  :   80;
-	64C  :   9C;
-	64D  :   B2;
-	64E  :   C1;
-	64F  :   C9;
-	650  :   13;
-	651  :   3A;
-	652  :   5F;
-	653  :   80;
-	654  :   9C;
-	655  :   B3;
-	656  :   C2;
-	657  :   CA;
-	658  :   13;
-	659  :   3B;
-	65A  :   60;
-	65B  :   81;
-	65C  :   9D;
-	65D  :   B3;
-	65E  :   C3;
-	65F  :   CB;
-	660  :   14;
-	661  :   3B;
-	662  :   60;
-	663  :   82;
-	664  :   9E;
-	665  :   B4;
-	666  :   C4;
-	667  :   CC;
-	668  :   14;
-	669  :   3B;
-	66A  :   61;
-	66B  :   82;
-	66C  :   9F;
-	66D  :   B5;
-	66E  :   C5;
-	66F  :   CD;
-	670  :   14;
-	671  :   3C;
-	672  :   61;
-	673  :   83;
-	674  :   A0;
-	675  :   B6;
-	676  :   C6;
-	677  :   CE;
-	678  :   14;
-	679  :   3C;
-	67A  :   62;
-	67B  :   83;
-	67C  :   A0;
-	67D  :   B7;
-	67E  :   C7;
-	67F  :   CF;
-	680  :   14;
-	681  :   3C;
-	682  :   62;
-	683  :   84;
-	684  :   A1;
-	685  :   B8;
-	686  :   C8;
-	687  :   D0;
-	688  :   14;
-	689  :   3C;
-	68A  :   62;
-	68B  :   85;
-	68C  :   A2;
-	68D  :   B9;
-	68E  :   C8;
-	68F  :   D1;
-	690  :   14;
-	691  :   3D;
-	692  :   63;
-	693  :   85;
-	694  :   A3;
-	695  :   BA;
-	696  :   C9;
-	697  :   D2;
-	698  :   14;
-	699  :   3D;
-	69A  :   63;
-	69B  :   86;
-	69C  :   A3;
-	69D  :   BA;
-	69E  :   CA;
-	69F  :   D3;
-	6A0  :   14;
-	6A1  :   3D;
-	6A2  :   64;
-	6A3  :   87;
-	6A4  :   A4;
-	6A5  :   BB;
-	6A6  :   CB;
-	6A7  :   D4;
-	6A8  :   14;
-	6A9  :   3E;
-	6AA  :   64;
-	6AB  :   87;
-	6AC  :   A5;
-	6AD  :   BC;
-	6AE  :   CC;
-	6AF  :   D5;
-	6B0  :   15;
-	6B1  :   3E;
-	6B2  :   65;
-	6B3  :   88;
-	6B4  :   A6;
-	6B5  :   BD;
-	6B6  :   CD;
-	6B7  :   D6;
-	6B8  :   15;
-	6B9  :   3E;
-	6BA  :   65;
-	6BB  :   89;
-	6BC  :   A7;
-	6BD  :   BE;
-	6BE  :   CE;
-	6BF  :   D7;
-	6C0  :   15;
-	6C1  :   3F;
-	6C2  :   66;
-	6C3  :   89;
-	6C4  :   A7;
-	6C5  :   BF;
-	6C6  :   CF;
-	6C7  :   D8;
-	6C8  :   15;
-	6C9  :   3F;
-	6CA  :   66;
-	6CB  :   8A;
-	6CC  :   A8;
-	6CD  :   C0;
-	6CE  :   D0;
-	6CF  :   D9;
-	6D0  :   15;
-	6D1  :   3F;
-	6D2  :   67;
-	6D3  :   8A;
-	6D4  :   A9;
-	6D5  :   C1;
-	6D6  :   D1;
-	6D7  :   DA;
-	6D8  :   15;
-	6D9  :   3F;
-	6DA  :   67;
-	6DB  :   8B;
-	6DC  :   AA;
-	6DD  :   C2;
-	6DE  :   D2;
-	6DF  :   DB;
-	6E0  :   15;
-	6E1  :   40;
-	6E2  :   68;
-	6E3  :   8C;
-	6E4  :   AA;
-	6E5  :   C2;
-	6E6  :   D3;
-	6E7  :   DC;
-	6E8  :   15;
-	6E9  :   40;
-	6EA  :   68;
-	6EB  :   8C;
-	6EC  :   AB;
-	6ED  :   C3;
-	6EE  :   D4;
-	6EF  :   DD;
-	6F0  :   15;
-	6F1  :   40;
-	6F2  :   69;
-	6F3  :   8D;
-	6F4  :   AC;
-	6F5  :   C4;
-	6F6  :   D5;
-	6F7  :   DE;
-	6F8  :   15;
-	6F9  :   41;
-	6FA  :   69;
-	6FB  :   8E;
-	6FC  :   AD;
-	6FD  :   C5;
-	6FE  :   D6;
-	6FF  :   DF;
-	700  :   16;
-	701  :   41;
-	702  :   6A;
-	703  :   8E;
-	704  :   AD;
-	705  :   C6;
-	706  :   D7;
-	707  :   E0;
-	708  :   16;
-	709  :   41;
-	70A  :   6A;
-	70B  :   8F;
-	70C  :   AE;
-	70D  :   C7;
-	70E  :   D8;
-	70F  :   E1;
-	710  :   16;
-	711  :   41;
-	712  :   6B;
-	713  :   90;
-	714  :   AF;
-	715  :   C8;
-	716  :   D9;
-	717  :   E2;
-	718  :   16;
-	719  :   42;
-	71A  :   6B;
-	71B  :   90;
-	71C  :   B0;
-	71D  :   C9;
-	71E  :   DA;
-	71F  :   E3;
-	720  :   16;
-	721  :   42;
-	722  :   6B;
-	723  :   91;
-	724  :   B1;
-	725  :   CA;
-	726  :   DB;
-	727  :   E4;
-	728  :   16;
-	729  :   42;
-	72A  :   6C;
-	72B  :   91;
-	72C  :   B1;
-	72D  :   CA;
-	72E  :   DC;
-	72F  :   E5;
-	730  :   16;
-	731  :   43;
-	732  :   6C;
-	733  :   92;
-	734  :   B2;
-	735  :   CB;
-	736  :   DD;
-	737  :   E6;
-	738  :   16;
-	739  :   43;
-	73A  :   6D;
-	73B  :   93;
-	73C  :   B3;
-	73D  :   CC;
-	73E  :   DE;
-	73F  :   E7;
-	740  :   16;
-	741  :   43;
-	742  :   6D;
-	743  :   93;
-	744  :   B4;
-	745  :   CD;
-	746  :   DF;
-	747  :   E8;
-	748  :   16;
-	749  :   43;
-	74A  :   6E;
-	74B  :   94;
-	74C  :   B4;
-	74D  :   CE;
-	74E  :   E0;
-	74F  :   E9;
-	750  :   17;
-	751  :   44;
-	752  :   6E;
-	753  :   95;
-	754  :   B5;
-	755  :   CF;
-	756  :   E1;
-	757  :   EA;
-	758  :   17;
-	759  :   44;
-	75A  :   6F;
-	75B  :   95;
-	75C  :   B6;
-	75D  :   D0;
-	75E  :   E1;
-	75F  :   EB;
-	760  :   17;
-	761  :   44;
-	762  :   6F;
-	763  :   96;
-	764  :   B7;
-	765  :   D1;
-	766  :   E2;
-	767  :   EC;
-	768  :   17;
-	769  :   45;
-	76A  :   70;
-	76B  :   97;
-	76C  :   B8;
-	76D  :   D2;
-	76E  :   E3;
-	76F  :   ED;
-	770  :   17;
-	771  :   45;
-	772  :   70;
-	773  :   97;
-	774  :   B8;
-	775  :   D2;
-	776  :   E4;
-	777  :   EE;
-	778  :   17;
-	779  :   45;
-	77A  :   71;
-	77B  :   98;
-	77C  :   B9;
-	77D  :   D3;
-	77E  :   E5;
-	77F  :   EF;
-	780  :   17;
-	781  :   46;
-	782  :   71;
-	783  :   98;
-	784  :   BA;
-	785  :   D4;
-	786  :   E6;
-	787  :   F0;
-	788  :   17;
-	789  :   46;
-	78A  :   72;
-	78B  :   99;
-	78C  :   BB;
-	78D  :   D5;
-	78E  :   E7;
-	78F  :   F1;
-	790  :   17;
-	791  :   46;
-	792  :   72;
-	793  :   9A;
-	794  :   BB;
-	795  :   D6;
-	796  :   E8;
-	797  :   F2;
-	798  :   17;
-	799  :   46;
-	79A  :   73;
-	79B  :   9A;
-	79C  :   BC;
-	79D  :   D7;
-	79E  :   E9;
-	79F  :   F3;
-	7A0  :   18;
-	7A1  :   47;
-	7A2  :   73;
-	7A3  :   9B;
-	7A4  :   BD;
-	7A5  :   D8;
-	7A6  :   EA;
-	7A7  :   F4;
-	7A8  :   18;
-	7A9  :   47;
-	7AA  :   74;
-	7AB  :   9C;
-	7AC  :   BE;
-	7AD  :   D9;
-	7AE  :   EB;
-	7AF  :   F5;
-	7B0  :   18;
-	7B1  :   47;
-	7B2  :   74;
-	7B3  :   9C;
-	7B4  :   BF;
-	7B5  :   DA;
-	7B6  :   EC;
-	7B7  :   F6;
-	7B8  :   18;
-	7B9  :   48;
-	7BA  :   74;
-	7BB  :   9D;
-	7BC  :   BF;
-	7BD  :   DA;
-	7BE  :   ED;
-	7BF  :   F7;
-	7C0  :   18;
-	7C1  :   48;
-	7C2  :   75;
-	7C3  :   9E;
-	7C4  :   C0;
-	7C5  :   DB;
-	7C6  :   EE;
-	7C7  :   F8;
-	7C8  :   18;
-	7C9  :   48;
-	7CA  :   75;
-	7CB  :   9E;
-	7CC  :   C1;
-	7CD  :   DC;
-	7CE  :   EF;
-	7CF  :   F9;
-	7D0  :   18;
-	7D1  :   48;
-	7D2  :   76;
-	7D3  :   9F;
-	7D4  :   C2;
-	7D5  :   DD;
-	7D6  :   F0;
-	7D7  :   FA;
-	7D8  :   18;
-	7D9  :   49;
-	7DA  :   76;
-	7DB  :   A0;
-	7DC  :   C2;
-	7DD  :   DE;
-	7DE  :   F1;
-	7DF  :   FB;
-	7E0  :   18;
-	7E1  :   49;
-	7E2  :   77;
-	7E3  :   A0;
-	7E4  :   C3;
-	7E5  :   DF;
-	7E6  :   F2;
-	7E7  :   FC;
-	7E8  :   18;
-	7E9  :   49;
-	7EA  :   77;
-	7EB  :   A1;
-	7EC  :   C4;
-	7ED  :   E0;
-	7EE  :   F3;
-	7EF  :   FD;
-	7F0  :   19;
-	7F1  :   4A;
-	7F2  :   78;
-	7F3  :   A1;
-	7F4  :   C5;
-	7F5  :   E1;
-	7F6  :   F4;
-	7F7  :   FE;
-	7F8  :   19;
-	7F9  :   4A;
-	7FA  :   78;
-	7FB  :   A2;
-	7FC  :   C6;
-	7FD  :   E1;
-	7FE  :   F5;
-	7FF  :   FF;
-END;
Index: mcctv/usb/rom_com2.qip
===================================================================
--- mcctv/usb/rom_com2.qip	(revision 281)
+++ mcctv/usb/rom_com2.qip	(nonexistent)
@@ -1,4 +0,0 @@
-set_global_assignment -name IP_TOOL_NAME "ROM: 1-PORT"
-set_global_assignment -name IP_TOOL_VERSION "10.0"
-set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "rom_com2.vhd"]
-set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "rom_com2.cmp"]
Index: mcctv/usb/usb_driver1.vhd
===================================================================
--- mcctv/usb/usb_driver1.vhd	(revision 281)
+++ mcctv/usb/usb_driver1.vhd	(nonexistent)
@@ -1,1576 +0,0 @@
-
---===============================================================================
----USB_DRVR Entity (Drives and Reads D+ and D- lines to send and receive packets)
---===============================================================================
--- USB Driver - Copywrite Hakim Haddadi arcade retro gaming.
---------------------------------------------------
---==============================================================================
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-USE IEEE.STD_LOGIC_ARITH.ALL;
-USE IEEE.STD_LOGIC_UNSIGNED.ALL;
-use WORK.USBF_Declares.all;
-
---------------------------------------------------
-entity USB_DRVR1 is
-  port(                                 
-    clk_usb       : in    std_logic;    -- 5MHz clock
-	 pll_lock		: in    std_logic;
-    reset         : in    std_logic;    -- fpga reset
-    dminus        : inout std_logic;    -- USB differential D+ line
-    dplus         : inout std_logic;    -- USB differential D+ line
-	 joyright_out 	: out   std_logic_vector(7 downto 0);
-	 joyleft_out 	: out   std_logic_vector(7 downto 0);
-	 mousex_out		: out   std_logic_vector(11 downto 0);
-	 mousey_out		: out   std_logic_vector(11 downto 0)
-    );
-end USB_DRVR1;
----------------------------------------------------
-
-architecture arch of USB_DRVR1 is
-------------------------
-
-component sub_pll IS
-	PORT
-	(
-		areset		: IN STD_LOGIC  := '0';
-		inclk0		: IN STD_LOGIC  := '0';
-		c0				: OUT STD_LOGIC ;
-		locked		: OUT STD_LOGIC 
-	);
-END component sub_pll;
-
-component rom_com1 IS
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock			: IN STD_LOGIC  := '1';
-		rden			: IN STD_LOGIC  := '1';
-		q				: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-END component rom_com1;
- 
-  signal dp_last, dp_prev, dp1_last,dm1_last    : std_logic;
-  signal nb_bits                 : std_logic_vector(3 downto 0);  --bit counter for receive bits
-  signal stuffin1        			: integer range 0 to 7;  --counters for stuff-bits out and in
-  signal usb_lock				 		: std_logic := '0';
-  --signal clk_usb						: std_logic;
-  signal reg_10bits					: std_logic_vector(9 downto 0);
-  signal reg_10bits_receive		: std_logic_vector(9 downto 0);
-  signal dp2_prev						: std_logic;
-  signal CLOCK12MHz					: std_logic;
-  signal CLOCK12MHz_receive		: std_logic;
-  signal token_pid2					: std_logic_vector(3 downto 0);
-  signal data_pkt1					: std_logic_vector(7 downto 0);
-  signal data_temp					: std_logic_vector(7 downto 0);
-  signal data_rom						: std_logic_vector(7 downto 0);
-  -- ROM signals
-  signal address_rom					: std_logic_vector(8 downto 0);
-  signal rom_out						: std_logic_vector(7 downto 0);
-  signal rden_sig						: std_logic;
-  
-  signal data_tosend					: std_logic_vector(7 downto 0);
-  signal nb_byte_tosend				: std_logic_vector(7 downto 0);
-  signal address_start				: std_logic_vector(8 downto 0);
-  signal dm_previous					: std_logic;
-  signal dp_previous					: std_logic;
-  signal dplus_buf1					: std_logic;
-  signal dplus_buf2					: std_logic;
-  signal dminus_buf1					: std_logic;
-  signal dminus_buf2					: std_logic;
-  signal start_sendcom				: std_logic;
-  signal send_frame					: std_logic;
-  signal usb_reset					: std_logic;
-  signal synch							: std_logic;
-  signal read_byte_valid			: std_logic;
-  signal read_byte_valid_c			: std_logic;
-  signal data_available				: std_logic;
-  signal data_valid					: std_logic; 
-  signal data_valid_temp			: std_logic;
-  signal gamepad_basic				: std_logic;  
-  signal detach_ack					: std_logic;
-  signal detach						: std_logic;
-  signal joystick_type						: std_logic;
-  signal joystick_updown						: std_logic;
-  signal set_command						: std_logic_vector(1 downto 0);
-  signal counter1						: std_logic_vector(7 downto 0);
-  signal counterdetach					: std_logic_vector(3 downto 0);
-  signal counter2							: std_logic_vector(3 downto 0); 
-  signal counter30ms						: std_logic_vector(18 downto 0);
-  signal counter1_3ms					: std_logic_vector(14 downto 0);
-  signal joyright_temp					: std_logic_vector(7 downto 0);  
-  signal joyleft_temp					: std_logic_vector(7 downto 0);
-  signal data_byte2						: std_logic_vector(7 downto 0);
-  
-  signal nb_reset							: std_logic_vector(7 downto 0);
-  signal val								: std_logic;
-  signal mouse_valid						: std_logic;	
-  signal mouse_counter1					: std_logic_vector(8 downto 0);  
-  
-  signal mousex_temp						: std_logic_vector(7 downto 0);  
-  signal mousey_temp						: std_logic_vector(7 downto 0);
-  signal mousex_ctr						: std_logic_vector(11 downto 0);  
-  signal mousey_ctr						: std_logic_vector(11 downto 0); 
- 
-  type usb1_sm_type is (                 -- receive state machine
-    state1, state2, state3,              --,
-    state4);
-	 
-  type usb_com_type is (                 	--send state machine #1 to read D+/D- lines
-    Idle, 
-	 send1, send2,send3, reset_start,             			--
-	 send4, send5,send6, reset_released,            			--
-	 send_bit0, send_bit1,send_bit2,             			--
-	 send_bit3, send_bit4,send_bit5,             		--
-	 send_bit6, send_bit7,send15,             		--
-	 end_send1, end_send2, send_complete             		--
- );
-
-  type usb_manage_type is (                 	--Tranceiver state machine #1 to read D+/D- lines
-    Idle, 
-	 usb_manage1, usb_manage2,             			-- 
-	 usb_reset_state, crc_complete, usb_waitdetachrelease, wait_for_deviceconnect,
-	 usb_wait30ms, end_set_address, end_set_configuration, end_set_idle,
-	 read_pktin2, read_pktin3, read_pktin4, wait_pktin4,
-	 setaddress_sendpkt1, setaddress_sendpkt1_end,
-	 setaddress_sendpkt2, setaddress_sendpkt2_end,
-	 setaddress_sendpkt3, setaddress_sendpkt3_end,	 
-	 send_ack, send_ack_start, send_ack_end,
-	 getreport_sendpkt1, getreport_sendpkt1_start, getreport_sendpkt1_end,
-	 wait_pktin1, wait_pktin2, wait_pktin3,
-	 wait_report_start, start_get_report,
-	 send_getreport_ack, send_getreport_ack_start, send_getreport_ack_end,
-	 start_get_data, 
-	 wait_read_byte2, wait_read_byte3, wait_read_byte4, wait_read_byte5, wait_read_byte6,
-	 wait_read_byte7, wait_read_byte8, wait_read_byte9, wait_read_byte10, wait_read_byte11,
-	 read_byte1, read_byte2, read_byte3, read_byte4, read_byte5, read_byte6,
-	 read_byte7, read_byte8, read_byte9, read_byte10, read_byte11,
-	 wait1, wait2, wait4, wait6,  
-	 wait20, wait21, wait30, wait40, 
-	 wait_ack2,
-	 usb_reset_1ms_start, usb_reset_1ms_wait1, usb_reset_1ms_wait2, usb_reset_1ms_release
- ); 
- 
- type usb_detach_type is (                 	--Tranceiver state machine #1 to read D+/D- lines
-    Idle, 
-	 detach_start, detach_wait,detach_valid             			--            		--
- );
- 
- type mouse_state_type is (                 	--Tranceiver state machine #1 to read D+/D- lines
-    Idle, 
-	 state1             			--            		--
- );
-	 
-  signal                                usb_detach             : usb_detach_type;
-  signal                                usb1_state             : usb1_sm_type;
-  signal                                usb_send_com    			: usb_com_type;
-  signal                                usb_manage    			: usb_manage_type;
-  signal                                mouse_state    			: mouse_state_type; 
-  ------------------------------------------------------------
-
-  ATTRIBUTE keep : boolean;
-  ATTRIBUTE keep OF dminus  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF dplus  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF clk_usb  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF CLOCK12MHz  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF rom_out  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF joyright_out  : SIGNAL IS TRUE;  
-  ATTRIBUTE keep OF joyleft_out  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF joyright_temp  : SIGNAL IS TRUE;  
-  ATTRIBUTE keep OF joyleft_temp  : SIGNAL IS TRUE;
- 
-begin
-
-----------------------------------
--- instantiate the rom commands --
-----------------------------------
-rom_com_inst : rom_com1 
-PORT MAP (
-			address	 	=> address_rom,
-			clock	 		=> clk_usb,
-			rden	 		=> rden_sig AND CLOCK12MHz,
-			q	 			=> rom_out
-			);
-		
-   usb_lock <= pll_lock;
-  
------------------------------
--- update of joystick data	--
------------------------------
-  PROCESS
-  (
-    usb_lock, 		-- External asynchronous reset
-    clk_usb    	-- 15 MHz clock (usb over sampling)
-
-  )
-  BEGIN
-    -- 
-   IF (usb_lock = '0') THEN
-		joyright_out 			<= "11111111";
-		joyleft_out 			<= "11111111";
-   ELSIF (rising_edge(clk_usb)) THEN
-		IF (data_available = '1') THEN
-			IF (data_valid = '1') THEN
-				-- bit 0 : 2
-				-- bit 1 : 4
-				-- bit 2 : 3
-				-- bit 3 : 1
-				-- bit 4 : fire button / start
-				-- bit 5 : fire button / start
-				-- bit 6 : button front right "2"  
-				-- bit 7 : button front right "1"
-				joyright_out <= joyright_temp;
-				-- bit 0 : right
-				-- bit 1 : left
-				-- bit 2 : down
-				-- bit 3 : up
-				-- bit 4 : fire button / select
-				-- bit 5 : fire button / select
-				-- bit 6 : button front left "2"  
-				-- bit 7 : button front left "1"							
-				joyleft_out <= joyleft_temp;
-			ELSE
-				-- bit 0 : 2
-				-- bit 1 : 4
-				-- bit 2 : 3
-				-- bit 3 : 1
-				-- bit 4 : fire button / start
-				-- bit 5 : fire button / start
-				-- bit 6 : button front right "2"  
-				-- bit 7 : button front right "1"
-				joyright_out <= joyright_temp;
-				-- bit 0 : Not active
-				-- bit 1 : Not active
-				-- bit 2 : Not active
-				-- bit 3 : Not active
-				-- bit 4 : fire button / select
-				-- bit 5 : fire button / select
-				-- bit 6 : button front left "2"  
-				-- bit 7 : button front left "1"							
-				joyleft_out(7 downto 4) <= joyleft_temp(7 downto 4);	
-				joyleft_out(3 downto 0) <= "1111";
-			END IF;
-      END IF;
-   END IF;			
-  END PROCESS;
-	
- ----------------------------------------------
- --  usb clock enable generation for sending --
- ----------------------------------------------
-  PROCESS
-  (
-    usb_lock, -- reset_process, 	-- External asynchronous reset
-    clk_usb    		-- over sampling clk 15MHz
-  )
-  BEGIN
-    -- 
-   IF (usb_lock = '0') THEN
-		reg_10bits <= "0000000001";
-   ELSIF (rising_edge(clk_usb)) THEN
-		reg_10bits 		<= reg_10bits(8 downto 0) & reg_10bits(9); -- 
-   END IF;			
-  END PROCESS;
-  
- -- update clock enable USB
- CLOCK12MHz 		<= reg_10bits(4);
- 
- ------------------------------------------------
- --  usb clock enable generation for receiving --
- ------------------------------------------------
- -- process generating a 15 MHz clk enable signal in phase with the incoming data from the device
- -- the process is using an oversampling clk of 15 MHz
-  PROCESS
-  (
-    usb_lock, --reset_process, 		-- External asynchronous reset
-    clk_usb    -- over sampling clk 48MHz
-  )
-  BEGIN
-    -- 
-   IF (usb_lock = '0') THEN
-		reg_10bits_receive 	<= "0000000001";
-		dp2_prev     		 	<= dplus_buf2;
-   ELSIF (rising_edge(clk_usb)) THEN
-		dp2_prev     			<= dplus_buf2;           -- sample the input D+ line
-		IF (dp2_prev /= dplus_buf2) THEN
-			reg_10bits_receive <= "0000000001";				-- reset the phase of the USB clk
-		ELSE
-			reg_10bits_receive 				<= reg_10bits_receive(8 downto 0) & reg_10bits_receive(9); -- 
-      END IF;
-   END IF;			
-  END PROCESS;
-  
-  -- update clock USB
- CLOCK12MHz_receive 		<= reg_10bits_receive(4); 
-  
-  --------------------------------------------------------------------------------------
-  ---------------------  buffering of Dplus - Dminus to avoid metastability ------------
-  --------------------------------------------------------------------------------------
-  process (clk_usb, usb_lock) is
-  begin
-    if usb_lock = '0' then
-		dplus_buf1      	<= '0';
-		dplus_buf2      	<= '0';
-		dminus_buf1      	<= '0';
-		dminus_buf2      	<= '0';
-    elsif rising_edge(clk_usb) then     	--
-		dplus_buf1     	<= dplus;  
-		dplus_buf2     	<= dplus_buf1;
-		dminus_buf1      	<= dminus;
-		dminus_buf2      	<= dminus_buf1;
-    end if;
-  end process;
-  
-  ---------------------------------------------------------------------
-  ------------------  state machine for acquiring usb data
-  ---------------------------------------------------------------------
-  process (reset, clk_usb, CLOCK12MHz_receive) is
-  begin
-    if (reset = '0') then    
-		dp1_last				<= dplus_buf2;
-		dm1_last				<= dminus_buf2;
-      data_pkt1			<= "00000000";
-      data_temp   		<= "00000000";
-		read_byte_valid	<= '0';
-		usb1_state       	<= state1;   
-		nb_bits				<= "0000";
-		stuffin1          <= 0;
-		synch       		<= '0';
-    elsif (rising_edge(clk_usb) AND CLOCK12MHz_receive = '1') then     
-      case usb1_state is
-        -------------- state1 ----------------
-			when state1		=>   
-				read_byte_valid	<= '1';
-				data_pkt1   <= "00000000";
-				data_temp   <= "00000000";
-				if dplus_buf2 = '0' and dminus_buf2 = '0' then
-					usb1_state	<= state1;				-- reset state
-				elsif dplus_buf2 = '1' and dminus_buf2 = '0' then
-					dp1_last		<= dplus_buf2;
-					dm1_last		<= dminus_buf2;
-					usb1_state	<= state2;				-- go to state2 and wait for synch
-				end if;
-				nb_bits				<= "0000"; 
-		  -------------- state2 ----------------
-        when state2     =>
-				dp1_last		<= dplus_buf2;
-				dm1_last		<= dminus_buf2;
-				if dp1_last /= dplus_buf2 and dm1_last /= dminus_buf2 then               
-					nb_bits     	<= nb_bits + 1;			-- start of synch
-				elsif dplus_buf2 = '0' and dminus_buf2 = '0' then  
-					usb1_state	<= state1;				-- reset state
-					nb_bits		<= "0000";
-				end if;
-  
-          if nb_bits = "0110" then               
-				usb1_state	<= state3;				-- go to state 3 and wait for final synch
-          end if; 
-		  -------------- state3 ----------------
-        when state3     =>
-				dp1_last		<= dplus_buf2;
-				dm1_last		<= dminus_buf2;
-          if dplus_buf2 = '0' and dminus_buf2 = '1' then               
-            nb_bits     <= nb_bits + 1;			-- start of synch
-          elsif dplus_buf2 = '0' and dminus_buf2 = '0' then  
-            usb1_state	<= state1;				-- reset state
-				data_pkt1   <= "00000000";
-				data_temp   <= "00000000";
-				nb_bits		<= "0000";
-          end if;
-
-			 if nb_bits = "0111" then               
-				usb1_state	<= state4;				-- synch byte complete start aquiring packets
-				data_pkt1   <= "10000000";
-				data_temp	<= "10000000";
-				read_byte_valid	<= Not read_byte_valid;
-				nb_bits		<= "0000";
-				synch       <= '1';
-          end if; 
-		  -------------- state4 ----------------
-        when state4     =>
-		if detach = '1' then
-			usb1_state   	<= state1;
-		else
-          if dplus_buf2 = '0' and dminus_buf2 = '0' then  
-            usb1_state	<= state1;				-- reset state
-				data_pkt1   <= data_temp;
-				data_temp   <= "00000000";
-				nb_bits		<= "0000";
-			 else
-				dp1_last        <= dplus_buf2;
-				
-				if (stuffin1 = 6 and nb_bits = "0000") then
-					stuffin1           <= 0;
-					val					 <= '1';	
-				elsif stuffin1 = 6 then           				--	after 6 '1's in a row = This is a stuff bit.
-					stuffin1           <= 0;     				--	ignore it and reset the stuff count.
-					val					 <= '0';
-				else                          				--	no stuff bit, get the real bit based on D+/D- lines. 
-					val					 <= '0';
-					nb_bits         <= nb_bits + 1;  	--	Count the real bits. Current 'bitin' is always coming in.
-					if dp1_last = dplus_buf2 then     				--	NRZI test. no change -> 1
-						stuffin1           <= stuffin1 + 1;  	--	count the consecutive 1's
-						if(nb_bits = "0000") then
-							data_temp(0) <= '1';
-						elsif(nb_bits = "0001") then
-							data_temp(1) <= '1';
-						elsif(nb_bits = "0010") then
-							data_temp(2) <= '1';
-						elsif(nb_bits = "0011") then
-							data_temp(3) <= '1';
-						elsif(nb_bits = "0100") then
-							data_temp(4) <= '1';
-						elsif(nb_bits = "0101") then
-							data_temp(5) <= '1';
-						elsif(nb_bits = "0110") then
-							data_temp(6) <= '1';
-						else
-							data_temp(7) <= '1';
-						end if;
-					else
-						if(nb_bits = "0000") then
-							data_temp(0) <= '0';
-						elsif(nb_bits = "0001") then
-							data_temp(1) <= '0';
-						elsif(nb_bits = "0010") then
-							data_temp(2) <= '0';
-						elsif(nb_bits = "0011") then
-							data_temp(3) <= '0';
-						elsif(nb_bits = "0100") then
-							data_temp(4) <= '0';
-						elsif(nb_bits = "0101") then
-							data_temp(5) <= '0';
-						elsif(nb_bits = "0110") then
-							data_temp(6) <= '0';
-						else
-							data_temp(7) <= '0';
-						end if;
-						stuffin1         	<= 0;     --reset the stuff-bit count when a 0
-					end if;
-				end if;
-			end if;
-			
-			if (nb_bits = "0111") AND (stuffin1 /= 6) then  
-				usb1_state	<= state4;
-				nb_bits		<= "0000"; 
-         end if; 
-			
-			if nb_bits = "0000" AND synch = '1' then  
-				synch       <= '0';
-			elsif nb_bits = "0000" AND val = '1' then
-				data_pkt1   <= data_temp;
-			elsif nb_bits = "0000" then
-				data_pkt1   <= data_temp;			
-				read_byte_valid	<= Not read_byte_valid;
-         end if; 
-		end if;
-		when others  => 
-			 usb1_state <= state1;
-			 nb_bits		<= "0000";
-	   end case;
-    end if;
-  end process; 		 
-  
-  ------------------------------------------------------
-  ------  state machine for sending usb data
-  ------------------------------------------------------
-  process (usb_lock, clk_usb, CLOCK12MHz) is
-  begin
-    if (usb_lock = '0') then                                 
-      data_tosend			<= "00000000";
-		nb_byte_tosend		<= "00000000";
-		dp_previous			<= '1';
-		dm_previous			<= '0';
-		dplus					<= '1';
-		dminus				<= '0';
-		usb_send_com		<= idle;
-    elsif (rising_edge(clk_usb) AND CLOCK12MHz = '1') then     
-      case usb_send_com is
-        -------------- wait for the reset start trigger ----------------
-			when idle		=>   
-				data_tosend   <= "00000000";
-				send_frame		<= '0';
-				if (usb_reset = '1') then				-- the start of sending data is initiated by the usb manage state machine
-					usb_send_com	<= reset_start;	-- reset start state
-					dplus			<= '0';
-					dminus		<= '0';
-				else 
-					usb_send_com	<= idle;					-- go to idle state
-				end if;
-        -------------- wait for the start trigger ----------------
-			when reset_start		=>   
-				if (usb_reset = '0') then					-- The reset is released
-					usb_send_com	<= reset_released;	-- end of reset state
-					dplus				<= 'Z';
-					dminus			<= 'Z';
-				else 
-					usb_send_com	<= reset_start;			
-				end if;				
-        -------------- wait for the start trigger ----------------
-			when reset_released		=>   
-				data_tosend   <= "00000000";
-				send_frame		<= '0';
-				if (usb_reset = '1') then
-					dplus				<= '0';
-					dminus			<= '0';
-					usb_send_com	<= reset_start;
-				elsif (start_sendcom = '1') then				-- the start of sending data is initiated by the usb manage state machine
-					usb_send_com	<= send1;				-- next state
-					rden_sig			<= '1';					
-					address_rom		<= address_start;		-- inialise the address_com with the address set by the usb state machine
-				else 
-					dplus				<= 'Z';
-					dminus			<= 'Z';
-					usb_send_com	<= reset_released;	-- wait for send com trigger
-				end if;
-		  -------------- prepare for the next read ----------------
-        when send1     =>              
-				address_rom			<= address_rom + "000000001";	-- prepare for the next read
-				rden_sig				<= '1';					-- read the first byte
-				usb_send_com		<= send2;		  
-		  -------------- read the rom first byte ----------------
-        when send2     =>  
-				nb_byte_tosend		<= rom_out;				-- read the first byte
-				usb_send_com		<= send3;
-		  -------------- read the next bytes to send ----------------
-        when send3     =>    
-				data_tosend			<= rom_out;				-- read the next byte
-				rden_sig				<= '0';
-				usb_send_com		<= send_bit0;
-		  -------------- send_bit0 ----------------
-        when send_bit0 =>
-		  	 nb_byte_tosend   <= nb_byte_tosend - "00000001";
-			 rden_sig			<= '0';					-- disable the rom read
-          if data_tosend(0) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit1;
-		  -------------- send_bit1 ----------------			 
-		  when send_bit1 =>
-          if data_tosend(1) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-				else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit2;
-		  -------------- send_bit2 ----------------
-        when send_bit2 =>
-          if data_tosend(2) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit3;
-		  -------------- send_bit3 ----------------			 
-		  when send_bit3 =>
-          if data_tosend(3) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit4;
-		  -------------- send_bit4 ----------------
-        when send_bit4 =>
-          if data_tosend(4) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit5;
-		  -------------- send_bit5 ----------------			 
-		  when send_bit5 =>
-          if data_tosend(5) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 address_rom	<= address_rom + "000000001";	-- prepare for the next read
-			 rden_sig		<= '1';								
-			 usb_send_com	<= send_bit6;
-		  -------------- send_bit6 ----------------
-        when send_bit6 =>
-          if data_tosend(6) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 rden_sig		<= '0';
-			 usb_send_com	<= send_bit7;
-		  -------------- send_bit7 ----------------			 
-		  when send_bit7 =>
-          if data_tosend(7) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 data_tosend 	<= rom_out;
-			 rden_sig		<= '0';								
-			 if nb_byte_tosend = "00000000" then
-				usb_send_com	<= end_send1;
-			 else
-				usb_send_com	<= send_bit0; -- send next byte
-			 end if;
-		  -------------- send_end of frame ----------------			 
-		  when end_send1 =>              
-			 dplus		<= '0';
-			 dminus		<= '0';
-			 usb_send_com	<= end_send2; 
-		  -------------- send_end of frame ----------------			 
-		  when end_send2 =>              
-			 dplus			<= '0';
-			 dminus			<= '0';
-			 usb_send_com	<= send_complete; 
-		  -------------- send_complete ----------------			 
-		  when send_complete =>              
-			 send_frame		<= '1';
-			 dplus			<= 'Z';
-			 dminus			<= 'Z';
-			 dp_previous	<= '1';
-			 dm_previous	<= '0';
-			 usb_send_com	<= reset_released; 	
-		  when others  => 
-			 usb_send_com <= idle;		 
-	   end case;
-    end if;
-  end process; 		 
-  
-  
-  --------------------------------------------------------------------------
-  ------  state machine for managing sending and receiving usb data
-  --------------------------------------------------------------------------
-  process (usb_lock, clk_usb) is
-  begin
-    if (usb_lock = '0') then 
-		joystick_type 		<= '0';
-		usb_reset			<= '0';
-		data_available		<= '0';
-		data_valid			<= '0';
-		data_valid_temp	<= '0';
-      start_sendcom		<= '0';
-		counter1				<= "11111111";
-		counter2				<= "1000";
-		counter30ms			<= "0101100110000100101";
-		counter1_3ms		<= "100000100011011";
-		detach_ack			<= '0';
-		usb_manage			<= idle;
-		
-    elsif (falling_edge(clk_usb)) then     
-      case usb_manage is
-        -------------- idle state ----------------
-			when idle		=>   
-				set_command				<= "00";
-				start_sendcom			<= '0';
-				joystick_type 			<= '0';
-				mouse_valid				<= '0';
-				if dplus = '1' then	
-					usb_manage			<= wait_for_deviceconnect;	
-				else 
-					usb_manage			<= idle;
-				end if; -- 
-		  -------------- confirm device connected ----------------
-        when wait_for_deviceconnect     =>              
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					usb_reset			<= '1';
-					usb_manage			<= usb_reset_state;	
-				else
-					usb_manage			<= wait_for_deviceconnect;
-				end if;		
-		  -------------- reset device state ----------------
-        when usb_reset_state     =>              
-				counter30ms				<= counter30ms - 1;
-				if counter30ms	 = "0000000000000000000" then
-				   counter30ms			<= "1111111111111111111";
-					counter1_3ms		<= "100000100011011";
-					counter2				<= "1011";
-					usb_reset			<= '0';
-					detach_ack			<= '1';
-					nb_reset	 			<= "00011101"; -- 29 keep alive
-					usb_manage			<= usb_reset_1ms_start;	
-				else
-					usb_manage			<= usb_reset_state;
-				end if;
-		  -------------- usb_reset_1ms_start ----------------
-        when usb_reset_1ms_start     =>              
-				counter1_3ms				<= counter1_3ms - 1;
-				if counter1_3ms	 = "0000000000000000" then
-					counter1_3ms		<= "100000100011011";
-					counter2				<= "1011";
-					counter1_3ms		<= counter1_3ms - 1;
-					detach_ack			<= '0';
-					usb_reset			<= '1';
-					usb_manage			<= usb_reset_1ms_wait1;	
-				else
-					usb_manage			<= usb_reset_1ms_start;
-				end if;			
-		  -------------- usb_reset_1ms_start ----------------
-        when usb_reset_1ms_wait1     =>  
-				usb_reset				<= '1';
-				counter2					<= counter2 - '1';
-				if counter2 = "0000" then
-					usb_reset			<= '0';
-					usb_manage			<= usb_reset_1ms_release;	
-				else
-					usb_manage			<= usb_reset_1ms_wait1;
-				end if;
-		
-		  -------------- usb_reset_1ms_start ----------------
-        when usb_reset_1ms_release     =>          
-				usb_reset				<= '0';		  
-				nb_reset					<= nb_reset - 1;
-				if nb_reset	 = "00000000" then
-					usb_manage			<= usb_manage2;	
-				else
-					counter1_3ms		<= "100000100011011";
-					counter2				<= "1011";
-					usb_manage			<= usb_reset_1ms_start;
-				end if;				
-	
-		  -------------- reset release state ----------------
-        when usb_wait30ms     =>              
-				counter1			<= counter1 - 1;
-				if counter1	= "00000000" then
-					detach_ack		<= '0';
-					counter1			<= "11111111";
-					usb_manage			<= usb_waitdetachrelease;	
-				else
-					usb_manage			<= usb_wait30ms;
-				end if;	
-		  -------------- confirm device attached ----------------
-        when usb_waitdetachrelease     =>              
-				counter2				<= counter2 - 1;
-				if counter2	= "0000" then
-					usb_manage			<= usb_manage2;	
-				else
-					usb_manage			<= usb_waitdetachrelease;
-				end if;
-		  -------------- end of reset state ----------------
-        when usb_manage2     =>  
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					start_sendcom	<= '0';
-					address_start	<= "000010010";
-					usb_manage		<= wait1;	-- start set address	
-				end if;	
-		  ------------------------------------------------
-		  -------------- SET ADDRESS 0x01 ----------------
-		  ------------------------------------------------
-		  
-		  -------------- waiting state -------------------
-        when wait1 =>
-				counter2					<= counter2 - 1;
-				if counter2	= "0000" then
-					counter2				<= "1111";
-					usb_manage			<= setaddress_sendpkt1;		  
-				else
-					usb_manage			<= wait1;
-				end if;			 
-		  -------------- send first packet "SETUP" packet ----------------
-        when setaddress_sendpkt1     =>  
-				start_sendcom			<= '1';
-				if set_command = "00" then
-					-- set address
-					address_start		<= "000010010"; -- 0x12  - 0x2D 0x00 0x10  - 3 bytes
-				elsif set_command = "01" then
-					-- set configuration
-					address_start		<= "001010000"; -- 0x50  - 0x2D 0x01 0xE8  - 3 bytes
-				else
-					-- set idle
-					address_start		<= "001110000"; -- 0x70  - 0x2D 0x01 0xE8  - 3 bytes
-				end if;
-				usb_manage				<= setaddress_sendpkt1_end; -- 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when setaddress_sendpkt1_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom	<= '0';
-						counter1			<= "01010011";
-						usb_manage		<= wait2;
-					else 
-						usb_manage		<= setaddress_sendpkt1_end;
-					end if;
-				end if;
-			---------------------  waiting state ----------------------
-			when wait2 =>
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1				<= "01010011";
-					usb_manage			<= setaddress_sendpkt2;		  
-				else
-					usb_manage			<= wait2;
-				end if;			 
-		  -------------- send the data packet for set address ---------
-        when setaddress_sendpkt2     =>  
-				start_sendcom		<= '1';
-				if set_command = "00" then
-					-- set address
-					address_start		<= "000010111"; -- 0x17  -   - 11 bytes
-				elsif set_command = "01" then
-					-- set configuration
-					address_start		<= "001010101"; -- 0x55  -   - 11 bytes
-				else
-					-- set idle
-					address_start		<= "001110101"; -- 0x75  -   - 11 bytes
-				end if;
-				usb_manage			<= setaddress_sendpkt2_end; -- 	
-		  -------------- wait for completion of sending frame ----------------			 
-		  when setaddress_sendpkt2_end =>
-			 if detach = '1' then
-					usb_manage   	<= idle;
-			 else
-				if send_frame = '1' then  
-					start_sendcom			<= '0';
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait_ack2;
-				else 
-					usb_manage				<= setaddress_sendpkt2_end;
-				end if;
-			end if;
-		  -------------- waiting ACK ----------------
-        when wait_ack2 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					counter1_3ms			<= counter1_3ms - 1;
-					if data_pkt1 = "11010010" then
-						counter1_3ms		<= "100000100011011";
-						usb_manage			<= wait4;		-- ack go top the next stage
-					elsif counter1_3ms	= "000000000000000" then
-						counter1_3ms		<= "100000100011011"; -- no ack, retry sending the command
-						usb_manage			<= setaddress_sendpkt1;
-					else
-						usb_manage			<= wait_ack2;
-					end if;
-				end if;
-		  ---------------- waiting state  ---------------------
-		  when wait4 =>
-				counter2			<= counter2 - 1;
-				if counter2	= "0000" then
-					counter2		<= "1111";
-					usb_manage			<= setaddress_sendpkt3;		  
-				else
-					usb_manage					<= wait4;
-				end if;			 
-		  -------------- prepare for sending the second packet ----------------
-        when setaddress_sendpkt3     =>  
-				start_sendcom		<= '1';
-				if set_command = "00" then
-					-- set address
-					address_start		<= "000100100"; -- 0x24  -   - 4 bytes
-				elsif set_command = "01" then
-					-- set configuration
-					address_start		<= "001100010"; -- 0x62  -   - 4 bytes
-				else
-					-- set idle
-					address_start		<= "010000010"; -- 0x82  -   - 4 bytes
-				end if;
-				usb_manage			<= setaddress_sendpkt3_end; -- 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when setaddress_sendpkt3_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom			<= '0';
-						counter1_3ms			<= "100000100011011";
-						usb_manage				<= wait_pktin1;
-					else 
-						usb_manage				<= setaddress_sendpkt3_end;
-					end if;
-				end if;
-		  -------------- waiting for 1st byte ----------------
-        when wait_pktin1 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					counter1_3ms			<= counter1_3ms - 1;
-					if data_pkt1 = "10000000" then -- 0x80 wait for synch
-						usb_manage			<= wait_pktin2;		-- ack go to the next stage
-					elsif counter1_3ms	= "000000000000000" then
-						counter1_3ms		<= "100000100011011";    -- no ack, retry sending the command
-						usb_manage			<= setaddress_sendpkt3;
-					else
-						usb_manage			<= wait_pktin1;
-					end if;
-				end if;
-		  --------------  pktin2 "0x4B"  -------------------------
-		  when wait_pktin2 =>
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					if read_byte_valid = '0' then
-						usb_manage		<= wait_pktin2;	  
-					else
-						usb_manage		<= read_pktin2;
-					end if;	
-				end if;
-		  ------------------ read_pktin2 "0x4B" ---------------------
-		  when read_pktin2 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if data_pkt1 = "01001011" then -- 0x4B
-						usb_manage			<= wait_pktin3;					-- ack go top the next stage
-					else 
-						usb_manage			<= setaddress_sendpkt3; -- no ack, retry sending the command
-					end if;
-				end if;	
-		  --------------  pktin3 "0x00"  -------------------------
-		  when wait_pktin3 =>
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					if read_byte_valid = '1'  then
-						usb_manage		<= wait_pktin3;	  
-					else
-						usb_manage		<= read_pktin3;
-					end if;	
-				end if;
-		  ------------------ read_pktin3 "0x00" ---------------------
-		  when read_pktin3 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if data_pkt1 = "00000000" then -- 0x00
-						usb_manage			<= wait_pktin4;					-- ack go top the next stage
-					else 
-						usb_manage			<= setaddress_sendpkt3; -- no ack, retry sending the command
-					end if;
-				end if;	
-		  --------------  pktin4 "0x00"  -------------------------
-		  when wait_pktin4 =>
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					if read_byte_valid = '0' then
-						usb_manage		<= wait_pktin4;	  
-					else
-						usb_manage		<= read_pktin4;
-					end if;	
-				end if;
-		  ------------------ read_pktin4 "0x00" ---------------------
-		  when read_pktin4 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if data_pkt1 = "00000000" then -- 0x00
-						counter1				<= "00001111"; 
-						usb_manage			<= wait6;					-- go to "send ack" state
-					else 
-						usb_manage			<= setaddress_sendpkt3; -- no ack, retry sending the command
-					end if;
-				end if;	
-		  --------------------   waiting state before sending ack  --------------------------
-        when wait6 =>
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1				<= "11111111";
-					usb_manage			<= send_ack;		  
-				else
-					usb_manage			<= wait6;
-				end if;	
-		  -------------- inialise ROM address for send ack ----------------
-        when send_ack     =>  
-				start_sendcom		<= '1';
-				address_start		<= "001000000"; -- 0x40  -   - 2 bytes
-				usb_manage			<= send_ack_end; -- send_ack_start;	-- 	
-		  -------------- wait for completion of sending frame ----------------			 
-		  when send_ack_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom			<= '0';
-						counter1_3ms			<= "000000000000001";
-						if set_command = "00" then
-							usb_manage				<= end_set_address;
-						elsif set_command = "01" then
-							usb_manage				<= end_set_configuration;
-						else
-							usb_manage				<= end_set_idle;
-						end if;
-					else 
-						usb_manage				<= send_ack_end;
-					end if;	
-				end if;
-		  ------------------------------  End of Set Address   -----------------------------
-		  
-        when end_set_address =>
-				counter1_3ms					<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms				<= "100000100011011";
-					set_command					<= "01"; -- set_command set to SetConfiguration
-					nb_reset	 					<= "00000000"; -- 1 keep alive
-					usb_manage					<= usb_reset_1ms_start;		  
-				else
-					usb_manage					<= end_set_address;
-				end if; 
-				
-        when end_set_configuration =>
-				counter1_3ms					<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms				<= "100000100011011";
-					set_command					<= "10"; -- set_command set to SetConfiguration
-					nb_reset	 					<= "00000000"; -- 1 keep alive
-					usb_manage					<= usb_reset_1ms_start;		  
-				else
-					usb_manage					<= end_set_configuration;
-				end if; 
-
-		  when end_set_idle =>
-				counter1_3ms					<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms				<= "100000100011011";
-					counter1						<= "00011001";
-					set_command					<= "00"; -- set_command set to Setaddress in case of a detach/attach
-					usb_manage					<= wait21; -- wait20; -- go to get report	  
-				else
-					usb_manage					<= end_set_idle;
-				end if; 
-
-
-			---------------------------------------------------------------
-			---------------------------------------------------------------
-			---------------------------------------------------------------
-			-------------- GET REPORT ----------------
-        when wait20 =>    -- wait 1.3ms * 9
-				counter1_3ms				<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait21;		  
-				else
-					usb_manage				<= wait20;
-				end if;		
-		  ---------------------   wait  -------------
-        when wait21 =>    -- 
-				counter1						<= counter1 - 1;
-				if counter1	= "00000000" then
-					data_available			<=	'0';
-					data_valid				<= '0';
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= getreport_sendpkt1;		  
-				else
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait21;
-				end if;		
-		  -------------- read the next bytes to send ----------------
-        when getreport_sendpkt1     =>  
-				start_sendcom		<= '1';
-				address_start		<= "010010000"; -- 0x90  - 0x69 0x81 0x58  - 3 bytes
-				usb_manage			<= getreport_sendpkt1_end; 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when getreport_sendpkt1_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom		<= '0';
-						counter1				<= "00000111";
-						usb_manage			<= wait30;
-					else 
-						usb_manage			<= getreport_sendpkt1_end;
-					end if;
-				end if;
-			-------------   waiting state  ------------------------
-		   when wait30 =>
-				counter1						<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1					<= "11111111";
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait_report_start;		  
-				else
-					usb_manage				<= wait30;
-				end if;			 
-		  -------------- waiting ACK ----------------
-        when wait_report_start =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					counter1_3ms			<= counter1_3ms - 1;
-					if data_pkt1 = "10000000" then  -- wait for synch
-						counter1_3ms		<= "100000100011011";
-						counter1				<= "01111000";
-						read_byte_valid_c <= read_byte_valid;
-						usb_manage			<= start_get_data;	-- ack go top the next stage
-					elsif counter1_3ms	= "000000000000000" then
-						counter1_3ms		<= "100000100011011"; 	-- no ack, retry sending the command
-						usb_manage			<= getreport_sendpkt1;
-					else
-						usb_manage			<= wait_report_start;
-					end if;
-				end if;
-		  --------------  byte1  -------------------------
-		  when start_get_data =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c then
-						usb_manage			<= start_get_data;	  
-					else
-						read_byte_valid_c <= read_byte_valid;
-						usb_manage			<= read_byte1;
-					end if;	
-				end if;
-		  ------------------ read_byte1 ---------------------
-		  when read_byte1 =>
-				if (data_pkt1 = "01001011" or data_pkt1 = "11000011") then
-					data_valid_temp 	<= '1';
-					read_byte_valid_c <= read_byte_valid;
-					usb_manage			<= wait_read_byte2;
-					counter1				<= "11111111";
-				else
-					counter1				<= "11111111";
-					usb_manage			<= wait21;
-				end if;
-		  --------------  byte2  -------------------------
-		  when wait_read_byte2 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte2;	  
-					else
-						usb_manage		<= read_byte2;
-					end if;	
-				end if;
-		  ------------------ read_byte2 ---------------------
-		  when read_byte2 =>
-				if joystick_type = '0' then
-					--joyleft_temp ( 1 downto 0) <= NOT ((NOT data_pkt1(6)) & data_pkt1(7)); -- game pad joystick
-					data_byte2  		<= data_pkt1;
-					---
-					if (data_pkt1 = "01111111" OR data_pkt1 = "11111111" OR data_pkt1 = "00000000") then
-						data_valid_temp 			<= '1';
-					else
-						data_valid_temp 			<= '0';
-					end if;
-				else 
-					-- data_valid_temp 			<= '1';
-					if (data_pkt1 = "10000000") then
-						joystick_updown 	<= '1'; -- either up or down
-					elsif (data_pkt1 = "00000000") then
-						joystick_updown 	<= '0'; -- left
-						joyright_temp(1 downto 0) 	<= "10";
-					elsif (data_pkt1 = "11111111") then
-						joystick_updown 	<= '0'; -- left
-						joyright_temp(1 downto 0) 	<= "01";					
-					end if;
-				end if;
-
-				---
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte3;		
-		  --------------  byte3  -------------------------
-		  when wait_read_byte3 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte3;	  
-					else
-						usb_manage		<= read_byte3;
-					end if;	
-				end if;
-		  ------------------ read_byte3 ---------------------
-		  when read_byte3 =>
-				if joystick_type = '1' then
-					joyright_temp(3 downto 2) 	<= NOT (data_pkt1(0) &  NOT data_pkt1(0));
-				else
-					--- not actif
-					if (data_byte2 = "01111111" AND data_pkt1 = "01111111") then 
-						joyleft_temp(3 downto 0) <= "1111";
-					--- up right
-					elsif (data_byte2 = "11111111" AND data_pkt1 = "00000000") then 
-						joyleft_temp(3 downto 0) <= "0110";		
-					--- up left
-					elsif (data_byte2 = "00000000" AND data_pkt1 = "00000000") then 
-						joyleft_temp(3 downto 0) <= "0101";
-					--- down right
-					elsif (data_byte2 = "11111111" AND data_pkt1 = "11111111") then 
-						joyleft_temp(3 downto 0) <= "1010";
-					--- down left
-					elsif (data_byte2 = "00000000" AND data_pkt1 = "11111111") then 
-						joyleft_temp(3 downto 0) <= "1001";		
-					--- up
-					elsif (data_byte2 = "01111111" AND data_pkt1 = "00000000") then 
-						joyleft_temp(3 downto 0) <= "0111";
-					--- down
-					elsif (data_byte2 = "01111111" AND data_pkt1 = "11111111") then
-						joyleft_temp(3 downto 0) <= "1011";
-					--- right
-					elsif (data_byte2 = "11111111" AND data_pkt1 = "01111111") then
-						joyleft_temp(3 downto 0) <= "1110";
-					--- left
-					elsif (data_byte2 = "00000000" AND data_pkt1 = "01111111") then
-						joyleft_temp(3 downto 0) <= "1101";
-					else
-						-- mouse detected, 
-						mousex_temp 				 <= data_byte2;
-						mousey_temp 				 <= data_pkt1;
-						joyleft_temp(3 downto 0) <= "1111";
-						mouse_valid					 <= '1';
-					end if;		
-				end if;
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte4;		
-		  --------------  byte4  -------------------------
-		  when wait_read_byte4 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte4;	  
-					else
-						usb_manage		<= read_byte4;
-					end if;
-				end if;
-		  ------------------ read_byte4 ---------------------
-		  when read_byte4 =>
-				mouse_valid				<= '0';
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte5;		
-		  --------------  byte5  -------------------------
-		  when wait_read_byte5 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte5;	  
-					else
-						usb_manage		<= read_byte5;
-					end if;	
-				end if;
-		  ------------------ read_byte11 ---------------------
-		  when read_byte5 =>
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte6;		
-		  --------------  byte6  -------------------------
-		  when wait_read_byte6 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte6;	  
-					else
-						usb_manage		<= read_byte6;
-					end if;		
-				end if;
-		  ------------------ read_byte6 ---------------------	
-		  when read_byte6 =>
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte7; -- joystick type = gamepad
-		  --------------  byte7  -------------------------
-		  when wait_read_byte7 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte7;	  
-					else
-						usb_manage		<= read_byte7;
-					end if;	
-				end if;
-		  ------------------ read_byte7 ---------------------
-		  when read_byte7 =>
-				if data_pkt1(3 downto 0) = "1111" then  -- checking if data valid
-					joyright_temp(3 downto 0) 	<= NOT (data_pkt1(4) &  data_pkt1(6) & data_pkt1(7) &  data_pkt1(5));
-				else
-					data_valid_temp	<= '0';
-				end if;
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte8;		
-		  --------------  byte8  -------------------------
-		  when wait_read_byte8 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte8;	  
-					else
-						usb_manage		<= read_byte8;
-					end if;
-				end if;
-		  ------------------ read_byte8 ---------------------
-		  when read_byte8 =>
-				joyright_temp(7 downto 4) 	<= NOT (data_pkt1(1) &  data_pkt1(3) & data_pkt1(5) &  data_pkt1(5));
-				joyleft_temp(7 downto 4) 	<= NOT (data_pkt1(0) &  data_pkt1(2) & data_pkt1(4) &  data_pkt1(4)); 
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte9;		
-		  --------------  byte9  -------------------------
-		  when wait_read_byte9 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte9;	  
-					else
-						usb_manage		<= read_byte9;
-					end if;	
-				end if;
-		  ------------------ read_byte9 ---------------------
-		  when read_byte9 =>
-				--- test if analogue ON/OFF
-				if (data_pkt1 = "01000000") then 
-					-- analogue ON 
-					data_valid		<= '0';
-				elsif (data_pkt1 = "00000000" OR data_pkt1 = "11000000") then
-					data_valid		<= data_valid_temp;
-				else
-					data_valid		<= '0';
-				end if;
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte10;		
-		  --------------  byte10  -------------------------
-		  when wait_read_byte10 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte10;	  
-					else
-						usb_manage		<= read_byte10;
-					end if;	
-				end if;	
-		  ------------------ read_byte10 ---------------------
-		  when read_byte10 =>
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte11;		
-		  --------------  byte11  -------------------------
-		  when wait_read_byte11 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte11;	  
-					else
-						usb_manage		<= read_byte11;
-					end if;	
-				end if;
-		  ------------------ read_byte11 ---------------------
-		  when read_byte11 =>
-				counter1				<= "00001111";
-				usb_manage			<= wait40;				
-	
-		  ----------------------------------------------------
-		  ------------  check CRC  ---------------------------
-		  ----------------------------------------------------
-		  ------------- if valid data then issue an ack   ----
-        when wait40 =>
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1				<= "11111111";
-					usb_manage			<= send_getreport_ack;		  
-				else
-					usb_manage			<=wait40;
-				end if;	
-		  -------------- read the next bytes to send ----------
-        when send_getreport_ack     =>  
-				counter2				<= "1111";
-				start_sendcom		<= '1';
-				address_start		<= "001000000"; -- 0x40  -   - 2 bytes
-				counter1 				<= "11111111";
-				usb_manage			<= send_getreport_ack_end; 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when send_getreport_ack_end =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom			<= '0';
-						counter1_3ms			<= "100000100011011";
-						counter2					<= "1111";
-						usb_manage				<= crc_complete;  -- 
-					else 
-						usb_manage				<= send_getreport_ack_end;
-					end if;	
-				end if;
-		  ------------------------------  CRC check   -----------------------------
-		  when crc_complete	=>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					data_available		<=	'1';
-					usb_manage			<= wait20;
-				end if;
-		  when others  => 
-			 usb_manage 		<= idle;		 
-	   end case;
-    end if;
-  end process; 
-
-  --------------------------------------------------------------------------
-  ------  detach detection process
-  --------------------------------------------------------------------------
-  process (
-  usb_lock, 
-  CLOCK12MHz,
-  detach_ack,
-  counterdetach,
-  dplus_buf2,
-  dminus_buf2
-  ) is
-  begin
-    if (usb_lock = '0') then  
-		counterdetach		<= "1111";
-		detach 				<= '0';
-		usb_detach			<= idle;
-    elsif (falling_edge(CLOCK12MHz)) then     
-      case usb_detach is
-        -------------- wait for the start trigger ----------------
-			when idle		=>   
-				if dplus_buf2 = '0' AND dminus_buf2 = '0' then	
-					counterdetach		<= "1111";
-					usb_detach			<= detach_start;	
-				else 
-					usb_detach			<= idle;
-				end if; -- 
-				
-		  -------------- read the rom first byte ----------------
-        when detach_start     =>              
-				if dplus_buf2 = '0' AND dminus_buf2 = '0' then
-					if counterdetach = "0000" then
-						usb_detach		<= detach_valid;	
-					else
-						usb_detach		<= detach_start;
-						counterdetach	<= counterdetach - 1;
-					end if;
-				else
-					counterdetach		<= "1111";
-					usb_detach			<= idle;
-				end if;
-		  -------------- wait for 30ms ----------------
-        when detach_valid     =>              
-				detach				<= '1';
-				usb_detach			<= detach_wait;	
-
-		  -------------- wait for 30ms ----------------
-        when detach_wait     =>              
-				if detach_ack	= '1' then
-					detach			<= '0';
-					counterdetach	<= "1111";
-					usb_detach		<= idle;				
-				else
-					usb_detach		<= detach_wait;
-				end if;
-		  when others  => 
-				counterdetach		<= "1111";
-				usb_detach 			<= idle;		 
-	   end case;
-    end if;
-  end process;	  
-  
-  ------------------------------------------------------
-  ------  state machine for the mouse
-  ------------------------------------------------------
-  process (usb_lock, clk_usb, CLOCK12MHz) is
-  begin
-    if (usb_lock = '0') then                                 
-      mouse_counter1			<= "000000000";
-		mousex_ctr				<= "000000000000";
-		mousey_ctr				<= "000000000000";
-		mouse_state				<= idle;
-    elsif (rising_edge(CLOCK12MHz) AND mouse_valid = '1') then     
-      case mouse_state is
-        -------------- xxxxxxxxxxxxxxxxxxxxxxxxxxx ----------------
-			when idle		=>   
-				if (mouse_counter1 = "000000000") then					-- 
-					mouse_state		<= state1;				-- 
-				else 
-					mouse_counter1	<= mouse_counter1 - 1;
-					mouse_state		<= idle;					-- 
-				end if;
-        -------------- xxxxxxxxxxxxxxxxxxxxxxxxxxx ----------------
-			when state1	=>   
-				-- 
-				IF ((mousex_temp /= "10000000")) THEN
-					IF ((mousex_temp(7) = '1') OR (mousex_temp = "01111110")) THEN
-					-- move right
-					mousex_ctr		<= mousex_ctr + ("00000000" & mousex_temp(7 downto 4));
-					ELSE
-					-- move left
-					mousex_ctr		<= mousex_ctr - ("00000000" & NOT(mousex_temp(7 downto 4)));
-					END IF;
-				END IF;
-				IF (mousey_temp /= "10000000") THEN
-					IF ((mousey_temp(7) = '0')) THEN
-						--IF ((mousex_temp /= "01111110") AND (mousex_temp /= "11111110")) THEN
-							-- move up
-							mousey_ctr		<= mousey_ctr + ("00000000" & NOT (mousey_temp(7 downto 4)));
-						--END IF;
-					ELSE
-					-- move down
-					mousey_ctr		<= mousey_ctr - ("00000000" & mousey_temp(7 downto 4));
-					END IF;
-				END IF;
-				mousex_out		<= mousex_ctr;
-				mousey_out		<= mousey_ctr;
-				mouse_counter1	<= "000000111";
-				mouse_state		<= idle;			
-			when others => 
-				mouse_state 	<= idle;		 
-	   end case;
-    end if;
-  end process; 		 
-  
-  
-  
-------------------------------------------------------------
-end arch;
\ No newline at end of file
Index: mcctv/usb/usb_driver2.vhd
===================================================================
--- mcctv/usb/usb_driver2.vhd	(revision 281)
+++ mcctv/usb/usb_driver2.vhd	(nonexistent)
@@ -1,1576 +0,0 @@
-
---===============================================================================
----USB_DRVR Entity (Drives and Reads D+ and D- lines to send and receive packets)
---===============================================================================
--- USB Driver - Copywrite Hakim Haddadi arcade retro gaming.
---------------------------------------------------
---==============================================================================
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-USE IEEE.STD_LOGIC_ARITH.ALL;
-USE IEEE.STD_LOGIC_UNSIGNED.ALL;
-use WORK.USBF_Declares.all;
-
---------------------------------------------------
-entity USB_DRVR2 is
-  port(                                 
-    clk_usb       : in    std_logic;    -- 5MHz clock
-	 pll_lock		: in    std_logic;
-    reset         : in    std_logic;    -- fpga reset
-    dminus        : inout std_logic;    -- USB differential D+ line
-    dplus         : inout std_logic;    -- USB differential D+ line
-	 joyright_out 	: out   std_logic_vector(7 downto 0);
-	 joyleft_out 	: out   std_logic_vector(7 downto 0);
-	 mousex_out		: out   std_logic_vector(11 downto 0);
-	 mousey_out		: out   std_logic_vector(11 downto 0)
-    );
-end USB_DRVR2;
----------------------------------------------------
-
-architecture arch of USB_DRVR2 is
-------------------------
-
-component sub_pll IS
-	PORT
-	(
-		areset		: IN STD_LOGIC  := '0';
-		inclk0		: IN STD_LOGIC  := '0';
-		c0				: OUT STD_LOGIC ;
-		locked		: OUT STD_LOGIC 
-	);
-END component sub_pll;
-
-component rom_com1 IS
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock			: IN STD_LOGIC  := '1';
-		rden			: IN STD_LOGIC  := '1';
-		q				: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-END component rom_com1;
- 
-  signal dp_last, dp_prev, dp1_last,dm1_last    : std_logic;
-  signal nb_bits                 : std_logic_vector(3 downto 0);  --bit counter for receive bits
-  signal stuffin1        			: integer range 0 to 7;  --counters for stuff-bits out and in
-  signal usb_lock				 		: std_logic := '0';
-  --signal clk_usb						: std_logic;
-  signal reg_10bits					: std_logic_vector(9 downto 0);
-  signal reg_10bits_receive		: std_logic_vector(9 downto 0);
-  signal dp2_prev						: std_logic;
-  signal CLOCK12MHz					: std_logic;
-  signal CLOCK12MHz_receive		: std_logic;
-  signal token_pid2					: std_logic_vector(3 downto 0);
-  signal data_pkt1					: std_logic_vector(7 downto 0);
-  signal data_temp					: std_logic_vector(7 downto 0);
-  signal data_rom						: std_logic_vector(7 downto 0);
-  -- ROM signals
-  signal address_rom					: std_logic_vector(8 downto 0);
-  signal rom_out						: std_logic_vector(7 downto 0);
-  signal rden_sig						: std_logic;
-  
-  signal data_tosend					: std_logic_vector(7 downto 0);
-  signal nb_byte_tosend				: std_logic_vector(7 downto 0);
-  signal address_start				: std_logic_vector(8 downto 0);
-  signal dm_previous					: std_logic;
-  signal dp_previous					: std_logic;
-  signal dplus_buf1					: std_logic;
-  signal dplus_buf2					: std_logic;
-  signal dminus_buf1					: std_logic;
-  signal dminus_buf2					: std_logic;
-  signal start_sendcom				: std_logic;
-  signal send_frame					: std_logic;
-  signal usb_reset					: std_logic;
-  signal synch							: std_logic;
-  signal read_byte_valid			: std_logic;
-  signal read_byte_valid_c			: std_logic;
-  signal data_available				: std_logic;
-  signal data_valid					: std_logic; 
-  signal data_valid_temp			: std_logic;
-  signal gamepad_basic				: std_logic;  
-  signal detach_ack					: std_logic;
-  signal detach						: std_logic;
-  signal joystick_type						: std_logic;
-  signal joystick_updown						: std_logic;
-  signal set_command						: std_logic_vector(1 downto 0);
-  signal counter1						: std_logic_vector(7 downto 0);
-  signal counterdetach					: std_logic_vector(3 downto 0);
-  signal counter2							: std_logic_vector(3 downto 0); 
-  signal counter30ms						: std_logic_vector(18 downto 0);
-  signal counter1_3ms					: std_logic_vector(14 downto 0);
-  signal joyright_temp					: std_logic_vector(7 downto 0);  
-  signal joyleft_temp					: std_logic_vector(7 downto 0);
-  signal data_byte2						: std_logic_vector(7 downto 0);
-  
-  signal nb_reset							: std_logic_vector(7 downto 0);
-  signal val								: std_logic;
-  signal mouse_valid						: std_logic;	
-  signal mouse_counter1					: std_logic_vector(8 downto 0);  
-  
-  signal mousex_temp						: std_logic_vector(7 downto 0);  
-  signal mousey_temp						: std_logic_vector(7 downto 0);
-  signal mousex_ctr						: std_logic_vector(11 downto 0);  
-  signal mousey_ctr						: std_logic_vector(11 downto 0); 
- 
-  type usb1_sm_type is (                 -- receive state machine
-    state1, state2, state3,              --,
-    state4);
-	 
-  type usb_com_type is (                 	--send state machine #1 to read D+/D- lines
-    Idle, 
-	 send1, send2,send3, reset_start,             			--
-	 send4, send5,send6, reset_released,            			--
-	 send_bit0, send_bit1,send_bit2,             			--
-	 send_bit3, send_bit4,send_bit5,             		--
-	 send_bit6, send_bit7,send15,             		--
-	 end_send1, end_send2, send_complete             		--
- );
-
-  type usb_manage_type is (                 	--Tranceiver state machine #1 to read D+/D- lines
-    Idle, 
-	 usb_manage1, usb_manage2,             			-- 
-	 usb_reset_state, crc_complete, usb_waitdetachrelease, wait_for_deviceconnect,
-	 usb_wait30ms, end_set_address, end_set_configuration, end_set_idle,
-	 read_pktin2, read_pktin3, read_pktin4, wait_pktin4,
-	 setaddress_sendpkt1, setaddress_sendpkt1_end,
-	 setaddress_sendpkt2, setaddress_sendpkt2_end,
-	 setaddress_sendpkt3, setaddress_sendpkt3_end,	 
-	 send_ack, send_ack_start, send_ack_end,
-	 getreport_sendpkt1, getreport_sendpkt1_start, getreport_sendpkt1_end,
-	 wait_pktin1, wait_pktin2, wait_pktin3,
-	 wait_report_start, start_get_report,
-	 send_getreport_ack, send_getreport_ack_start, send_getreport_ack_end,
-	 start_get_data, 
-	 wait_read_byte2, wait_read_byte3, wait_read_byte4, wait_read_byte5, wait_read_byte6,
-	 wait_read_byte7, wait_read_byte8, wait_read_byte9, wait_read_byte10, wait_read_byte11,
-	 read_byte1, read_byte2, read_byte3, read_byte4, read_byte5, read_byte6,
-	 read_byte7, read_byte8, read_byte9, read_byte10, read_byte11,
-	 wait1, wait2, wait4, wait6,  
-	 wait20, wait21, wait30, wait40, 
-	 wait_ack2,
-	 usb_reset_1ms_start, usb_reset_1ms_wait1, usb_reset_1ms_wait2, usb_reset_1ms_release
- ); 
- 
- type usb_detach_type is (                 	--Tranceiver state machine #1 to read D+/D- lines
-    Idle, 
-	 detach_start, detach_wait,detach_valid             			--            		--
- );
- 
- type mouse_state_type is (                 	--Tranceiver state machine #1 to read D+/D- lines
-    Idle, 
-	 state1             			--            		--
- );
-	 
-  signal                                usb_detach             : usb_detach_type;
-  signal                                usb1_state             : usb1_sm_type;
-  signal                                usb_send_com    			: usb_com_type;
-  signal                                usb_manage    			: usb_manage_type;
-  signal                                mouse_state    			: mouse_state_type; 
-  ------------------------------------------------------------
-
-  ATTRIBUTE keep : boolean;
-  ATTRIBUTE keep OF dminus  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF dplus  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF clk_usb  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF CLOCK12MHz  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF rom_out  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF joyright_out  : SIGNAL IS TRUE;  
-  ATTRIBUTE keep OF joyleft_out  : SIGNAL IS TRUE;
-  ATTRIBUTE keep OF joyright_temp  : SIGNAL IS TRUE;  
-  ATTRIBUTE keep OF joyleft_temp  : SIGNAL IS TRUE;
- 
-begin
-
-----------------------------------
--- instantiate the rom commands --
-----------------------------------
-rom_com_inst : rom_com1 
-PORT MAP (
-			address	 	=> address_rom,
-			clock	 		=> clk_usb,
-			rden	 		=> rden_sig AND CLOCK12MHz,
-			q	 			=> rom_out
-			);
-		
-   usb_lock <= pll_lock;
-  
------------------------------
--- update of joystick data	--
------------------------------
-  PROCESS
-  (
-    usb_lock, 		-- External asynchronous reset
-    clk_usb    	-- 15 MHz clock (usb over sampling)
-
-  )
-  BEGIN
-    -- 
-   IF (usb_lock = '0') THEN
-		joyright_out 			<= "11111111";
-		joyleft_out 			<= "11111111";
-   ELSIF (rising_edge(clk_usb)) THEN
-		IF (data_available = '1') THEN
-			IF (data_valid = '1') THEN
-				-- bit 0 : 2
-				-- bit 1 : 4
-				-- bit 2 : 3
-				-- bit 3 : 1
-				-- bit 4 : fire button / start
-				-- bit 5 : fire button / start
-				-- bit 6 : button front right "2"  
-				-- bit 7 : button front right "1"
-				joyright_out <= joyright_temp;
-				-- bit 0 : right
-				-- bit 1 : left
-				-- bit 2 : down
-				-- bit 3 : up
-				-- bit 4 : fire button / select
-				-- bit 5 : fire button / select
-				-- bit 6 : button front left "2"  
-				-- bit 7 : button front left "1"							
-				joyleft_out <= joyleft_temp;
-			ELSE
-				-- bit 0 : 2
-				-- bit 1 : 4
-				-- bit 2 : 3
-				-- bit 3 : 1
-				-- bit 4 : fire button / start
-				-- bit 5 : fire button / start
-				-- bit 6 : button front right "2"  
-				-- bit 7 : button front right "1"
-				joyright_out <= joyright_temp;
-				-- bit 0 : Not active
-				-- bit 1 : Not active
-				-- bit 2 : Not active
-				-- bit 3 : Not active
-				-- bit 4 : fire button / select
-				-- bit 5 : fire button / select
-				-- bit 6 : button front left "2"  
-				-- bit 7 : button front left "1"							
-				joyleft_out(7 downto 4) <= joyleft_temp(7 downto 4);	
-				joyleft_out(3 downto 0) <= "1111";
-			END IF;
-      END IF;
-   END IF;			
-  END PROCESS;
-	
- ----------------------------------------------
- --  usb clock enable generation for sending --
- ----------------------------------------------
-  PROCESS
-  (
-    usb_lock, -- reset_process, 	-- External asynchronous reset
-    clk_usb    		-- over sampling clk 15MHz
-  )
-  BEGIN
-    -- 
-   IF (usb_lock = '0') THEN
-		reg_10bits <= "0000000001";
-   ELSIF (rising_edge(clk_usb)) THEN
-		reg_10bits 		<= reg_10bits(8 downto 0) & reg_10bits(9); -- 
-   END IF;			
-  END PROCESS;
-  
- -- update clock enable USB
- CLOCK12MHz 		<= reg_10bits(4);
- 
- ------------------------------------------------
- --  usb clock enable generation for receiving --
- ------------------------------------------------
- -- process generating a 15 MHz clk enable signal in phase with the incoming data from the device
- -- the process is using an oversampling clk of 15 MHz
-  PROCESS
-  (
-    usb_lock, --reset_process, 		-- External asynchronous reset
-    clk_usb    -- over sampling clk 48MHz
-  )
-  BEGIN
-    -- 
-   IF (usb_lock = '0') THEN
-		reg_10bits_receive 	<= "0000000001";
-		dp2_prev     		 	<= dplus_buf2;
-   ELSIF (rising_edge(clk_usb)) THEN
-		dp2_prev     			<= dplus_buf2;           -- sample the input D+ line
-		IF (dp2_prev /= dplus_buf2) THEN
-			reg_10bits_receive <= "0000000001";				-- reset the phase of the USB clk
-		ELSE
-			reg_10bits_receive 				<= reg_10bits_receive(8 downto 0) & reg_10bits_receive(9); -- 
-      END IF;
-   END IF;			
-  END PROCESS;
-  
-  -- update clock USB
- CLOCK12MHz_receive 		<= reg_10bits_receive(4); 
-  
-  --------------------------------------------------------------------------------------
-  ---------------------  buffering of Dplus - Dminus to avoid metastability ------------
-  --------------------------------------------------------------------------------------
-  process (clk_usb, usb_lock) is
-  begin
-    if usb_lock = '0' then
-		dplus_buf1      	<= '0';
-		dplus_buf2      	<= '0';
-		dminus_buf1      	<= '0';
-		dminus_buf2      	<= '0';
-    elsif rising_edge(clk_usb) then     	--
-		dplus_buf1     	<= dplus;  
-		dplus_buf2     	<= dplus_buf1;
-		dminus_buf1      	<= dminus;
-		dminus_buf2      	<= dminus_buf1;
-    end if;
-  end process;
-  
-  ---------------------------------------------------------------------
-  ------------------  state machine for acquiring usb data
-  ---------------------------------------------------------------------
-  process (reset, clk_usb, CLOCK12MHz_receive) is
-  begin
-    if (reset = '0') then    
-		dp1_last				<= dplus_buf2;
-		dm1_last				<= dminus_buf2;
-      data_pkt1			<= "00000000";
-      data_temp   		<= "00000000";
-		read_byte_valid	<= '0';
-		usb1_state       	<= state1;   
-		nb_bits				<= "0000";
-		stuffin1          <= 0;
-		synch       		<= '0';
-    elsif (rising_edge(clk_usb) AND CLOCK12MHz_receive = '1') then     
-      case usb1_state is
-        -------------- state1 ----------------
-			when state1		=>   
-				read_byte_valid	<= '1';
-				data_pkt1   <= "00000000";
-				data_temp   <= "00000000";
-				if dplus_buf2 = '0' and dminus_buf2 = '0' then
-					usb1_state	<= state1;				-- reset state
-				elsif dplus_buf2 = '1' and dminus_buf2 = '0' then
-					dp1_last		<= dplus_buf2;
-					dm1_last		<= dminus_buf2;
-					usb1_state	<= state2;				-- go to state2 and wait for synch
-				end if;
-				nb_bits				<= "0000"; 
-		  -------------- state2 ----------------
-        when state2     =>
-				dp1_last		<= dplus_buf2;
-				dm1_last		<= dminus_buf2;
-				if dp1_last /= dplus_buf2 and dm1_last /= dminus_buf2 then               
-					nb_bits     	<= nb_bits + 1;			-- start of synch
-				elsif dplus_buf2 = '0' and dminus_buf2 = '0' then  
-					usb1_state	<= state1;				-- reset state
-					nb_bits		<= "0000";
-				end if;
-  
-          if nb_bits = "0110" then               
-				usb1_state	<= state3;				-- go to state 3 and wait for final synch
-          end if; 
-		  -------------- state3 ----------------
-        when state3     =>
-				dp1_last		<= dplus_buf2;
-				dm1_last		<= dminus_buf2;
-          if dplus_buf2 = '0' and dminus_buf2 = '1' then               
-            nb_bits     <= nb_bits + 1;			-- start of synch
-          elsif dplus_buf2 = '0' and dminus_buf2 = '0' then  
-            usb1_state	<= state1;				-- reset state
-				data_pkt1   <= "00000000";
-				data_temp   <= "00000000";
-				nb_bits		<= "0000";
-          end if;
-
-			 if nb_bits = "0111" then               
-				usb1_state	<= state4;				-- synch byte complete start aquiring packets
-				data_pkt1   <= "10000000";
-				data_temp	<= "10000000";
-				read_byte_valid	<= Not read_byte_valid;
-				nb_bits		<= "0000";
-				synch       <= '1';
-          end if; 
-		  -------------- state4 ----------------
-        when state4     =>
-		if detach = '1' then
-			usb1_state   	<= state1;
-		else
-          if dplus_buf2 = '0' and dminus_buf2 = '0' then  
-            usb1_state	<= state1;				-- reset state
-				data_pkt1   <= data_temp;
-				data_temp   <= "00000000";
-				nb_bits		<= "0000";
-			 else
-				dp1_last        <= dplus_buf2;
-				
-				if (stuffin1 = 6 and nb_bits = "0000") then
-					stuffin1           <= 0;
-					val					 <= '1';	
-				elsif stuffin1 = 6 then           				--	after 6 '1's in a row = This is a stuff bit.
-					stuffin1           <= 0;     				--	ignore it and reset the stuff count.
-					val					 <= '0';
-				else                          				--	no stuff bit, get the real bit based on D+/D- lines. 
-					val					 <= '0';
-					nb_bits         <= nb_bits + 1;  	--	Count the real bits. Current 'bitin' is always coming in.
-					if dp1_last = dplus_buf2 then     				--	NRZI test. no change -> 1
-						stuffin1           <= stuffin1 + 1;  	--	count the consecutive 1's
-						if(nb_bits = "0000") then
-							data_temp(0) <= '1';
-						elsif(nb_bits = "0001") then
-							data_temp(1) <= '1';
-						elsif(nb_bits = "0010") then
-							data_temp(2) <= '1';
-						elsif(nb_bits = "0011") then
-							data_temp(3) <= '1';
-						elsif(nb_bits = "0100") then
-							data_temp(4) <= '1';
-						elsif(nb_bits = "0101") then
-							data_temp(5) <= '1';
-						elsif(nb_bits = "0110") then
-							data_temp(6) <= '1';
-						else
-							data_temp(7) <= '1';
-						end if;
-					else
-						if(nb_bits = "0000") then
-							data_temp(0) <= '0';
-						elsif(nb_bits = "0001") then
-							data_temp(1) <= '0';
-						elsif(nb_bits = "0010") then
-							data_temp(2) <= '0';
-						elsif(nb_bits = "0011") then
-							data_temp(3) <= '0';
-						elsif(nb_bits = "0100") then
-							data_temp(4) <= '0';
-						elsif(nb_bits = "0101") then
-							data_temp(5) <= '0';
-						elsif(nb_bits = "0110") then
-							data_temp(6) <= '0';
-						else
-							data_temp(7) <= '0';
-						end if;
-						stuffin1         	<= 0;     --reset the stuff-bit count when a 0
-					end if;
-				end if;
-			end if;
-			
-			if (nb_bits = "0111") AND (stuffin1 /= 6) then  
-				usb1_state	<= state4;
-				nb_bits		<= "0000"; 
-         end if; 
-			
-			if nb_bits = "0000" AND synch = '1' then  
-				synch       <= '0';
-			elsif nb_bits = "0000" AND val = '1' then
-				data_pkt1   <= data_temp;
-			elsif nb_bits = "0000" then
-				data_pkt1   <= data_temp;			
-				read_byte_valid	<= Not read_byte_valid;
-         end if; 
-		end if;
-		when others  => 
-			 usb1_state <= state1;
-			 nb_bits		<= "0000";
-	   end case;
-    end if;
-  end process; 		 
-  
-  ------------------------------------------------------
-  ------  state machine for sending usb data
-  ------------------------------------------------------
-  process (usb_lock, clk_usb, CLOCK12MHz) is
-  begin
-    if (usb_lock = '0') then                                 
-      data_tosend			<= "00000000";
-		nb_byte_tosend		<= "00000000";
-		dp_previous			<= '1';
-		dm_previous			<= '0';
-		dplus					<= '1';
-		dminus				<= '0';
-		usb_send_com		<= idle;
-    elsif (rising_edge(clk_usb) AND CLOCK12MHz = '1') then     
-      case usb_send_com is
-        -------------- wait for the reset start trigger ----------------
-			when idle		=>   
-				data_tosend   <= "00000000";
-				send_frame		<= '0';
-				if (usb_reset = '1') then				-- the start of sending data is initiated by the usb manage state machine
-					usb_send_com	<= reset_start;	-- reset start state
-					dplus			<= '0';
-					dminus		<= '0';
-				else 
-					usb_send_com	<= idle;					-- go to idle state
-				end if;
-        -------------- wait for the start trigger ----------------
-			when reset_start		=>   
-				if (usb_reset = '0') then					-- The reset is released
-					usb_send_com	<= reset_released;	-- end of reset state
-					dplus				<= 'Z';
-					dminus			<= 'Z';
-				else 
-					usb_send_com	<= reset_start;			
-				end if;				
-        -------------- wait for the start trigger ----------------
-			when reset_released		=>   
-				data_tosend   <= "00000000";
-				send_frame		<= '0';
-				if (usb_reset = '1') then
-					dplus				<= '0';
-					dminus			<= '0';
-					usb_send_com	<= reset_start;
-				elsif (start_sendcom = '1') then				-- the start of sending data is initiated by the usb manage state machine
-					usb_send_com	<= send1;				-- next state
-					rden_sig			<= '1';					
-					address_rom		<= address_start;		-- inialise the address_com with the address set by the usb state machine
-				else 
-					dplus				<= 'Z';
-					dminus			<= 'Z';
-					usb_send_com	<= reset_released;	-- wait for send com trigger
-				end if;
-		  -------------- prepare for the next read ----------------
-        when send1     =>              
-				address_rom			<= address_rom + "000000001";	-- prepare for the next read
-				rden_sig				<= '1';					-- read the first byte
-				usb_send_com		<= send2;		  
-		  -------------- read the rom first byte ----------------
-        when send2     =>  
-				nb_byte_tosend		<= rom_out;				-- read the first byte
-				usb_send_com		<= send3;
-		  -------------- read the next bytes to send ----------------
-        when send3     =>    
-				data_tosend			<= rom_out;				-- read the next byte
-				rden_sig				<= '0';
-				usb_send_com		<= send_bit0;
-		  -------------- send_bit0 ----------------
-        when send_bit0 =>
-		  	 nb_byte_tosend   <= nb_byte_tosend - "00000001";
-			 rden_sig			<= '0';					-- disable the rom read
-          if data_tosend(0) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit1;
-		  -------------- send_bit1 ----------------			 
-		  when send_bit1 =>
-          if data_tosend(1) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-				else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit2;
-		  -------------- send_bit2 ----------------
-        when send_bit2 =>
-          if data_tosend(2) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit3;
-		  -------------- send_bit3 ----------------			 
-		  when send_bit3 =>
-          if data_tosend(3) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit4;
-		  -------------- send_bit4 ----------------
-        when send_bit4 =>
-          if data_tosend(4) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 usb_send_com	<= send_bit5;
-		  -------------- send_bit5 ----------------			 
-		  when send_bit5 =>
-          if data_tosend(5) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 address_rom	<= address_rom + "000000001";	-- prepare for the next read
-			 rden_sig		<= '1';								
-			 usb_send_com	<= send_bit6;
-		  -------------- send_bit6 ----------------
-        when send_bit6 =>
-          if data_tosend(6) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 rden_sig		<= '0';
-			 usb_send_com	<= send_bit7;
-		  -------------- send_bit7 ----------------			 
-		  when send_bit7 =>
-          if data_tosend(7) = '0' then               
-				dplus			<= NOT dp_previous;
-				dminus		<= NOT dm_previous;
-				dp_previous <= NOT dp_previous;
-				dm_previous <= NOT dm_previous;
-          else 
-				dplus			<= dp_previous;
-				dminus		<= dm_previous;
-          end if;
-			 data_tosend 	<= rom_out;
-			 rden_sig		<= '0';								
-			 if nb_byte_tosend = "00000000" then
-				usb_send_com	<= end_send1;
-			 else
-				usb_send_com	<= send_bit0; -- send next byte
-			 end if;
-		  -------------- send_end of frame ----------------			 
-		  when end_send1 =>              
-			 dplus		<= '0';
-			 dminus		<= '0';
-			 usb_send_com	<= end_send2; 
-		  -------------- send_end of frame ----------------			 
-		  when end_send2 =>              
-			 dplus			<= '0';
-			 dminus			<= '0';
-			 usb_send_com	<= send_complete; 
-		  -------------- send_complete ----------------			 
-		  when send_complete =>              
-			 send_frame		<= '1';
-			 dplus			<= 'Z';
-			 dminus			<= 'Z';
-			 dp_previous	<= '1';
-			 dm_previous	<= '0';
-			 usb_send_com	<= reset_released; 	
-		  when others  => 
-			 usb_send_com <= idle;		 
-	   end case;
-    end if;
-  end process; 		 
-  
-  
-  --------------------------------------------------------------------------
-  ------  state machine for managing sending and receiving usb data
-  --------------------------------------------------------------------------
-  process (usb_lock, clk_usb) is
-  begin
-    if (usb_lock = '0') then 
-		joystick_type 		<= '0';
-		usb_reset			<= '0';
-		data_available		<= '0';
-		data_valid			<= '0';
-		data_valid_temp	<= '0';
-      start_sendcom		<= '0';
-		counter1				<= "11111111";
-		counter2				<= "1000";
-		counter30ms			<= "0101100110000100101";
-		counter1_3ms		<= "100000100011011";
-		detach_ack			<= '0';
-		usb_manage			<= idle;
-		
-    elsif (falling_edge(clk_usb)) then     
-      case usb_manage is
-        -------------- idle state ----------------
-			when idle		=>   
-				set_command				<= "00";
-				start_sendcom			<= '0';
-				joystick_type 			<= '0';
-				mouse_valid				<= '0';
-				if dplus = '1' then	
-					usb_manage			<= wait_for_deviceconnect;	
-				else 
-					usb_manage			<= idle;
-				end if; -- 
-		  -------------- confirm device connected ----------------
-        when wait_for_deviceconnect     =>              
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					usb_reset			<= '1';
-					usb_manage			<= usb_reset_state;	
-				else
-					usb_manage			<= wait_for_deviceconnect;
-				end if;		
-		  -------------- reset device state ----------------
-        when usb_reset_state     =>              
-				counter30ms				<= counter30ms - 1;
-				if counter30ms	 = "0000000000000000000" then
-				   counter30ms			<= "1111111111111111111";
-					counter1_3ms		<= "100000100011011";
-					counter2				<= "1011";
-					usb_reset			<= '0';
-					detach_ack			<= '1';
-					nb_reset	 			<= "00011101"; -- 29 keep alive
-					usb_manage			<= usb_reset_1ms_start;	
-				else
-					usb_manage			<= usb_reset_state;
-				end if;
-		  -------------- usb_reset_1ms_start ----------------
-        when usb_reset_1ms_start     =>              
-				counter1_3ms				<= counter1_3ms - 1;
-				if counter1_3ms	 = "0000000000000000" then
-					counter1_3ms		<= "100000100011011";
-					counter2				<= "1011";
-					counter1_3ms		<= counter1_3ms - 1;
-					detach_ack			<= '0';
-					usb_reset			<= '1';
-					usb_manage			<= usb_reset_1ms_wait1;	
-				else
-					usb_manage			<= usb_reset_1ms_start;
-				end if;			
-		  -------------- usb_reset_1ms_start ----------------
-        when usb_reset_1ms_wait1     =>  
-				usb_reset				<= '1';
-				counter2					<= counter2 - '1';
-				if counter2 = "0000" then
-					usb_reset			<= '0';
-					usb_manage			<= usb_reset_1ms_release;	
-				else
-					usb_manage			<= usb_reset_1ms_wait1;
-				end if;
-		
-		  -------------- usb_reset_1ms_start ----------------
-        when usb_reset_1ms_release     =>          
-				usb_reset				<= '0';		  
-				nb_reset					<= nb_reset - 1;
-				if nb_reset	 = "00000000" then
-					usb_manage			<= usb_manage2;	
-				else
-					counter1_3ms		<= "100000100011011";
-					counter2				<= "1011";
-					usb_manage			<= usb_reset_1ms_start;
-				end if;				
-	
-		  -------------- reset release state ----------------
-        when usb_wait30ms     =>              
-				counter1			<= counter1 - 1;
-				if counter1	= "00000000" then
-					detach_ack		<= '0';
-					counter1			<= "11111111";
-					usb_manage			<= usb_waitdetachrelease;	
-				else
-					usb_manage			<= usb_wait30ms;
-				end if;	
-		  -------------- confirm device attached ----------------
-        when usb_waitdetachrelease     =>              
-				counter2				<= counter2 - 1;
-				if counter2	= "0000" then
-					usb_manage			<= usb_manage2;	
-				else
-					usb_manage			<= usb_waitdetachrelease;
-				end if;
-		  -------------- end of reset state ----------------
-        when usb_manage2     =>  
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					start_sendcom	<= '0';
-					address_start	<= "000010010";
-					usb_manage		<= wait1;	-- start set address	
-				end if;	
-		  ------------------------------------------------
-		  -------------- SET ADDRESS 0x01 ----------------
-		  ------------------------------------------------
-		  
-		  -------------- waiting state -------------------
-        when wait1 =>
-				counter2					<= counter2 - 1;
-				if counter2	= "0000" then
-					counter2				<= "1111";
-					usb_manage			<= setaddress_sendpkt1;		  
-				else
-					usb_manage			<= wait1;
-				end if;			 
-		  -------------- send first packet "SETUP" packet ----------------
-        when setaddress_sendpkt1     =>  
-				start_sendcom			<= '1';
-				if set_command = "00" then
-					-- set address
-					address_start		<= "000010010"; -- 0x12  - 0x2D 0x00 0x10  - 3 bytes
-				elsif set_command = "01" then
-					-- set configuration
-					address_start		<= "001010000"; -- 0x50  - 0x2D 0x01 0xE8  - 3 bytes
-				else
-					-- set idle
-					address_start		<= "001110000"; -- 0x70  - 0x2D 0x01 0xE8  - 3 bytes
-				end if;
-				usb_manage				<= setaddress_sendpkt1_end; -- 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when setaddress_sendpkt1_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom	<= '0';
-						counter1			<= "01010011";
-						usb_manage		<= wait2;
-					else 
-						usb_manage		<= setaddress_sendpkt1_end;
-					end if;
-				end if;
-			---------------------  waiting state ----------------------
-			when wait2 =>
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1				<= "01010011";
-					usb_manage			<= setaddress_sendpkt2;		  
-				else
-					usb_manage			<= wait2;
-				end if;			 
-		  -------------- send the data packet for set address ---------
-        when setaddress_sendpkt2     =>  
-				start_sendcom		<= '1';
-				if set_command = "00" then
-					-- set address
-					address_start		<= "000010111"; -- 0x17  -   - 11 bytes
-				elsif set_command = "01" then
-					-- set configuration
-					address_start		<= "001010101"; -- 0x55  -   - 11 bytes
-				else
-					-- set idle
-					address_start		<= "001110101"; -- 0x75  -   - 11 bytes
-				end if;
-				usb_manage			<= setaddress_sendpkt2_end; -- 	
-		  -------------- wait for completion of sending frame ----------------			 
-		  when setaddress_sendpkt2_end =>
-			 if detach = '1' then
-					usb_manage   	<= idle;
-			 else
-				if send_frame = '1' then  
-					start_sendcom			<= '0';
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait_ack2;
-				else 
-					usb_manage				<= setaddress_sendpkt2_end;
-				end if;
-			end if;
-		  -------------- waiting ACK ----------------
-        when wait_ack2 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					counter1_3ms			<= counter1_3ms - 1;
-					if data_pkt1 = "11010010" then
-						counter1_3ms		<= "100000100011011";
-						usb_manage			<= wait4;		-- ack go top the next stage
-					elsif counter1_3ms	= "000000000000000" then
-						counter1_3ms		<= "100000100011011"; -- no ack, retry sending the command
-						usb_manage			<= setaddress_sendpkt1;
-					else
-						usb_manage			<= wait_ack2;
-					end if;
-				end if;
-		  ---------------- waiting state  ---------------------
-		  when wait4 =>
-				counter2			<= counter2 - 1;
-				if counter2	= "0000" then
-					counter2		<= "1111";
-					usb_manage			<= setaddress_sendpkt3;		  
-				else
-					usb_manage					<= wait4;
-				end if;			 
-		  -------------- prepare for sending the second packet ----------------
-        when setaddress_sendpkt3     =>  
-				start_sendcom		<= '1';
-				if set_command = "00" then
-					-- set address
-					address_start		<= "000100100"; -- 0x24  -   - 4 bytes
-				elsif set_command = "01" then
-					-- set configuration
-					address_start		<= "001100010"; -- 0x62  -   - 4 bytes
-				else
-					-- set idle
-					address_start		<= "010000010"; -- 0x82  -   - 4 bytes
-				end if;
-				usb_manage			<= setaddress_sendpkt3_end; -- 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when setaddress_sendpkt3_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom			<= '0';
-						counter1_3ms			<= "100000100011011";
-						usb_manage				<= wait_pktin1;
-					else 
-						usb_manage				<= setaddress_sendpkt3_end;
-					end if;
-				end if;
-		  -------------- waiting for 1st byte ----------------
-        when wait_pktin1 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					counter1_3ms			<= counter1_3ms - 1;
-					if data_pkt1 = "10000000" then -- 0x80 wait for synch
-						usb_manage			<= wait_pktin2;		-- ack go to the next stage
-					elsif counter1_3ms	= "000000000000000" then
-						counter1_3ms		<= "100000100011011";    -- no ack, retry sending the command
-						usb_manage			<= setaddress_sendpkt3;
-					else
-						usb_manage			<= wait_pktin1;
-					end if;
-				end if;
-		  --------------  pktin2 "0x4B"  -------------------------
-		  when wait_pktin2 =>
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					if read_byte_valid = '0' then
-						usb_manage		<= wait_pktin2;	  
-					else
-						usb_manage		<= read_pktin2;
-					end if;	
-				end if;
-		  ------------------ read_pktin2 "0x4B" ---------------------
-		  when read_pktin2 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if data_pkt1 = "01001011" then -- 0x4B
-						usb_manage			<= wait_pktin3;					-- ack go top the next stage
-					else 
-						usb_manage			<= setaddress_sendpkt3; -- no ack, retry sending the command
-					end if;
-				end if;	
-		  --------------  pktin3 "0x00"  -------------------------
-		  when wait_pktin3 =>
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					if read_byte_valid = '1'  then
-						usb_manage		<= wait_pktin3;	  
-					else
-						usb_manage		<= read_pktin3;
-					end if;	
-				end if;
-		  ------------------ read_pktin3 "0x00" ---------------------
-		  when read_pktin3 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if data_pkt1 = "00000000" then -- 0x00
-						usb_manage			<= wait_pktin4;					-- ack go top the next stage
-					else 
-						usb_manage			<= setaddress_sendpkt3; -- no ack, retry sending the command
-					end if;
-				end if;	
-		  --------------  pktin4 "0x00"  -------------------------
-		  when wait_pktin4 =>
-				if detach = '1' then
-					usb_manage   		<= idle;
-				else
-					if read_byte_valid = '0' then
-						usb_manage		<= wait_pktin4;	  
-					else
-						usb_manage		<= read_pktin4;
-					end if;	
-				end if;
-		  ------------------ read_pktin4 "0x00" ---------------------
-		  when read_pktin4 =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if data_pkt1 = "00000000" then -- 0x00
-						counter1				<= "00001111"; 
-						usb_manage			<= wait6;					-- go to "send ack" state
-					else 
-						usb_manage			<= setaddress_sendpkt3; -- no ack, retry sending the command
-					end if;
-				end if;	
-		  --------------------   waiting state before sending ack  --------------------------
-        when wait6 =>
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1				<= "11111111";
-					usb_manage			<= send_ack;		  
-				else
-					usb_manage			<= wait6;
-				end if;	
-		  -------------- inialise ROM address for send ack ----------------
-        when send_ack     =>  
-				start_sendcom		<= '1';
-				address_start		<= "001000000"; -- 0x40  -   - 2 bytes
-				usb_manage			<= send_ack_end; -- send_ack_start;	-- 	
-		  -------------- wait for completion of sending frame ----------------			 
-		  when send_ack_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom			<= '0';
-						counter1_3ms			<= "000000000000001";
-						if set_command = "00" then
-							usb_manage				<= end_set_address;
-						elsif set_command = "01" then
-							usb_manage				<= end_set_configuration;
-						else
-							usb_manage				<= end_set_idle;
-						end if;
-					else 
-						usb_manage				<= send_ack_end;
-					end if;	
-				end if;
-		  ------------------------------  End of Set Address   -----------------------------
-		  
-        when end_set_address =>
-				counter1_3ms					<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms				<= "100000100011011";
-					set_command					<= "01"; -- set_command set to SetConfiguration
-					nb_reset	 					<= "00000000"; -- 1 keep alive
-					usb_manage					<= usb_reset_1ms_start;		  
-				else
-					usb_manage					<= end_set_address;
-				end if; 
-				
-        when end_set_configuration =>
-				counter1_3ms					<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms				<= "100000100011011";
-					set_command					<= "10"; -- set_command set to SetConfiguration
-					nb_reset	 					<= "00000000"; -- 1 keep alive
-					usb_manage					<= usb_reset_1ms_start;		  
-				else
-					usb_manage					<= end_set_configuration;
-				end if; 
-
-		  when end_set_idle =>
-				counter1_3ms					<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms				<= "100000100011011";
-					counter1						<= "00011001";
-					set_command					<= "00"; -- set_command set to Setaddress in case of a detach/attach
-					usb_manage					<= wait21; -- wait20; -- go to get report	  
-				else
-					usb_manage					<= end_set_idle;
-				end if; 
-
-
-			---------------------------------------------------------------
-			---------------------------------------------------------------
-			---------------------------------------------------------------
-			-------------- GET REPORT ----------------
-        when wait20 =>    -- wait 1.3ms * 9
-				counter1_3ms				<= counter1_3ms - 1;
-				if counter1_3ms	= "000000000000000" then
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait21;		  
-				else
-					usb_manage				<= wait20;
-				end if;		
-		  ---------------------   wait  -------------
-        when wait21 =>    -- 
-				counter1						<= counter1 - 1;
-				if counter1	= "00000000" then
-					data_available			<=	'0';
-					data_valid				<= '0';
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= getreport_sendpkt1;		  
-				else
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait21;
-				end if;		
-		  -------------- read the next bytes to send ----------------
-        when getreport_sendpkt1     =>  
-				start_sendcom		<= '1';
-				address_start		<= "010010000"; -- 0x90  - 0x69 0x81 0x58  - 3 bytes
-				usb_manage			<= getreport_sendpkt1_end; 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when getreport_sendpkt1_end =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom		<= '0';
-						counter1				<= "00000111";
-						usb_manage			<= wait30;
-					else 
-						usb_manage			<= getreport_sendpkt1_end;
-					end if;
-				end if;
-			-------------   waiting state  ------------------------
-		   when wait30 =>
-				counter1						<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1					<= "11111111";
-					counter1_3ms			<= "100000100011011";
-					usb_manage				<= wait_report_start;		  
-				else
-					usb_manage				<= wait30;
-				end if;			 
-		  -------------- waiting ACK ----------------
-        when wait_report_start =>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					counter1_3ms			<= counter1_3ms - 1;
-					if data_pkt1 = "10000000" then  -- wait for synch
-						counter1_3ms		<= "100000100011011";
-						counter1				<= "01111000";
-						read_byte_valid_c <= read_byte_valid;
-						usb_manage			<= start_get_data;	-- ack go top the next stage
-					elsif counter1_3ms	= "000000000000000" then
-						counter1_3ms		<= "100000100011011"; 	-- no ack, retry sending the command
-						usb_manage			<= getreport_sendpkt1;
-					else
-						usb_manage			<= wait_report_start;
-					end if;
-				end if;
-		  --------------  byte1  -------------------------
-		  when start_get_data =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c then
-						usb_manage			<= start_get_data;	  
-					else
-						read_byte_valid_c <= read_byte_valid;
-						usb_manage			<= read_byte1;
-					end if;	
-				end if;
-		  ------------------ read_byte1 ---------------------
-		  when read_byte1 =>
-				if (data_pkt1 = "01001011" or data_pkt1 = "11000011") then
-					data_valid_temp 	<= '1';
-					read_byte_valid_c <= read_byte_valid;
-					usb_manage			<= wait_read_byte2;
-					counter1				<= "11111111";
-				else
-					counter1				<= "11111111";
-					usb_manage			<= wait21;
-				end if;
-		  --------------  byte2  -------------------------
-		  when wait_read_byte2 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte2;	  
-					else
-						usb_manage		<= read_byte2;
-					end if;	
-				end if;
-		  ------------------ read_byte2 ---------------------
-		  when read_byte2 =>
-				if joystick_type = '0' then
-					--joyleft_temp ( 1 downto 0) <= NOT ((NOT data_pkt1(6)) & data_pkt1(7)); -- game pad joystick
-					data_byte2  		<= data_pkt1;
-					---
-					if (data_pkt1 = "01111111" OR data_pkt1 = "11111111" OR data_pkt1 = "00000000") then
-						data_valid_temp 			<= '1';
-					else
-						data_valid_temp 			<= '0';
-					end if;
-				else 
-					-- data_valid_temp 			<= '1';
-					if (data_pkt1 = "10000000") then
-						joystick_updown 	<= '1'; -- either up or down
-					elsif (data_pkt1 = "00000000") then
-						joystick_updown 	<= '0'; -- left
-						joyright_temp(1 downto 0) 	<= "10";
-					elsif (data_pkt1 = "11111111") then
-						joystick_updown 	<= '0'; -- left
-						joyright_temp(1 downto 0) 	<= "01";					
-					end if;
-				end if;
-
-				---
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte3;		
-		  --------------  byte3  -------------------------
-		  when wait_read_byte3 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte3;	  
-					else
-						usb_manage		<= read_byte3;
-					end if;	
-				end if;
-		  ------------------ read_byte3 ---------------------
-		  when read_byte3 =>
-				if joystick_type = '1' then
-					joyright_temp(3 downto 2) 	<= NOT (data_pkt1(0) &  NOT data_pkt1(0));
-				else
-					--- not actif
-					if (data_byte2 = "01111111" AND data_pkt1 = "01111111") then 
-						joyleft_temp(3 downto 0) <= "1111";
-					--- up right
-					elsif (data_byte2 = "11111111" AND data_pkt1 = "00000000") then 
-						joyleft_temp(3 downto 0) <= "0110";		
-					--- up left
-					elsif (data_byte2 = "00000000" AND data_pkt1 = "00000000") then 
-						joyleft_temp(3 downto 0) <= "0101";
-					--- down right
-					elsif (data_byte2 = "11111111" AND data_pkt1 = "11111111") then 
-						joyleft_temp(3 downto 0) <= "1010";
-					--- down left
-					elsif (data_byte2 = "00000000" AND data_pkt1 = "11111111") then 
-						joyleft_temp(3 downto 0) <= "1001";		
-					--- up
-					elsif (data_byte2 = "01111111" AND data_pkt1 = "00000000") then 
-						joyleft_temp(3 downto 0) <= "0111";
-					--- down
-					elsif (data_byte2 = "01111111" AND data_pkt1 = "11111111") then
-						joyleft_temp(3 downto 0) <= "1011";
-					--- right
-					elsif (data_byte2 = "11111111" AND data_pkt1 = "01111111") then
-						joyleft_temp(3 downto 0) <= "1110";
-					--- left
-					elsif (data_byte2 = "00000000" AND data_pkt1 = "01111111") then
-						joyleft_temp(3 downto 0) <= "1101";
-					else
-						-- mouse detected, 
-						mousex_temp 				 <= data_byte2;
-						mousey_temp 				 <= data_pkt1;
-						joyleft_temp(3 downto 0) <= "1111";
-						mouse_valid					 <= '1';
-					end if;		
-				end if;
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte4;		
-		  --------------  byte4  -------------------------
-		  when wait_read_byte4 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte4;	  
-					else
-						usb_manage		<= read_byte4;
-					end if;
-				end if;
-		  ------------------ read_byte4 ---------------------
-		  when read_byte4 =>
-				mouse_valid				<= '0';
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte5;		
-		  --------------  byte5  -------------------------
-		  when wait_read_byte5 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte5;	  
-					else
-						usb_manage		<= read_byte5;
-					end if;	
-				end if;
-		  ------------------ read_byte11 ---------------------
-		  when read_byte5 =>
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte6;		
-		  --------------  byte6  -------------------------
-		  when wait_read_byte6 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte6;	  
-					else
-						usb_manage		<= read_byte6;
-					end if;		
-				end if;
-		  ------------------ read_byte6 ---------------------	
-		  when read_byte6 =>
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte7; -- joystick type = gamepad
-		  --------------  byte7  -------------------------
-		  when wait_read_byte7 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte7;	  
-					else
-						usb_manage		<= read_byte7;
-					end if;	
-				end if;
-		  ------------------ read_byte7 ---------------------
-		  when read_byte7 =>
-				if data_pkt1(3 downto 0) = "1111" then  -- checking if data valid
-					joyright_temp(3 downto 0) 	<= NOT (data_pkt1(4) &  data_pkt1(6) & data_pkt1(7) &  data_pkt1(5));
-				else
-					data_valid_temp	<= '0';
-				end if;
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte8;		
-		  --------------  byte8  -------------------------
-		  when wait_read_byte8 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte8;	  
-					else
-						usb_manage		<= read_byte8;
-					end if;
-				end if;
-		  ------------------ read_byte8 ---------------------
-		  when read_byte8 =>
-				joyright_temp(7 downto 4) 	<= NOT (data_pkt1(1) &  data_pkt1(3) & data_pkt1(5) &  data_pkt1(5));
-				joyleft_temp(7 downto 4) 	<= NOT (data_pkt1(0) &  data_pkt1(2) & data_pkt1(4) &  data_pkt1(4)); 
-				read_byte_valid_c 	<= read_byte_valid;
-				counter1 				<= "11111111";
-				usb_manage				<= wait_read_byte9;		
-		  --------------  byte9  -------------------------
-		  when wait_read_byte9 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte9;	  
-					else
-						usb_manage		<= read_byte9;
-					end if;	
-				end if;
-		  ------------------ read_byte9 ---------------------
-		  when read_byte9 =>
-				--- test if analogue ON/OFF
-				if (data_pkt1 = "01000000") then 
-					-- analogue ON 
-					data_valid		<= '0';
-				elsif (data_pkt1 = "00000000" OR data_pkt1 = "11000000") then
-					data_valid		<= data_valid_temp;
-				else
-					data_valid		<= '0';
-				end if;
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte10;		
-		  --------------  byte10  -------------------------
-		  when wait_read_byte10 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte10;	  
-					else
-						usb_manage		<= read_byte10;
-					end if;	
-				end if;	
-		  ------------------ read_byte10 ---------------------
-		  when read_byte10 =>
-				read_byte_valid_c <= read_byte_valid;
-				counter1 			<= "11111111";
-				usb_manage			<= wait_read_byte11;		
-		  --------------  byte11  -------------------------
-		  when wait_read_byte11 =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if read_byte_valid = read_byte_valid_c  then
-						usb_manage		<= wait_read_byte11;	  
-					else
-						usb_manage		<= read_byte11;
-					end if;	
-				end if;
-		  ------------------ read_byte11 ---------------------
-		  when read_byte11 =>
-				counter1				<= "00001111";
-				usb_manage			<= wait40;				
-	
-		  ----------------------------------------------------
-		  ------------  check CRC  ---------------------------
-		  ----------------------------------------------------
-		  ------------- if valid data then issue an ack   ----
-        when wait40 =>
-				counter1					<= counter1 - 1;
-				if counter1	= "00000000" then
-					counter1				<= "11111111";
-					usb_manage			<= send_getreport_ack;		  
-				else
-					usb_manage			<=wait40;
-				end if;	
-		  -------------- read the next bytes to send ----------
-        when send_getreport_ack     =>  
-				counter2				<= "1111";
-				start_sendcom		<= '1';
-				address_start		<= "001000000"; -- 0x40  -   - 2 bytes
-				counter1 				<= "11111111";
-				usb_manage			<= send_getreport_ack_end; 
-		  -------------- wait for completion of sending frame ----------------			 
-		  when send_getreport_ack_end =>
-				counter1				<= counter1 - 1;
-				if detach = '1' OR counter1 = "00000000" then
-					usb_manage   	<= idle;
-				else
-					if send_frame = '1' then  
-						start_sendcom			<= '0';
-						counter1_3ms			<= "100000100011011";
-						counter2					<= "1111";
-						usb_manage				<= crc_complete;  -- 
-					else 
-						usb_manage				<= send_getreport_ack_end;
-					end if;	
-				end if;
-		  ------------------------------  CRC check   -----------------------------
-		  when crc_complete	=>
-				if detach = '1' then
-					usb_manage   	<= idle;
-				else
-					data_available		<=	'1';
-					usb_manage			<= wait20;
-				end if;
-		  when others  => 
-			 usb_manage 		<= idle;		 
-	   end case;
-    end if;
-  end process; 
-
-  --------------------------------------------------------------------------
-  ------  detach detection process
-  --------------------------------------------------------------------------
-  process (
-  usb_lock, 
-  CLOCK12MHz,
-  detach_ack,
-  counterdetach,
-  dplus_buf2,
-  dminus_buf2
-  ) is
-  begin
-    if (usb_lock = '0') then  
-		counterdetach		<= "1111";
-		detach 				<= '0';
-		usb_detach			<= idle;
-    elsif (falling_edge(CLOCK12MHz)) then     
-      case usb_detach is
-        -------------- wait for the start trigger ----------------
-			when idle		=>   
-				if dplus_buf2 = '0' AND dminus_buf2 = '0' then	
-					counterdetach		<= "1111";
-					usb_detach			<= detach_start;	
-				else 
-					usb_detach			<= idle;
-				end if; -- 
-				
-		  -------------- read the rom first byte ----------------
-        when detach_start     =>              
-				if dplus_buf2 = '0' AND dminus_buf2 = '0' then
-					if counterdetach = "0000" then
-						usb_detach		<= detach_valid;	
-					else
-						usb_detach		<= detach_start;
-						counterdetach	<= counterdetach - 1;
-					end if;
-				else
-					counterdetach		<= "1111";
-					usb_detach			<= idle;
-				end if;
-		  -------------- wait for 30ms ----------------
-        when detach_valid     =>              
-				detach				<= '1';
-				usb_detach			<= detach_wait;	
-
-		  -------------- wait for 30ms ----------------
-        when detach_wait     =>              
-				if detach_ack	= '1' then
-					detach			<= '0';
-					counterdetach	<= "1111";
-					usb_detach		<= idle;				
-				else
-					usb_detach		<= detach_wait;
-				end if;
-		  when others  => 
-				counterdetach		<= "1111";
-				usb_detach 			<= idle;		 
-	   end case;
-    end if;
-  end process;	  
-  
-  ------------------------------------------------------
-  ------  state machine for the mouse
-  ------------------------------------------------------
-  process (usb_lock, clk_usb, CLOCK12MHz) is
-  begin
-    if (usb_lock = '0') then                                 
-      mouse_counter1			<= "000000000";
-		mousex_ctr				<= "000000000000";
-		mousey_ctr				<= "000000000000";
-		mouse_state				<= idle;
-    elsif (rising_edge(CLOCK12MHz) AND mouse_valid = '1') then     
-      case mouse_state is
-        -------------- xxxxxxxxxxxxxxxxxxxxxxxxxxx ----------------
-			when idle		=>   
-				if (mouse_counter1 = "000000000") then					-- 
-					mouse_state		<= state1;				-- 
-				else 
-					mouse_counter1	<= mouse_counter1 - 1;
-					mouse_state		<= idle;					-- 
-				end if;
-        -------------- xxxxxxxxxxxxxxxxxxxxxxxxxxx ----------------
-			when state1	=>   
-				-- 
-				IF ((mousex_temp /= "10000000")) THEN
-					IF ((mousex_temp(7) = '1') OR (mousex_temp = "01111110")) THEN
-					-- move right
-					mousex_ctr		<= mousex_ctr + ("00000000" & mousex_temp(7 downto 4));
-					ELSE
-					-- move left
-					mousex_ctr		<= mousex_ctr - ("00000000" & NOT(mousex_temp(7 downto 4)));
-					END IF;
-				END IF;
-				IF (mousey_temp /= "10000000") THEN
-					IF ((mousey_temp(7) = '0')) THEN
-						--IF ((mousex_temp /= "01111110") AND (mousex_temp /= "11111110")) THEN
-							-- move up
-							mousey_ctr		<= mousey_ctr + ("00000000" & NOT (mousey_temp(7 downto 4)));
-						--END IF;
-					ELSE
-					-- move down
-					mousey_ctr		<= mousey_ctr - ("00000000" & mousey_temp(7 downto 4));
-					END IF;
-				END IF;
-				mousex_out		<= mousex_ctr;
-				mousey_out		<= mousey_ctr;
-				mouse_counter1	<= "000000111";
-				mouse_state		<= idle;			
-			when others => 
-				mouse_state 	<= idle;		 
-	   end case;
-    end if;
-  end process; 		 
-  
-  
-  
-------------------------------------------------------------
-end arch;
\ No newline at end of file
Index: mcctv/usb/rom_com.cmp
===================================================================
--- mcctv/usb/rom_com.cmp	(revision 281)
+++ mcctv/usb/rom_com.cmp	(nonexistent)
@@ -1,24 +0,0 @@
---Copyright (C) 1991-2010 Altera Corporation
---Your use of Altera Corporation's design tools, logic functions 
---and other software and tools, and its AMPP partner logic 
---functions, and any output files from any of the foregoing 
---(including device programming or simulation files), and any 
---associated documentation or information are expressly subject 
---to the terms and conditions of the Altera Program License 
---Subscription Agreement, Altera MegaCore Function License 
---Agreement, or other applicable license agreement, including, 
---without limitation, that your use is for the sole purpose of 
---programming logic devices manufactured by Altera and sold by 
---Altera or its authorized distributors.  Please refer to the 
---applicable agreement for further details.
-
-
-component rom_com
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock		: IN STD_LOGIC  := '1';
-		rden		: IN STD_LOGIC  := '1';
-		q		: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-end component;
Index: mcctv/usb/USB_INTF1.vhd
===================================================================
--- mcctv/usb/USB_INTF1.vhd	(revision 281)
+++ mcctv/usb/USB_INTF1.vhd	(nonexistent)
@@ -1,70 +0,0 @@
---This file contains 2 Entities making up an HID USB interface
---===========================================================================
---  USB Interface module - Copywrite Johns Hopkins University ECE Dept.
---This code may be used and freely distributed as long as the JHU credit is retained.
---============================================================================
---Implements an HID USB enumeration and communication through a tranceiver implemented
---in the FPGA to directly drive the USB diferential pair data lines.
---On an XESS xst-2 or -3 board this requires a connection of the usb cable wires with a 1.5K 
---pullup to 3.3V on the D+ or D- line, and the data lines connecting to 2 FPGA pins.
---The bit rate is determined by which line has the pullup. This code is currently set up
---for usb full speed (12 Mhz) operation, but can be easily changed for 1.5Mhz low speed.
-
---The inputs and outputs are arrays(1 to 8) of std_logic_vector(7 downto 0).
---These arrays are the data packets sent and received via USB reports. The I/O
---buffers for USB transactions in the tranceiver are also 8 byte arrays.
-
--- The interface acts as an HID class, thus only control and interrupt xfers are possible.
--- Any commented page references are to "USB Complete", 3rd Edition, by Jan Axelson
---
--- Author: Robert Jenkins
--- Last Modification: Jan 30, 2009
---==============================================================================
-library IEEE;
-use IEEE.std_logic_1164.all;
-use IEEE.numeric_std.all;
-use WORK.USBF_Declares.all;             --Package containing declarations needed by the USB interface        
-
---------------------------------------------------------------------------------
-entity USBF_IFC1 is
-  port(
-    clk_usb     	 	: in    std_logic;      --100MHz project clock
-	 pll_lock			: in std_logic;
-    reset       	: in    std_logic;      -- usually tied to the XST reset button.
-    ----USB CONNECTIONS                 -----------------------------------------
-    dplus       	: inout std_logic;      --differential + line to/from usb hub(pulled up to 3.3)
-    dminus      	: inout std_logic;      --differential minus line to/from usb hub
-    ------------------------------------------------------------
-	 joyright_out 	: out   std_logic_vector(7 downto 0);
-	 joyleft_out 	: out   std_logic_vector(7 downto 0);
-	 mousex_out		: out   std_logic_vector(11 downto 0);
-	 mousey_out		: out   std_logic_vector(11 downto 0)
-    );
-end USBF_IFC1;
-----------------------------------------------------------------------
-
-architecture arch of USBF_IFC1 is
-
-begin
-
-  UDRVR : USB_DRVR1                   
-    port map(
-		clk_usb       	=> clk_usb, 
-		pll_lock			=> pll_lock,
-		reset 			=> reset, 
-		dplus 			=> dplus, 
-		dminus 			=> dminus,
-		joyright_out	=> joyright_out,
-		joyleft_out		=> joyleft_out,
-		mousex_out		=> mousex_out,
-		mousey_out		=> mousey_out
-		);
-
----=============================
-end arch;  --END of USBF_IFC
----=============================
-
-
-
-
-
Index: mcctv/usb/USB_INTF2.vhd
===================================================================
--- mcctv/usb/USB_INTF2.vhd	(revision 281)
+++ mcctv/usb/USB_INTF2.vhd	(nonexistent)
@@ -1,70 +0,0 @@
---This file contains 2 Entities making up an HID USB interface
---===========================================================================
---  USB Interface module - Copywrite Johns Hopkins University ECE Dept.
---This code may be used and freely distributed as long as the JHU credit is retained.
---============================================================================
---Implements an HID USB enumeration and communication through a tranceiver implemented
---in the FPGA to directly drive the USB diferential pair data lines.
---On an XESS xst-2 or -3 board this requires a connection of the usb cable wires with a 1.5K 
---pullup to 3.3V on the D+ or D- line, and the data lines connecting to 2 FPGA pins.
---The bit rate is determined by which line has the pullup. This code is currently set up
---for usb full speed (12 Mhz) operation, but can be easily changed for 1.5Mhz low speed.
-
---The inputs and outputs are arrays(1 to 8) of std_logic_vector(7 downto 0).
---These arrays are the data packets sent and received via USB reports. The I/O
---buffers for USB transactions in the tranceiver are also 8 byte arrays.
-
--- The interface acts as an HID class, thus only control and interrupt xfers are possible.
--- Any commented page references are to "USB Complete", 3rd Edition, by Jan Axelson
---
--- Author: Robert Jenkins
--- Last Modification: Jan 30, 2009
---==============================================================================
-library IEEE;
-use IEEE.std_logic_1164.all;
-use IEEE.numeric_std.all;
-use WORK.USBF_Declares.all;             --Package containing declarations needed by the USB interface        
-
---------------------------------------------------------------------------------
-entity USBF_IFC2 is
-  port(
-    clk_usb     	 	: in    std_logic;      --100MHz project clock
-	 pll_lock			: in std_logic;
-    reset       	: in    std_logic;      -- usually tied to the XST reset button.
-    ----USB CONNECTIONS                 -----------------------------------------
-    dplus       	: inout std_logic;      --differential + line to/from usb hub(pulled up to 3.3)
-    dminus      	: inout std_logic;      --differential minus line to/from usb hub
-    ------------------------------------------------------------
-	 joyright_out 	: out   std_logic_vector(7 downto 0);
-	 joyleft_out 	: out   std_logic_vector(7 downto 0);
-	 mousex_out		: out   std_logic_vector(11 downto 0);
-	 mousey_out		: out   std_logic_vector(11 downto 0)
-    );
-end USBF_IFC2;
-----------------------------------------------------------------------
-
-architecture arch of USBF_IFC2 is
-
-begin
-
-  UDRVR : USB_DRVR2                   
-    port map(
-		clk_usb       	=> clk_usb, 
-		pll_lock			=> pll_lock,
-		reset 			=> reset, 
-		dplus 			=> dplus, 
-		dminus 			=> dminus,
-		joyright_out	=> joyright_out,
-		joyleft_out		=> joyleft_out,
-		mousex_out		=> mousex_out,
-		mousey_out		=> mousey_out
-		);
-
----=============================
-end arch;  --END of USBF_IFC
----=============================
-
-
-
-
-
Index: mcctv/usb/rom_com.vhd
===================================================================
--- mcctv/usb/rom_com.vhd	(revision 281)
+++ mcctv/usb/rom_com.vhd	(nonexistent)
@@ -1,173 +0,0 @@
--- megafunction wizard: %ROM: 1-PORT%
--- GENERATION: STANDARD
--- VERSION: WM1.0
--- MODULE: altsyncram 
-
--- ============================================================
--- File Name: rom_com.vhd
--- Megafunction Name(s):
--- 			altsyncram
---
--- Simulation Library Files(s):
--- 			
--- ============================================================
--- ************************************************************
--- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
---
--- 10.0 Build 262 08/18/2010 SP 1 SJ Web Edition
--- ************************************************************
-
-
---Copyright (C) 1991-2010 Altera Corporation
---Your use of Altera Corporation's design tools, logic functions 
---and other software and tools, and its AMPP partner logic 
---functions, and any output files from any of the foregoing 
---(including device programming or simulation files), and any 
---associated documentation or information are expressly subject 
---to the terms and conditions of the Altera Program License 
---Subscription Agreement, Altera MegaCore Function License 
---Agreement, or other applicable license agreement, including, 
---without limitation, that your use is for the sole purpose of 
---programming logic devices manufactured by Altera and sold by 
---Altera or its authorized distributors.  Please refer to the 
---applicable agreement for further details.
-
-
-LIBRARY ieee;
-USE ieee.std_logic_1164.all;
-
-LIBRARY altera_mf;
-USE altera_mf.all;
-
-ENTITY rom_com IS
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock		: IN STD_LOGIC  := '1';
-		rden		: IN STD_LOGIC  := '1';
-		q		: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-END rom_com;
-
-
-ARCHITECTURE SYN OF rom_com IS
-
-	SIGNAL sub_wire0	: STD_LOGIC_VECTOR (7 DOWNTO 0);
-
-
-
-	COMPONENT altsyncram
-	GENERIC (
-		address_aclr_a		: STRING;
-		clock_enable_input_a		: STRING;
-		clock_enable_output_a		: STRING;
-		init_file		: STRING;
-		intended_device_family		: STRING;
-		lpm_hint		: STRING;
-		lpm_type		: STRING;
-		numwords_a		: NATURAL;
-		operation_mode		: STRING;
-		outdata_aclr_a		: STRING;
-		outdata_reg_a		: STRING;
-		widthad_a		: NATURAL;
-		width_a		: NATURAL;
-		width_byteena_a		: NATURAL
-	);
-	PORT (
-			address_a	: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-			clock0	: IN STD_LOGIC ;
-			q_a	: OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
-			rden_a	: IN STD_LOGIC 
-	);
-	END COMPONENT;
-
-BEGIN
-	q    <= sub_wire0(7 DOWNTO 0);
-
-	altsyncram_component : altsyncram
-	GENERIC MAP (
-		address_aclr_a => "NONE",
-		clock_enable_input_a => "BYPASS",
-		clock_enable_output_a => "BYPASS",
-		init_file => "./usb/rom_com.mif",
-		intended_device_family => "Cyclone III",
-		lpm_hint => "ENABLE_RUNTIME_MOD=YES,INSTANCE_NAME=NONE",
-		lpm_type => "altsyncram",
-		numwords_a => 512,
-		operation_mode => "ROM",
-		outdata_aclr_a => "NONE",
-		outdata_reg_a => "UNREGISTERED",
-		widthad_a => 9,
-		width_a => 8,
-		width_byteena_a => 1
-	)
-	PORT MAP (
-		address_a => address,
-		clock0 => clock,
-		rden_a => rden,
-		q_a => sub_wire0
-	);
-
-
-
-END SYN;
-
--- ============================================================
--- CNX file retrieval info
--- ============================================================
--- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
--- Retrieval info: PRIVATE: AclrAddr NUMERIC "0"
--- Retrieval info: PRIVATE: AclrByte NUMERIC "0"
--- Retrieval info: PRIVATE: AclrOutput NUMERIC "0"
--- Retrieval info: PRIVATE: BYTE_ENABLE NUMERIC "0"
--- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
--- Retrieval info: PRIVATE: BlankMemory NUMERIC "0"
--- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
--- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
--- Retrieval info: PRIVATE: Clken NUMERIC "0"
--- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
--- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
--- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
--- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
--- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "1"
--- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
--- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
--- Retrieval info: PRIVATE: MIFfilename STRING "./usb/rom_com.mif"
--- Retrieval info: PRIVATE: NUMWORDS_A NUMERIC "512"
--- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
--- Retrieval info: PRIVATE: RegAddr NUMERIC "1"
--- Retrieval info: PRIVATE: RegOutput NUMERIC "0"
--- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
--- Retrieval info: PRIVATE: SingleClock NUMERIC "1"
--- Retrieval info: PRIVATE: UseDQRAM NUMERIC "0"
--- Retrieval info: PRIVATE: WidthAddr NUMERIC "9"
--- Retrieval info: PRIVATE: WidthData NUMERIC "8"
--- Retrieval info: PRIVATE: rden NUMERIC "1"
--- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
--- Retrieval info: CONSTANT: ADDRESS_ACLR_A STRING "NONE"
--- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
--- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
--- Retrieval info: CONSTANT: INIT_FILE STRING "./usb/rom_com.mif"
--- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
--- Retrieval info: CONSTANT: LPM_HINT STRING "ENABLE_RUNTIME_MOD=YES,INSTANCE_NAME=NONE"
--- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
--- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "512"
--- Retrieval info: CONSTANT: OPERATION_MODE STRING "ROM"
--- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
--- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
--- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "9"
--- Retrieval info: CONSTANT: WIDTH_A NUMERIC "8"
--- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
--- Retrieval info: USED_PORT: address 0 0 9 0 INPUT NODEFVAL "address[8..0]"
--- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
--- Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
--- Retrieval info: USED_PORT: rden 0 0 0 0 INPUT VCC "rden"
--- Retrieval info: CONNECT: @address_a 0 0 9 0 address 0 0 9 0
--- Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
--- Retrieval info: CONNECT: @rden_a 0 0 0 0 rden 0 0 0 0
--- Retrieval info: CONNECT: q 0 0 8 0 @q_a 0 0 8 0
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.vhd TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.inc FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.cmp TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.bsf FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com_inst.vhd TRUE
Index: mcctv/usb/USBF_Declares.vhd
===================================================================
--- mcctv/usb/USBF_Declares.vhd	(revision 281)
+++ mcctv/usb/USBF_Declares.vhd	(nonexistent)
@@ -1,91 +0,0 @@
---==============================================================================
---  USB Interface Declares
-------------------------------------------------------------------
---Copywrite Johns Hopkins University ECE department
---This software may be freely used and modified as long as this header is retained. 
-------------------------------------------------------------------
---Description: Defines constants and components used to make the FPGA act as a 
---  HID USB peripheral, and communicate over the D+/D- lines with the host.
---   
--- Authors: Brian Duddie, Brian Miller, R.E. Jenkins
--- Last Modification: Jan 3, 2009
---==============================================================================
-library ieee;
-use ieee.std_logic_1164.all;
-use ieee.numeric_std.all;
-
---==================================================================
-package USBF_Declares is
---==================================================================
-
---====================================================
---USB_DRVR COMPONENT Declaration        ----------------------
---====================================================
-  component USB_DRVR1 is
-                       port(
-                         clk_usb       : in    std_logic;  --12MHz clock
-								 pll_lock		: in    std_logic;
-                         reset         : in    std_logic;  --fpga reset
-                         dminus        : inout std_logic;  -- USB differential D+ line
-                         dplus         : inout std_logic;  -- USB differential D+ line
-								 joyright_out 	: out   std_logic_vector(7 downto 0);
-								 joyleft_out 	: out   std_logic_vector(7 downto 0);
-								 mousex_out		: out   std_logic_vector(11 downto 0);
-								 mousey_out		: out   std_logic_vector(11 downto 0)
-                         );
-  end component;
--------------------------------------------------------
-  component USBF_IFC1 is
-                       port(
-                         clk_usb       : in    std_logic;  --12MHz clock
-								 pll_lock		: in    std_logic;
-                         reset         : in    std_logic;  -- XST reset push button
-                         ----USB CONNECTIONS  ---------
-                         dplus         : inout std_logic;
-                         dminus        : inout std_logic;
-                         ----------------------------------
-								 joyright_out 	: out   std_logic_vector(7 downto 0);
-								 joyleft_out 	: out   std_logic_vector(7 downto 0);
-								 mousex_out		: out   std_logic_vector(11 downto 0);
-								 mousey_out		: out   std_logic_vector(11 downto 0)
-                         );
-  end component;
-  
---====================================================
---USB_DRVR COMPONENT Declaration        ----------------------
---====================================================
-  component USB_DRVR2 is
-                       port(
-                         clk_usb       : in    std_logic;  --12MHz clock
-								 pll_lock		: in    std_logic;
-                         reset         : in    std_logic;  --fpga reset
-                         dminus        : inout std_logic;  -- USB differential D+ line
-                         dplus         : inout std_logic;  -- USB differential D+ line
-								 joyright_out 	: out   std_logic_vector(7 downto 0);
-								 joyleft_out 	: out   std_logic_vector(7 downto 0);
-								 mousex_out		: out   std_logic_vector(11 downto 0);
-								 mousey_out		: out   std_logic_vector(11 downto 0)
-                         );
-  end component;
--------------------------------------------------------
-  component USBF_IFC2 is
-                       port(
-                         clk_usb       : in    std_logic;  --12MHz clock
-								 pll_lock		: in    std_logic;
-                         reset         : in    std_logic;  -- XST reset push button
-                         ----USB CONNECTIONS  ---------
-                         dplus         : inout std_logic;
-                         dminus        : inout std_logic;
-                         ----------------------------------
-								 joyright_out 	: out   std_logic_vector(7 downto 0);
-								 joyleft_out 	: out   std_logic_vector(7 downto 0);
-								 mousex_out		: out   std_logic_vector(11 downto 0);
-								 mousey_out		: out   std_logic_vector(11 downto 0)
-                         );
-  end component;
-
---==============================================================================
-END PACKAGE USBF_Declares;
---==============================================================================
-
---==============================================================================
Index: mcctv/usb/rom_com.qip
===================================================================
--- mcctv/usb/rom_com.qip	(revision 281)
+++ mcctv/usb/rom_com.qip	(nonexistent)
@@ -1,5 +0,0 @@
-set_global_assignment -name IP_TOOL_NAME "ROM: 1-PORT"
-set_global_assignment -name IP_TOOL_VERSION "10.0"
-set_global_assignment -name VHDL_FILE [file join $::quartus(qip_path) "rom_com.vhd"]
-set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "rom_com_inst.vhd"]
-set_global_assignment -name MISC_FILE [file join $::quartus(qip_path) "rom_com.cmp"]
Index: mcctv/usb/PCK_CRC16_D8.vhd
===================================================================
--- mcctv/usb/PCK_CRC16_D8.vhd	(revision 281)
+++ mcctv/usb/PCK_CRC16_D8.vhd	(nonexistent)
@@ -1,70 +0,0 @@
---------------------------------------------------------------------------------
--- Copyright (C) 1999-2008 Easics NV.
--- This source file may be used and distributed without restriction
--- provided that this copyright statement is not removed from the file
--- and that any derivative work contains the original copyright notice
--- and the associated disclaimer.
---
--- THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
--- OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
--- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
---
--- Purpose : synthesizable CRC function
---   * polynomial: (0 2 15 16)
---   * data width: 8
---
--- Info : tools@easics.be
---        http://www.easics.com
---------------------------------------------------------------------------------
-library ieee;
-use ieee.std_logic_1164.all;
-
-package PCK_CRC16_D8 is
-  -- polynomial: (0 2 15 16)
-  -- data width: 8
-  -- convention: the first serial bit is D[7]
-  function nextCRC16_D8
-    (Data: std_logic_vector(7 downto 0);
-     crc:  std_logic_vector(15 downto 0))
-    return std_logic_vector;
-end PCK_CRC16_D8;
-
-
-package body PCK_CRC16_D8 is
-
-  -- polynomial: (0 2 15 16)
-  -- data width: 8
-  -- convention: the first serial bit is D[7]
-  function nextCRC16_D8
-    (Data: std_logic_vector(7 downto 0);
-     crc:  std_logic_vector(15 downto 0))
-    return std_logic_vector is
-
-    variable d:      std_logic_vector(7 downto 0);
-    variable c:      std_logic_vector(15 downto 0);
-    variable newcrc: std_logic_vector(15 downto 0);
-
-  begin
-    d := Data;
-    c := crc;
-
-    newcrc(0) := d(7) xor d(6) xor d(5) xor d(4) xor d(3) xor d(2) xor d(1) xor d(0) xor c(8) xor c(9) xor c(10) xor c(11) xor c(12) xor c(13) xor c(14) xor c(15);
-    newcrc(1) := d(7) xor d(6) xor d(5) xor d(4) xor d(3) xor d(2) xor d(1) xor c(9) xor c(10) xor c(11) xor c(12) xor c(13) xor c(14) xor c(15);
-    newcrc(2) := d(1) xor d(0) xor c(8) xor c(9);
-    newcrc(3) := d(2) xor d(1) xor c(9) xor c(10);
-    newcrc(4) := d(3) xor d(2) xor c(10) xor c(11);
-    newcrc(5) := d(4) xor d(3) xor c(11) xor c(12);
-    newcrc(6) := d(5) xor d(4) xor c(12) xor c(13);
-    newcrc(7) := d(6) xor d(5) xor c(13) xor c(14);
-    newcrc(8) := d(7) xor d(6) xor c(0) xor c(14) xor c(15);
-    newcrc(9) := d(7) xor c(1) xor c(15);
-    newcrc(10) := c(2);
-    newcrc(11) := c(3);
-    newcrc(12) := c(4);
-    newcrc(13) := c(5);
-    newcrc(14) := c(6);
-    newcrc(15) := d(7) xor d(6) xor d(5) xor d(4) xor d(3) xor d(2) xor d(1) xor d(0) xor c(7) xor c(8) xor c(9) xor c(10) xor c(11) xor c(12) xor c(13) xor c(14) xor c(15);
-    return newcrc;
-  end nextCRC16_D8;
-
-end PCK_CRC16_D8;
Index: mcctv/usb/rom_com1.cmp
===================================================================
--- mcctv/usb/rom_com1.cmp	(revision 281)
+++ mcctv/usb/rom_com1.cmp	(nonexistent)
@@ -1,24 +0,0 @@
---Copyright (C) 1991-2010 Altera Corporation
---Your use of Altera Corporation's design tools, logic functions 
---and other software and tools, and its AMPP partner logic 
---functions, and any output files from any of the foregoing 
---(including device programming or simulation files), and any 
---associated documentation or information are expressly subject 
---to the terms and conditions of the Altera Program License 
---Subscription Agreement, Altera MegaCore Function License 
---Agreement, or other applicable license agreement, including, 
---without limitation, that your use is for the sole purpose of 
---programming logic devices manufactured by Altera and sold by 
---Altera or its authorized distributors.  Please refer to the 
---applicable agreement for further details.
-
-
-component rom_com1
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock		: IN STD_LOGIC  := '1';
-		rden		: IN STD_LOGIC  := '1';
-		q		: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-end component;
Index: mcctv/usb/rom_com2.cmp
===================================================================
--- mcctv/usb/rom_com2.cmp	(revision 281)
+++ mcctv/usb/rom_com2.cmp	(nonexistent)
@@ -1,24 +0,0 @@
---Copyright (C) 1991-2010 Altera Corporation
---Your use of Altera Corporation's design tools, logic functions 
---and other software and tools, and its AMPP partner logic 
---functions, and any output files from any of the foregoing 
---(including device programming or simulation files), and any 
---associated documentation or information are expressly subject 
---to the terms and conditions of the Altera Program License 
---Subscription Agreement, Altera MegaCore Function License 
---Agreement, or other applicable license agreement, including, 
---without limitation, that your use is for the sole purpose of 
---programming logic devices manufactured by Altera and sold by 
---Altera or its authorized distributors.  Please refer to the 
---applicable agreement for further details.
-
-
-component rom_com2
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock		: IN STD_LOGIC  := '1';
-		rden		: IN STD_LOGIC  := '1';
-		q		: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-end component;
Index: mcctv/usb/rom_com1.vhd
===================================================================
--- mcctv/usb/rom_com1.vhd	(revision 281)
+++ mcctv/usb/rom_com1.vhd	(nonexistent)
@@ -1,178 +0,0 @@
--- megafunction wizard: %ROM: 1-PORT%
--- GENERATION: STANDARD
--- VERSION: WM1.0
--- MODULE: altsyncram 
-
--- ============================================================
--- File Name: rom_com1.vhd
--- Megafunction Name(s):
--- 			altsyncram
---
--- Simulation Library Files(s):
--- 			
--- ============================================================
--- ************************************************************
--- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
---
--- 10.0 Build 262 08/18/2010 SP 1 SJ Web Edition
--- ************************************************************
-
-
---Copyright (C) 1991-2010 Altera Corporation
---Your use of Altera Corporation's design tools, logic functions 
---and other software and tools, and its AMPP partner logic 
---functions, and any output files from any of the foregoing 
---(including device programming or simulation files), and any 
---associated documentation or information are expressly subject 
---to the terms and conditions of the Altera Program License 
---Subscription Agreement, Altera MegaCore Function License 
---Agreement, or other applicable license agreement, including, 
---without limitation, that your use is for the sole purpose of 
---programming logic devices manufactured by Altera and sold by 
---Altera or its authorized distributors.  Please refer to the 
---applicable agreement for further details.
-
-
-LIBRARY ieee;
-USE ieee.std_logic_1164.all;
-
-LIBRARY altera_mf;
-USE altera_mf.all;
-
-ENTITY rom_com1 IS
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock		: IN STD_LOGIC  := '1';
-		rden		: IN STD_LOGIC  := '1';
-		q		: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-END rom_com1;
-
-
-ARCHITECTURE SYN OF rom_com1 IS
-
-	SIGNAL sub_wire0	: STD_LOGIC_VECTOR (7 DOWNTO 0);
-
-
-
-	COMPONENT altsyncram
-	GENERIC (
-		address_aclr_a		: STRING;
-		clock_enable_input_a		: STRING;
-		clock_enable_output_a		: STRING;
-		init_file		: STRING;
-		intended_device_family		: STRING;
-		lpm_hint		: STRING;
-		lpm_type		: STRING;
-		numwords_a		: NATURAL;
-		operation_mode		: STRING;
-		outdata_aclr_a		: STRING;
-		outdata_reg_a		: STRING;
-		widthad_a		: NATURAL;
-		width_a		: NATURAL;
-		width_byteena_a		: NATURAL
-	);
-	PORT (
-			address_a	: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-			clock0	: IN STD_LOGIC ;
-			q_a	: OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
-			rden_a	: IN STD_LOGIC 
-	);
-	END COMPONENT;
-
-BEGIN
-	q    <= sub_wire0(7 DOWNTO 0);
-
-	altsyncram_component : altsyncram
-	GENERIC MAP (
-		address_aclr_a => "NONE",
-		clock_enable_input_a => "BYPASS",
-		clock_enable_output_a => "BYPASS",
-		init_file => "./usb/rom_com.mif",
-		intended_device_family => "Cyclone III",
-		lpm_hint => "ENABLE_RUNTIME_MOD=YES,INSTANCE_NAME=NONE",
-		lpm_type => "altsyncram",
-		numwords_a => 512,
-		operation_mode => "ROM",
-		outdata_aclr_a => "NONE",
-		outdata_reg_a => "UNREGISTERED",
-		widthad_a => 9,
-		width_a => 8,
-		width_byteena_a => 1
-	)
-	PORT MAP (
-		address_a => address,
-		clock0 => clock,
-		rden_a => rden,
-		q_a => sub_wire0
-	);
-
-
-
-END SYN;
-
--- ============================================================
--- CNX file retrieval info
--- ============================================================
--- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
--- Retrieval info: PRIVATE: AclrAddr NUMERIC "0"
--- Retrieval info: PRIVATE: AclrByte NUMERIC "0"
--- Retrieval info: PRIVATE: AclrOutput NUMERIC "0"
--- Retrieval info: PRIVATE: BYTE_ENABLE NUMERIC "0"
--- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
--- Retrieval info: PRIVATE: BlankMemory NUMERIC "0"
--- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
--- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
--- Retrieval info: PRIVATE: Clken NUMERIC "0"
--- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
--- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
--- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
--- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
--- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "1"
--- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
--- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
--- Retrieval info: PRIVATE: MIFfilename STRING "./usb/rom_com.mif"
--- Retrieval info: PRIVATE: NUMWORDS_A NUMERIC "512"
--- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
--- Retrieval info: PRIVATE: RegAddr NUMERIC "1"
--- Retrieval info: PRIVATE: RegOutput NUMERIC "0"
--- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
--- Retrieval info: PRIVATE: SingleClock NUMERIC "1"
--- Retrieval info: PRIVATE: UseDQRAM NUMERIC "0"
--- Retrieval info: PRIVATE: WidthAddr NUMERIC "9"
--- Retrieval info: PRIVATE: WidthData NUMERIC "8"
--- Retrieval info: PRIVATE: rden NUMERIC "1"
--- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
--- Retrieval info: CONSTANT: ADDRESS_ACLR_A STRING "NONE"
--- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
--- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
--- Retrieval info: CONSTANT: INIT_FILE STRING "./usb/rom_com.mif"
--- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
--- Retrieval info: CONSTANT: LPM_HINT STRING "ENABLE_RUNTIME_MOD=YES,INSTANCE_NAME=NONE"
--- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
--- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "512"
--- Retrieval info: CONSTANT: OPERATION_MODE STRING "ROM"
--- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
--- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
--- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "9"
--- Retrieval info: CONSTANT: WIDTH_A NUMERIC "8"
--- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
--- Retrieval info: USED_PORT: address 0 0 9 0 INPUT NODEFVAL "address[8..0]"
--- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
--- Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
--- Retrieval info: USED_PORT: rden 0 0 0 0 INPUT VCC "rden"
--- Retrieval info: CONNECT: @address_a 0 0 9 0 address 0 0 9 0
--- Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
--- Retrieval info: CONNECT: @rden_a 0 0 0 0 rden 0 0 0 0
--- Retrieval info: CONNECT: q 0 0 8 0 @q_a 0 0 8 0
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.vhd TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.inc FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.cmp TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.bsf FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com_inst.vhd TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com1.vhd TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com1.inc FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com1.cmp TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com1.bsf FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com1_inst.vhd FALSE
Index: mcctv/usb/rom_com2.vhd
===================================================================
--- mcctv/usb/rom_com2.vhd	(revision 281)
+++ mcctv/usb/rom_com2.vhd	(nonexistent)
@@ -1,178 +0,0 @@
--- megafunction wizard: %ROM: 1-PORT%
--- GENERATION: STANDARD
--- VERSION: WM1.0
--- MODULE: altsyncram 
-
--- ============================================================
--- File Name: rom_com2.vhd
--- Megafunction Name(s):
--- 			altsyncram
---
--- Simulation Library Files(s):
--- 			
--- ============================================================
--- ************************************************************
--- THIS IS A WIZARD-GENERATED FILE. DO NOT EDIT THIS FILE!
---
--- 10.0 Build 262 08/18/2010 SP 1 SJ Web Edition
--- ************************************************************
-
-
---Copyright (C) 1991-2010 Altera Corporation
---Your use of Altera Corporation's design tools, logic functions 
---and other software and tools, and its AMPP partner logic 
---functions, and any output files from any of the foregoing 
---(including device programming or simulation files), and any 
---associated documentation or information are expressly subject 
---to the terms and conditions of the Altera Program License 
---Subscription Agreement, Altera MegaCore Function License 
---Agreement, or other applicable license agreement, including, 
---without limitation, that your use is for the sole purpose of 
---programming logic devices manufactured by Altera and sold by 
---Altera or its authorized distributors.  Please refer to the 
---applicable agreement for further details.
-
-
-LIBRARY ieee;
-USE ieee.std_logic_1164.all;
-
-LIBRARY altera_mf;
-USE altera_mf.all;
-
-ENTITY rom_com2 IS
-	PORT
-	(
-		address		: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-		clock		: IN STD_LOGIC  := '1';
-		rden		: IN STD_LOGIC  := '1';
-		q		: OUT STD_LOGIC_VECTOR (7 DOWNTO 0)
-	);
-END rom_com2;
-
-
-ARCHITECTURE SYN OF rom_com2 IS
-
-	SIGNAL sub_wire0	: STD_LOGIC_VECTOR (7 DOWNTO 0);
-
-
-
-	COMPONENT altsyncram
-	GENERIC (
-		address_aclr_a		: STRING;
-		clock_enable_input_a		: STRING;
-		clock_enable_output_a		: STRING;
-		init_file		: STRING;
-		intended_device_family		: STRING;
-		lpm_hint		: STRING;
-		lpm_type		: STRING;
-		numwords_a		: NATURAL;
-		operation_mode		: STRING;
-		outdata_aclr_a		: STRING;
-		outdata_reg_a		: STRING;
-		widthad_a		: NATURAL;
-		width_a		: NATURAL;
-		width_byteena_a		: NATURAL
-	);
-	PORT (
-			address_a	: IN STD_LOGIC_VECTOR (8 DOWNTO 0);
-			clock0	: IN STD_LOGIC ;
-			q_a	: OUT STD_LOGIC_VECTOR (7 DOWNTO 0);
-			rden_a	: IN STD_LOGIC 
-	);
-	END COMPONENT;
-
-BEGIN
-	q    <= sub_wire0(7 DOWNTO 0);
-
-	altsyncram_component : altsyncram
-	GENERIC MAP (
-		address_aclr_a => "NONE",
-		clock_enable_input_a => "BYPASS",
-		clock_enable_output_a => "BYPASS",
-		init_file => "./usb/rom_com.mif",
-		intended_device_family => "Cyclone III",
-		lpm_hint => "ENABLE_RUNTIME_MOD=YES,INSTANCE_NAME=NONE",
-		lpm_type => "altsyncram",
-		numwords_a => 512,
-		operation_mode => "ROM",
-		outdata_aclr_a => "NONE",
-		outdata_reg_a => "UNREGISTERED",
-		widthad_a => 9,
-		width_a => 8,
-		width_byteena_a => 1
-	)
-	PORT MAP (
-		address_a => address,
-		clock0 => clock,
-		rden_a => rden,
-		q_a => sub_wire0
-	);
-
-
-
-END SYN;
-
--- ============================================================
--- CNX file retrieval info
--- ============================================================
--- Retrieval info: PRIVATE: ADDRESSSTALL_A NUMERIC "0"
--- Retrieval info: PRIVATE: AclrAddr NUMERIC "0"
--- Retrieval info: PRIVATE: AclrByte NUMERIC "0"
--- Retrieval info: PRIVATE: AclrOutput NUMERIC "0"
--- Retrieval info: PRIVATE: BYTE_ENABLE NUMERIC "0"
--- Retrieval info: PRIVATE: BYTE_SIZE NUMERIC "8"
--- Retrieval info: PRIVATE: BlankMemory NUMERIC "0"
--- Retrieval info: PRIVATE: CLOCK_ENABLE_INPUT_A NUMERIC "0"
--- Retrieval info: PRIVATE: CLOCK_ENABLE_OUTPUT_A NUMERIC "0"
--- Retrieval info: PRIVATE: Clken NUMERIC "0"
--- Retrieval info: PRIVATE: IMPLEMENT_IN_LES NUMERIC "0"
--- Retrieval info: PRIVATE: INIT_FILE_LAYOUT STRING "PORT_A"
--- Retrieval info: PRIVATE: INIT_TO_SIM_X NUMERIC "0"
--- Retrieval info: PRIVATE: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
--- Retrieval info: PRIVATE: JTAG_ENABLED NUMERIC "1"
--- Retrieval info: PRIVATE: JTAG_ID STRING "NONE"
--- Retrieval info: PRIVATE: MAXIMUM_DEPTH NUMERIC "0"
--- Retrieval info: PRIVATE: MIFfilename STRING "./usb/rom_com.mif"
--- Retrieval info: PRIVATE: NUMWORDS_A NUMERIC "512"
--- Retrieval info: PRIVATE: RAM_BLOCK_TYPE NUMERIC "0"
--- Retrieval info: PRIVATE: RegAddr NUMERIC "1"
--- Retrieval info: PRIVATE: RegOutput NUMERIC "0"
--- Retrieval info: PRIVATE: SYNTH_WRAPPER_GEN_POSTFIX STRING "0"
--- Retrieval info: PRIVATE: SingleClock NUMERIC "1"
--- Retrieval info: PRIVATE: UseDQRAM NUMERIC "0"
--- Retrieval info: PRIVATE: WidthAddr NUMERIC "9"
--- Retrieval info: PRIVATE: WidthData NUMERIC "8"
--- Retrieval info: PRIVATE: rden NUMERIC "1"
--- Retrieval info: LIBRARY: altera_mf altera_mf.altera_mf_components.all
--- Retrieval info: CONSTANT: ADDRESS_ACLR_A STRING "NONE"
--- Retrieval info: CONSTANT: CLOCK_ENABLE_INPUT_A STRING "BYPASS"
--- Retrieval info: CONSTANT: CLOCK_ENABLE_OUTPUT_A STRING "BYPASS"
--- Retrieval info: CONSTANT: INIT_FILE STRING "./usb/rom_com.mif"
--- Retrieval info: CONSTANT: INTENDED_DEVICE_FAMILY STRING "Cyclone III"
--- Retrieval info: CONSTANT: LPM_HINT STRING "ENABLE_RUNTIME_MOD=YES,INSTANCE_NAME=NONE"
--- Retrieval info: CONSTANT: LPM_TYPE STRING "altsyncram"
--- Retrieval info: CONSTANT: NUMWORDS_A NUMERIC "512"
--- Retrieval info: CONSTANT: OPERATION_MODE STRING "ROM"
--- Retrieval info: CONSTANT: OUTDATA_ACLR_A STRING "NONE"
--- Retrieval info: CONSTANT: OUTDATA_REG_A STRING "UNREGISTERED"
--- Retrieval info: CONSTANT: WIDTHAD_A NUMERIC "9"
--- Retrieval info: CONSTANT: WIDTH_A NUMERIC "8"
--- Retrieval info: CONSTANT: WIDTH_BYTEENA_A NUMERIC "1"
--- Retrieval info: USED_PORT: address 0 0 9 0 INPUT NODEFVAL "address[8..0]"
--- Retrieval info: USED_PORT: clock 0 0 0 0 INPUT VCC "clock"
--- Retrieval info: USED_PORT: q 0 0 8 0 OUTPUT NODEFVAL "q[7..0]"
--- Retrieval info: USED_PORT: rden 0 0 0 0 INPUT VCC "rden"
--- Retrieval info: CONNECT: @address_a 0 0 9 0 address 0 0 9 0
--- Retrieval info: CONNECT: @clock0 0 0 0 0 clock 0 0 0 0
--- Retrieval info: CONNECT: @rden_a 0 0 0 0 rden 0 0 0 0
--- Retrieval info: CONNECT: q 0 0 8 0 @q_a 0 0 8 0
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.vhd TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.inc FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.cmp TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com.bsf FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com_inst.vhd TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com2.vhd TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com2.inc FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com2.cmp TRUE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com2.bsf FALSE
--- Retrieval info: GEN_FILE: TYPE_NORMAL rom_com2_inst.vhd FALSE
