extension_pack



------------------------------------------------------------------------------
-- 
--  author : Michael Bills (mb3072@xxxxxxxxxxx)
--
--  description : This package is a companion to extension_pack.
--                It was seperated out due to its size.
--
--                
--
--          
--  Copyright (c) 2005 by Michael Bills
--
--  Permission to use, copy, modify, distribute, and sell this source code
--  for any purpose is hereby granted without fee, provided that 
--  the above copyright notices and this permission notice appear
--  in all copies of this source code. 
-- 
--  THIS SOURCE CODE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
--  EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, 
--  ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
--
--  THE USER OF THIS SOURCE CODE ASSUMES ALL LIABILITY FOR THEIR USE
--  OF THIS SOURCE CODE. 
--
--  IN NO EVENT SHALL MICHAEL BILLS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, 
--  INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
--  RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER OR NOT ADVISED OF
--  THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING 
--  OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. 
--
------------------------------------------------------------------------------

library ieee;
use ieee.std_logic_1164.all;

------------------------------------------------------------------------------
package extension_pack_constants is
------------------------------------------------------------------------------


------------------------------------------------------------------------------
-- Constant Declarations
------------------------------------------------------------------------------
-- count_for_time base size (-60 means the timebase = 10E-60 seconds)
-- this value should be increased if round off error occurs
-- in a value computed by the function "count_for_time" or if 
-- array length errors similar to this occur:
-- # ** Fatal: (vsim-3420) Array lengths do not match. Left is (96 downto 0). Right is (97 downto 0).
--
-- This value must be smaller than MAX_VECT_SIZE by a factor of 4 for
-- logic vectors 2 bits long and it must be smaller by a factor of 3.5 for
-- logic vectors longer than 2 bits

constant CFT_BASE_SIZE : integer := -30;


-- this value represents the largest size a logic vector may be for certain
-- functions and procedures in this package. It is used to set upper loop
-- limits for non-deterministic values thus avoiding the use of access
-- types and enabling the functions to be used for synthesizeable code.
--
-- This value may be increased (as high as natural'high will allow) 
-- if a larger value needs to be represented, or it may be decreased
-- if compile time is excessive by modifying the CFT_BASE_SIZE constant

constant MAX_VECT_SIZE : natural := (-CFT_BASE_SIZE)*4;  







type LFSR_Polynomial_Exponents_type is array(1 to 168) of string(1 to 20);


-- http://direct.xilinx.com/bvdocs/appnotes/xapp052.pdf
-- must be both primitive and prime to give a sequence of lenth 2**N-1
constant LFSR_Polynomial_Exponents : LFSR_Polynomial_Exponents_type :=(
"1                   ","2,1                 ","3,2                 ","4,3                 ","5,3                 ","6,5                 ","7,6                 ","8,6,5,4             ","9,5                 ","10,7                ",
"11,9                ","12,6,4,1            ","13,4,3,1            ","14,5,3,1            ","15,14               ","16,15,13,4          ","17,14               ","18,11               ","19,6,2,1            ","20,17               ",
"21,19               ","22,21               ","23,18               ","24,23,22,17         ","25,22               ","26,6,2,1            ","27,5,2,1            ","28,25               ","29,27               ","30,6,4,1            ",
"31,28               ","32,22,2,1           ","33,20               ","34,27,2,1           ","35,33               ","36,25               ","37,5,4,3,2,1        ","38,6,5,1            ","39,35               ","40,38,21,19         ",
"41,38               ","42,41,20,19         ","43,42,38,37         ","44,43,18,17         ","45,44,42,41         ","46,45,26,25         ","47,42               ","48,47,21,20         ","49,40               ","50,49,24,23         ",
"51,50,36,35         ","52,49               ","53,52,38,37         ","54,53,18,17         ","55,31               ","56,55,35,34         ","57,50               ","58,39               ","59,58,38,37         ","60,59               ",
"61,60,46,45         ","62,61,6,5           ","63,62               ","64,63,61,60         ","65,47               ","66,65,57,56         ","67,66,58,57         ","68,59               ","69,67,42,40         ","70,69,55,54         ",
"71,65               ","72,66,25,19         ","73,48               ","74,73,59,58         ","75,74,65,64         ","76,75,41,40         ","77,76,47,46         ","78,77,59,58         ","79,70               ","80,79,43,42         ",
"81,77               ","82,79,47,44         ","83,82,38,37         ","84,71               ","85,84,58,57         ","86,85,74,73         ","87,74               ","88,87,17,16         ","89,51               ","90,89,72,71         ",
"91,90,8,7           ","92,91,80,79         ","93,91               ","94,73               ","95,84               ","96,94,49,47         ","97,91               ","98,87               ","99,97,54,52         ","100,63              ",
"101,100,95,94       ","102,101,36,35       ","103,94              ","104,103,94,93       ","105,89              ","106,91              ","107,105,44,42       ","108,77              ","109,108,103,102     ","110,109,98,97       ",
"111,101             ","112,110,69,67       ","113,104             ","114,113,33,32       ","115,114,101,100     ","116,115,46,45       ","117,115,99,97       ","118,85              ","119,111             ","120,113,9,2         ",
"121,103             ","122,121,63,62       ","123,121             ","124,87              ","125,124,18,17       ","126,125,90,89       ","127,126             ","128,126,101,99      ","129,124             ","130,127             ",
"131,130,84,83       ","132,103             ","133,132,82,81       ","134,77              ","135,124             ","136,135,11,10       ","137,116             ","138,137,131,130     ","139,136,134,131     ","140,111             ",
"141,140,110,109     ","142,121             ","143,142,123,122     ","144,143,75,74       ","145,93              ","146,145,87,86       ","147,146,110,109     ","148,121             ","149,148,40,39       ","150,97              ",
"151,148             ","152,151,87,86       ","153,152             ","154,152,27,25       ","155,154,124,123     ","156,155,41,40       ","157,156,131,130     ","158,157,132,131     ","159,128             ","160,159,142,141     ",
"161,143             ","162,161,75,74       ","163,162,104,103     ","164,163,151,150     ","165,164,135,134     ","166,165,128,127     ","167,161             ","168,166,153,151     "
);












type Irreducible_Exponents_type is array(2 to 10000) of string(1 to 20); 

constant Irreducible_Exponents : Irreducible_Exponents_type :=(
                       "2,1                 ","3,1                 ","4,1                 ","5,2                 ","6,1                 ","7,1                 ","8,4,3,1             ","9,1                 ","10,3                ",
"11,2                ","12,3                ","13,4,3,1            ","14,5                ","15,1                ","16,5,3,1            ","17,3                ","18,3                ","19,5,2,1            ","20,3                ",
"21,2                ","22,1                ","23,5                ","24,4,3,1            ","25,3                ","26,4,3,1            ","27,5,2,1            ","28,1                ","29,2                ","30,1                ",
"31,3                ","32,7,3,2            ","33,10               ","34,7                ","35,2                ","36,9                ","37,6,4,1            ","38,6,5,1            ","39,4                ","40,5,4,3            ",
"41,3                ","42,7                ","43,6,4,3            ","44,5                ","45,4,3,1            ","46,1                ","47,5                ","48,5,3,2            ","49,9                ","50,4,3,2            ",
"51,6,3,1            ","52,3                ","53,6,2,1            ","54,9                ","55,7                ","56,7,4,2            ","57,4                ","58,19               ","59,7,4,2            ","60,1                ",
"61,5,2,1            ","62,29               ","63,1                ","64,4,3,1            ","65,18               ","66,3                ","67,5,2,1            ","68,9                ","69,6,5,2            ","70,5,3,1            ",
"71,6                ","72,10,9,3           ","73,25               ","74,35               ","75,6,3,1            ","76,21               ","77,6,5,2            ","78,6,5,3            ","79,9                ","80,9,4,2            ",
"81,4                ","82,8,3,1            ","83,7,4,2            ","84,5                ","85,8,2,1            ","86,21               ","87,13               ","88,7,6,2            ","89,38               ","90,27               ",
"91,8,5,1            ","92,21               ","93,2                ","94,21               ","95,11               ","96,10,9,6           ","97,6                ","98,11               ","99,6,3,1            ","100,15              ",
"101,7,6,1           ","102,29              ","103,9               ","104,4,3,1           ","105,4               ","106,15              ","107,9,7,4           ","108,17              ","109,5,4,2           ","110,33              ",
"111,10              ","112,5,4,3           ","113,9               ","114,5,3,2           ","115,8,7,5           ","116,4,2,1           ","117,5,2,1           ","118,33              ","119,8               ","120,4,3,1           ",
"121,18              ","122,6,2,1           ","123,2               ","124,19              ","125,7,6,5           ","126,21              ","127,1               ","128,7,2,1           ","129,5               ","130,3               ",
"131,8,3,2           ","132,17              ","133,9,8,2           ","134,57              ","135,11              ","136,5,3,2           ","137,21              ","138,8,7,1           ","139,8,5,3           ","140,15              ",
"141,10,4,1          ","142,21              ","143,5,3,2           ","144,7,4,2           ","145,52              ","146,71              ","147,14              ","148,27              ","149,10,9,7          ","150,53              ",
"151,3               ","152,6,3,2           ","153,1               ","154,15              ","155,62              ","156,9               ","157,6,5,2           ","158,8,6,5           ","159,31              ","160,5,3,2           ",
"161,18              ","162,27              ","163,7,6,3           ","164,10,8,7          ","165,9,8,3           ","166,37              ","167,6               ","168,15,3,2          ","169,34              ","170,11              ",
"171,6,5,2           ","172,1               ","173,8,5,2           ","174,13              ","175,6               ","176,11,3,2          ","177,8               ","178,31              ","179,4,2,1           ","180,3               ",
"181,7,6,1           ","182,81              ","183,56              ","184,9,8,7           ","185,24              ","186,11              ","187,7,6,5           ","188,6,5,2           ","189,6,5,2           ","190,8,7,6           ",
"191,9               ","192,7,2,1           ","193,15              ","194,87              ","195,8,3,2           ","196,3               ","197,9,4,2           ","198,9               ","199,34              ","200,5,3,2           ",
"201,14              ","202,55              ","203,8,7,1           ","204,27              ","205,9,5,2           ","206,10,9,5          ","207,43              ","208,9,3,1           ","209,6               ","210,7               ",
"211,11,10,8         ","212,105             ","213,6,5,2           ","214,73              ","215,23              ","216,7,3,1           ","217,45              ","218,11              ","219,8,4,1           ","220,7               ",
"221,8,6,2           ","222,5,4,2           ","223,33              ","224,9,8,3           ","225,32              ","226,10,7,3          ","227,10,9,4          ","228,113             ","229,10,4,1          ","230,8,7,6           ",
"231,26              ","232,9,4,2           ","233,74              ","234,31              ","235,9,6,1           ","236,5               ","237,7,4,1           ","238,73              ","239,36              ","240,8,5,3           ",
"241,70              ","242,95              ","243,8,5,1           ","244,111             ","245,6,4,1           ","246,11,2,1          ","247,82              ","248,15,14,10        ","249,35              ","250,103             ",
"251,7,4,2           ","252,15              ","253,46              ","254,7,2,1           ","255,52              ","256,10,5,2          ","257,12              ","258,71              ","259,10,6,2          ","260,15              ",
"261,7,6,4           ","262,9,8,4           ","263,93              ","264,9,6,2           ","265,42              ","266,47              ","267,8,6,3           ","268,25              ","269,7,6,1           ","270,53              ",
"271,58              ","272,9,3,2           ","273,23              ","274,67              ","275,11,10,9         ","276,63              ","277,12,6,3          ","278,5               ","279,5               ","280,9,5,2           ",
"281,93              ","282,35              ","283,12,7,5          ","284,53              ","285,10,7,5          ","286,69              ","287,71              ","288,11,10,1         ","289,21              ","290,5,3,2           ",
"291,12,11,5         ","292,37              ","293,11,6,1          ","294,33              ","295,48              ","296,7,3,2           ","297,5               ","298,11,8,4          ","299,11,6,4          ","300,5               ",
"301,9,5,2           ","302,41              ","303,1               ","304,11,2,1          ","305,102             ","306,7,3,1           ","307,8,4,2           ","308,15              ","309,10,6,4          ","310,93              ",
"311,7,5,3           ","312,9,7,4           ","313,79              ","314,15              ","315,10,9,1          ","316,63              ","317,7,4,2           ","318,45              ","319,36              ","320,4,3,1           ",
"321,31              ","322,67              ","323,10,3,1          ","324,51              ","325,10,5,2          ","326,10,3,1          ","327,34              ","328,8,3,1           ","329,50              ","330,99              ",
"331,10,6,2          ","332,89              ","333,2               ","334,5,2,1           ","335,10,7,2          ","336,7,4,1           ","337,55              ","338,4,3,1           ","339,16,10,7         ","340,45              ",
"341,10,8,6          ","342,125             ","343,75              ","344,7,2,1           ","345,22              ","346,63              ","347,11,10,3         ","348,103             ","349,6,5,2           ","350,53              ",
"351,34              ","352,13,11,6         ","353,69              ","354,99              ","355,6,5,1           ","356,10,9,7          ","357,11,10,2         ","358,57              ","359,68              ","360,5,3,2           ",
"361,7,4,1           ","362,63              ","363,8,5,3           ","364,9               ","365,9,6,5           ","366,29              ","367,21              ","368,7,3,2           ","369,91              ","370,139             ",
"371,8,3,2           ","372,111             ","373,8,7,2           ","374,8,6,5           ","375,16              ","376,8,7,5           ","377,41              ","378,43              ","379,10,8,5          ","380,47              ",
"381,5,2,1           ","382,81              ","383,90              ","384,12,3,2          ","385,6               ","386,83              ","387,8,7,1           ","388,159             ","389,10,9,5          ","390,9               ",
"391,28              ","392,13,10,6         ","393,7               ","394,135             ","395,11,6,5          ","396,25              ","397,12,7,6          ","398,7,6,2           ","399,26              ","400,5,3,2           ",
"401,152             ","402,171             ","403,9,8,5           ","404,65              ","405,13,8,2          ","406,141             ","407,71              ","408,5,3,2           ","409,87              ","410,10,4,3          ",
"411,12,10,3         ","412,147             ","413,10,7,6          ","414,13              ","415,102             ","416,9,5,2           ","417,107             ","418,199             ","419,15,5,4          ","420,7               ",
"421,5,4,2           ","422,149             ","423,25              ","424,9,7,2           ","425,12              ","426,63              ","427,11,6,5          ","428,105             ","429,10,8,7          ","430,14,6,1          ",
"431,120             ","432,13,4,3          ","433,33              ","434,12,11,5         ","435,12,9,5          ","436,165             ","437,6,2,1           ","438,65              ","439,49              ","440,4,3,1           ",
"441,7               ","442,7,5,2           ","443,10,6,1          ","444,81              ","445,7,6,4           ","446,105             ","447,73              ","448,11,6,4          ","449,134             ","450,47              ",
"451,16,10,1         ","452,6,5,4           ","453,15,6,4          ","454,8,6,1           ","455,38              ","456,18,9,6          ","457,16              ","458,203             ","459,12,5,2          ","460,19              ",
"461,7,6,1           ","462,73              ","463,93              ","464,19,18,13        ","465,31              ","466,14,11,6         ","467,11,6,1          ","468,27              ","469,9,5,2           ","470,9               ",
"471,1               ","472,11,3,2          ","473,200             ","474,191             ","475,9,8,4           ","476,9               ","477,16,15,7         ","478,121             ","479,104             ","480,15,9,6          ",
"481,138             ","482,9,6,5           ","483,9,6,4           ","484,105             ","485,17,16,6         ","486,81              ","487,94              ","488,4,3,1           ","489,83              ","490,219             ",
"491,11,6,3          ","492,7               ","493,10,5,3          ","494,17              ","495,76              ","496,16,5,2          ","497,78              ","498,155             ","499,11,6,5          ","500,27              ",
"501,5,4,2           ","502,8,5,4           ","503,3               ","504,15,14,6         ","505,156             ","506,23              ","507,13,6,3          ","508,9               ","509,8,7,3           ","510,69              ",
"511,10              ","512,8,5,2           ","513,26              ","514,67              ","515,14,7,4          ","516,21              ","517,12,10,2         ","518,33              ","519,79              ","520,15,11,2         ",
"521,32              ","522,39              ","523,13,6,2          ","524,167             ","525,6,4,1           ","526,97              ","527,47              ","528,11,6,2          ","529,42              ","530,10,7,3          ",
"531,10,5,4          ","532,1               ","533,4,3,2           ","534,161             ","535,8,6,2           ","536,7,5,3           ","537,94              ","538,195             ","539,10,5,4          ","540,9               ",
"541,13,10,4         ","542,8,6,1           ","543,16              ","544,8,3,1           ","545,122             ","546,8,2,1           ","547,13,7,4          ","548,10,5,3          ","549,16,4,3          ","550,193             ",
"551,135             ","552,19,16,9         ","553,39              ","554,10,8,7          ","555,10,9,4          ","556,153             ","557,7,6,5           ","558,73              ","559,34              ","560,11,9,6          ",
"561,71              ","562,11,4,2          ","563,14,7,3          ","564,163             ","565,11,6,1          ","566,153             ","567,28              ","568,15,7,6          ","569,77              ","570,67              ",
"571,10,5,2          ","572,12,8,1          ","573,10,6,4          ","574,13              ","575,146             ","576,13,4,3          ","577,25              ","578,23,22,16        ","579,12,9,7          ","580,237             ",
"581,13,7,6          ","582,85              ","583,130             ","584,14,13,3         ","585,88              ","586,7,5,2           ","587,11,6,1          ","588,35              ","589,10,4,3          ","590,93              ",
"591,9,6,4           ","592,13,6,3          ","593,86              ","594,19              ","595,9,2,1           ","596,273             ","597,14,12,9         ","598,7,6,1           ","599,30              ","600,9,5,2           ",
"601,201             ","602,215             ","603,6,4,3           ","604,105             ","605,10,7,5          ","606,165             ","607,105             ","608,19,13,6         ","609,31              ","610,127             ",
"611,10,4,2          ","612,81              ","613,19,10,4         ","614,45              ","615,211             ","616,19,10,3         ","617,200             ","618,295             ","619,9,8,5           ","620,9               ",
"621,12,6,5          ","622,297             ","623,68              ","624,11,6,5          ","625,133             ","626,251             ","627,13,8,4          ","628,223             ","629,6,5,2           ","630,7,4,2           ",
"631,307             ","632,9,2,1           ","633,101             ","634,39              ","635,14,10,4         ","636,217             ","637,14,9,1          ","638,6,5,1           ","639,16              ","640,14,3,2          ",
"641,11              ","642,119             ","643,11,3,2          ","644,11,6,5          ","645,11,8,4          ","646,249             ","647,5               ","648,13,3,1          ","649,37              ","650,3               ",
"651,14              ","652,93              ","653,10,8,7          ","654,33              ","655,88              ","656,7,5,4           ","657,38              ","658,55              ","659,15,4,2          ","660,11              ",
"661,12,11,4         ","662,21              ","663,107             ","664,11,9,8          ","665,33              ","666,10,7,2          ","667,18,7,3          ","668,147             ","669,5,4,2           ","670,153             ",
"671,15              ","672,11,6,5          ","673,28              ","674,11,7,4          ","675,6,3,1           ","676,31              ","677,8,4,3           ","678,15,5,3          ","679,66              ","680,23,16,9         ",
"681,11,9,3          ","682,171             ","683,11,6,1          ","684,209             ","685,4,3,1           ","686,197             ","687,13              ","688,19,14,6         ","689,14              ","690,79              ",
"691,13,6,2          ","692,299             ","693,15,8,2          ","694,169             ","695,177             ","696,23,10,2         ","697,267             ","698,215             ","699,15,10,1         ","700,75              ",
"701,16,4,2          ","702,37              ","703,12,7,1          ","704,8,3,2           ","705,17              ","706,12,11,8         ","707,15,8,5          ","708,15              ","709,4,3,1           ","710,13,12,4         ",
"711,92              ","712,5,4,3           ","713,41              ","714,23              ","715,7,4,1           ","716,183             ","717,16,7,1          ","718,165             ","719,150             ","720,9,6,4           ",
"721,9               ","722,231             ","723,16,10,4         ","724,207             ","725,9,6,5           ","726,5               ","727,180             ","728,4,3,2           ","729,58              ","730,147             ",
"731,8,6,2           ","732,343             ","733,8,7,2           ","734,11,6,1          ","735,44              ","736,13,8,6          ","737,5               ","738,347             ","739,18,16,8         ","740,135             ",
"741,9,8,3           ","742,85              ","743,90              ","744,13,11,1         ","745,258             ","746,351             ","747,10,6,4          ","748,19              ","749,7,6,1           ","750,309             ",
"751,18              ","752,13,10,3         ","753,158             ","754,19              ","755,12,10,1         ","756,45              ","757,7,6,1           ","758,233             ","759,98              ","760,11,6,5          ",
"761,3               ","762,83              ","763,16,14,9         ","764,6,5,3           ","765,9,7,4           ","766,22,19,9         ","767,168             ","768,19,17,4         ","769,120             ","770,14,5,2          ",
"771,17,15,6         ","772,7               ","773,10,8,6          ","774,185             ","775,93              ","776,15,14,7         ","777,29              ","778,375             ","779,10,8,3          ","780,13              ",
"781,17,16,2         ","782,329             ","783,68              ","784,13,9,6          ","785,92              ","786,12,10,3         ","787,7,6,3           ","788,17,10,3         ","789,5,2,1           ","790,9,6,1           ",
"791,30              ","792,9,7,3           ","793,253             ","794,143             ","795,7,4,1           ","796,9,4,1           ","797,12,10,4         ","798,53              ","799,25              ","800,9,7,1           ",
"801,217             ","802,15,13,9         ","803,14,9,2          ","804,75              ","805,8,7,2           ","806,21              ","807,7               ","808,14,3,2          ","809,15              ","810,159             ",
"811,12,10,8         ","812,29              ","813,10,3,1          ","814,21              ","815,333             ","816,11,8,2          ","817,52              ","818,119             ","819,16,9,7          ","820,123             ",
"821,15,11,2         ","822,17              ","823,9               ","824,11,6,4          ","825,38              ","826,255             ","827,12,10,7         ","828,189             ","829,4,3,1           ","830,17,10,7         ",
"831,49              ","832,13,5,2          ","833,149             ","834,15              ","835,14,7,5          ","836,10,9,2          ","837,8,6,5           ","838,61              ","839,54              ","840,11,5,1          ",
"841,144             ","842,47              ","843,11,10,7         ","844,105             ","845,2               ","846,105             ","847,136             ","848,11,4,1          ","849,253             ","850,111             ",
"851,13,10,5         ","852,159             ","853,10,7,1          ","854,7,5,3           ","855,29              ","856,19,10,3         ","857,119             ","858,207             ","859,17,15,4         ","860,35              ",
"861,14              ","862,349             ","863,6,3,2           ","864,21,10,6         ","865,1               ","866,75              ","867,9,5,2           ","868,145             ","869,11,7,6          ","870,301             ",
"871,378             ","872,13,3,1          ","873,352             ","874,12,7,4          ","875,12,8,1          ","876,149             ","877,6,5,4           ","878,12,9,8          ","879,11              ","880,15,7,5          ",
"881,78              ","882,99              ","883,17,16,12        ","884,173             ","885,8,7,1           ","886,13,9,8          ","887,147             ","888,19,18,10        ","889,127             ","890,183             ",
"891,12,4,1          ","892,31              ","893,11,8,6          ","894,173             ","895,12              ","896,7,5,3           ","897,113             ","898,207             ","899,18,15,5         ","900,1               ",
"901,13,7,6          ","902,21              ","903,35              ","904,12,7,2          ","905,117             ","906,123             ","907,12,10,2         ","908,143             ","909,14,4,1          ","910,15,9,7          ",
"911,204             ","912,7,5,1           ","913,91              ","914,4,2,1           ","915,8,6,3           ","916,183             ","917,12,10,7         ","918,77              ","919,36              ","920,14,9,6          ",
"921,221             ","922,7,6,5           ","923,16,14,13        ","924,31              ","925,16,15,7         ","926,365             ","927,403             ","928,10,3,2          ","929,11,4,3          ","930,31              ",
"931,10,9,4          ","932,177             ","933,16,6,1          ","934,22,6,5          ","935,417             ","936,15,13,12        ","937,217             ","938,207             ","939,7,5,4           ","940,10,7,1          ",
"941,11,6,1          ","942,45              ","943,24              ","944,12,11,9         ","945,77              ","946,21,20,13        ","947,9,6,5           ","948,189             ","949,8,3,2           ","950,13,12,10        ",
"951,260             ","952,16,9,7          ","953,168             ","954,131             ","955,7,6,3           ","956,305             ","957,10,9,6          ","958,13,9,4          ","959,143             ","960,12,9,3          ",
"961,18              ","962,15,8,5          ","963,20,9,6          ","964,103             ","965,15,4,2          ","966,201             ","967,36              ","968,9,5,2           ","969,31              ","970,11,7,2          ",
"971,6,2,1           ","972,7               ","973,13,6,4          ","974,9,8,7           ","975,19              ","976,17,10,6         ","977,15              ","978,9,3,1           ","979,178             ","980,8,7,6           ",
"981,12,6,5          ","982,177             ","983,230             ","984,24,9,3          ","985,222             ","986,3               ","987,16,13,12        ","988,121             ","989,10,4,2          ","990,161             ",
"991,39              ","992,17,15,13        ","993,62              ","994,223             ","995,15,12,2         ","996,65              ","997,12,6,3          ","998,101             ","999,59              ","1000,5,4,3          ",
"1001,17             ","1002,5,3,2          ","1003,13,8,3         ","1004,10,9,7         ","1005,12,8,2         ","1006,5,4,3          ","1007,75             ","1008,19,17,8        ","1009,55             ","1010,99             ",
"1011,10,7,4         ","1012,115            ","1013,9,8,6          ","1014,385            ","1015,186            ","1016,15,6,3         ","1017,9,4,1          ","1018,12,10,5        ","1019,10,8,1         ","1020,135            ",
"1021,5,2,1          ","1022,317            ","1023,7              ","1024,19,6,1         ","1025,294            ","1026,35             ","1027,13,12,6        ","1028,119            ","1029,98             ","1030,93             ",
"1031,68             ","1032,21,15,3        ","1033,108            ","1034,75             ","1035,12,6,5         ","1036,411            ","1037,12,7,2         ","1038,13,7,2         ","1039,21             ","1040,15,10,8        ",
"1041,412            ","1042,439            ","1043,10,7,6         ","1044,41             ","1045,13,9,6         ","1046,8,5,2          ","1047,10             ","1048,15,7,2         ","1049,141            ","1050,159            ",
"1051,13,12,10       ","1052,291            ","1053,10,9,1         ","1054,105            ","1055,24             ","1056,11,2,1         ","1057,198            ","1058,27             ","1059,6,3,1          ","1060,439            ",
"1061,10,3,1         ","1062,49             ","1063,168            ","1064,13,11,9        ","1065,463            ","1066,10,9,3         ","1067,13,9,8         ","1068,15,8,3         ","1069,18,16,8        ","1070,15,14,11       ",
"1071,7              ","1072,19,9,8         ","1073,12,6,3         ","1074,7,4,3          ","1075,15,14,5        ","1076,8,6,3          ","1077,10,9,7         ","1078,361            ","1079,230            ","1080,15,9,6         ",
"1081,24             ","1082,407            ","1083,16,7,2         ","1084,189            ","1085,62             ","1086,189            ","1087,112            ","1088,22,21,10       ","1089,91             ","1090,79             ",
"1091,12,10,5        ","1092,23             ","1093,7,6,1          ","1094,57             ","1095,139            ","1096,24,15,6        ","1097,14             ","1098,83             ","1099,16,9,1         ","1100,35             ",
"1101,9,7,4          ","1102,117            ","1103,65             ","1104,21,9,6         ","1105,21             ","1106,195            ","1107,23,11,10       ","1108,327            ","1109,17,14,3        ","1110,417            ",
"1111,13             ","1112,15,8,6         ","1113,107            ","1114,19,10,6        ","1115,18,15,3        ","1116,59             ","1117,12,10,4        ","1118,9,7,5          ","1119,283            ","1120,13,9,6         ",
"1121,62             ","1122,427            ","1123,14,7,3         ","1124,8,7,4          ","1125,15,8,3         ","1126,105            ","1127,27             ","1128,7,3,1          ","1129,103            ","1130,551            ",
"1131,10,6,1         ","1132,6,4,1          ","1133,11,6,4         ","1134,129            ","1135,9              ","1136,9,4,2          ","1137,277            ","1138,31             ","1139,13,12,5        ","1140,141            ",
"1141,12,7,3         ","1142,357            ","1143,7,2,1          ","1144,11,9,7         ","1145,227            ","1146,131            ","1147,7,6,3          ","1148,23             ","1149,20,17,3        ","1150,13,4,1         ",
"1151,90             ","1152,15,3,2         ","1153,241            ","1154,75             ","1155,13,6,1         ","1156,307            ","1157,8,7,3          ","1158,245            ","1159,66             ","1160,15,11,2        ",
"1161,365            ","1162,18,16,11       ","1163,11,10,1        ","1164,19             ","1165,8,6,1          ","1166,189            ","1167,133            ","1168,12,7,2         ","1169,114            ","1170,27             ",
"1171,6,5,1          ","1172,15,5,2         ","1173,17,14,5        ","1174,133            ","1175,476            ","1176,11,9,3         ","1177,16             ","1178,375            ","1179,15,8,6         ","1180,25             ",
"1181,17,11,6        ","1182,77             ","1183,87             ","1184,5,3,2          ","1185,134            ","1186,171            ","1187,13,8,4         ","1188,75             ","1189,8,3,1          ","1190,233            ",
"1191,196            ","1192,9,8,7          ","1193,173            ","1194,15,14,12       ","1195,13,6,5         ","1196,281            ","1197,9,8,2          ","1198,405            ","1199,114            ","1200,15,9,6         ",
"1201,171            ","1202,287            ","1203,8,4,2          ","1204,43             ","1205,4,2,1          ","1206,513            ","1207,273            ","1208,11,10,6        ","1209,118            ","1210,243            ",
"1211,14,7,1         ","1212,203            ","1213,9,5,2          ","1214,257            ","1215,302            ","1216,27,25,9        ","1217,393            ","1218,91             ","1219,12,10,6        ","1220,413            ",
"1221,15,14,9        ","1222,18,16,1        ","1223,255            ","1224,12,9,7         ","1225,234            ","1226,167            ","1227,16,13,10       ","1228,27             ","1229,15,6,2         ","1230,433            ",
"1231,105            ","1232,25,10,2        ","1233,151            ","1234,427            ","1235,13,9,8         ","1236,49             ","1237,10,6,4         ","1238,153            ","1239,4              ","1240,17,7,5         ",
"1241,54             ","1242,203            ","1243,16,15,1        ","1244,16,14,7        ","1245,13,6,1         ","1246,25             ","1247,14             ","1248,15,5,3         ","1249,187            ","1250,15,13,10       ",
"1251,13,10,5        ","1252,97             ","1253,11,10,9        ","1254,19,10,4        ","1255,589            ","1256,31,30,2        ","1257,289            ","1258,9,6,4          ","1259,11,8,6         ","1260,21             ",
"1261,7,4,1          ","1262,7,4,2          ","1263,77             ","1264,5,3,2          ","1265,119            ","1266,7              ","1267,9,5,2          ","1268,345            ","1269,17,10,8        ","1270,333            ",
"1271,17             ","1272,16,9,7         ","1273,168            ","1274,15,13,4        ","1275,11,10,1        ","1276,217            ","1277,18,11,10       ","1278,189            ","1279,216            ","1280,12,7,5         ",
"1281,229            ","1282,231            ","1283,12,9,3         ","1284,223            ","1285,10,9,1         ","1286,153            ","1287,470            ","1288,23,16,6        ","1289,99             ","1290,10,4,3         ",
"1291,9,8,4          ","1292,12,10,1        ","1293,14,9,6         ","1294,201            ","1295,38             ","1296,15,14,2        ","1297,198            ","1298,399            ","1299,14,11,5        ","1300,75             ",
"1301,11,10,1        ","1302,77             ","1303,16,12,8        ","1304,20,17,15       ","1305,326            ","1306,39             ","1307,14,12,9        ","1308,495            ","1309,8,3,2          ","1310,333            ",
"1311,476            ","1312,15,14,2        ","1313,164            ","1314,19             ","1315,12,4,2         ","1316,8,6,3          ","1317,13,12,3        ","1318,12,11,5        ","1319,129            ","1320,12,9,3         ",
"1321,52             ","1322,10,8,3         ","1323,17,16,2        ","1324,337            ","1325,12,9,3         ","1326,397            ","1327,277            ","1328,21,11,3        ","1329,73             ","1330,11,6,1         ",
"1331,7,5,4          ","1332,95             ","1333,11,3,2         ","1334,617            ","1335,392            ","1336,8,3,2          ","1337,75             ","1338,315            ","1339,15,6,4         ","1340,125            ",
"1341,6,5,2          ","1342,15,9,7         ","1343,348            ","1344,15,6,1         ","1345,553            ","1346,6,3,2          ","1347,10,9,7         ","1348,553            ","1349,14,10,4        ","1350,237            ",
"1351,39             ","1352,17,14,6        ","1353,371            ","1354,255            ","1355,8,4,1          ","1356,131            ","1357,14,6,1         ","1358,117            ","1359,98             ","1360,5,3,2          ",
"1361,56             ","1362,655            ","1363,9,5,2          ","1364,239            ","1365,11,8,4         ","1366,1              ","1367,134            ","1368,15,9,5         ","1369,88             ","1370,10,5,3         ",
"1371,10,9,4         ","1372,181            ","1373,15,11,2        ","1374,609            ","1375,52             ","1376,19,18,10       ","1377,100            ","1378,7,6,3          ","1379,15,8,2         ","1380,183            ",
"1381,18,7,6         ","1382,10,9,2         ","1383,130            ","1384,11,5,1         ","1385,12             ","1386,219            ","1387,13,10,7        ","1388,11             ","1389,19,9,4         ","1390,129            ",
"1391,3              ","1392,17,15,5        ","1393,300            ","1394,17,13,9        ","1395,14,6,5         ","1396,97             ","1397,13,8,3         ","1398,601            ","1399,55             ","1400,8,3,1          ",
"1401,92             ","1402,127            ","1403,12,11,2        ","1404,81             ","1405,15,10,8        ","1406,13,2,1         ","1407,47             ","1408,14,13,6        ","1409,194            ","1410,383            ",
"1411,25,14,11       ","1412,125            ","1413,20,19,16       ","1414,429            ","1415,282            ","1416,10,9,6         ","1417,342            ","1418,5,3,2          ","1419,15,9,4         ","1420,33             ",
"1421,9,4,2          ","1422,49             ","1423,15             ","1424,11,6,2         ","1425,28             ","1426,103            ","1427,18,17,8        ","1428,27             ","1429,11,6,5         ","1430,33             ",
"1431,17             ","1432,11,10,6        ","1433,387            ","1434,363            ","1435,15,10,9        ","1436,83             ","1437,7,6,4          ","1438,357            ","1439,13,12,4        ","1440,14,13,7        ",
"1441,322            ","1442,395            ","1443,16,5,1         ","1444,595            ","1445,13,10,3        ","1446,421            ","1447,195            ","1448,11,3,2         ","1449,13             ","1450,16,12,3        ",
"1451,14,3,1         ","1452,315            ","1453,26,10,5        ","1454,297            ","1455,52             ","1456,9,4,2          ","1457,314            ","1458,243            ","1459,16,14,9        ","1460,185            ",
"1461,12,5,3         ","1462,13,5,2         ","1463,575            ","1464,12,9,3         ","1465,39             ","1466,311            ","1467,13,5,2         ","1468,181            ","1469,20,18,14       ","1470,49             ",
"1471,25             ","1472,11,4,1         ","1473,77             ","1474,17,11,10       ","1475,15,14,8        ","1476,21             ","1477,17,10,5        ","1478,69             ","1479,49             ","1480,11,10,2        ",
"1481,32             ","1482,411            ","1483,21,16,3        ","1484,11,7,4         ","1485,22,10,3        ","1486,85             ","1487,140            ","1488,9,8,6          ","1489,252            ","1490,279            ",
"1491,9,5,2          ","1492,307            ","1493,17,10,4        ","1494,13,12,9        ","1495,94             ","1496,13,11,4        ","1497,49             ","1498,17,11,10       ","1499,16,12,5        ","1500,25             ",
"1501,6,5,2          ","1502,12,5,1         ","1503,80             ","1504,8,3,2          ","1505,246            ","1506,11,5,2         ","1507,11,10,2        ","1508,599            ","1509,18,12,10       ","1510,189            ",
"1511,278            ","1512,10,9,3         ","1513,399            ","1514,299            ","1515,13,10,6        ","1516,277            ","1517,13,10,6        ","1518,69             ","1519,220            ","1520,13,10,3        ",
"1521,229            ","1522,18,11,10       ","1523,16,15,1        ","1524,27             ","1525,18,9,3         ","1526,473            ","1527,373            ","1528,18,17,7        ","1529,60             ","1530,207            ",
"1531,13,9,8         ","1532,22,20,13       ","1533,25,18,7        ","1534,225            ","1535,404            ","1536,21,6,2         ","1537,46             ","1538,6,2,1          ","1539,17,12,6        ","1540,75             ",
"1541,4,2,1          ","1542,365            ","1543,445            ","1544,11,7,1         ","1545,44             ","1546,10,8,5         ","1547,12,5,2         ","1548,63             ","1549,17,4,2         ","1550,189            ",
"1551,557            ","1552,19,12,2        ","1553,252            ","1554,99             ","1555,10,8,5         ","1556,65             ","1557,14,9,3         ","1558,9              ","1559,119            ","1560,8,5,2          ",
"1561,339            ","1562,95             ","1563,12,9,7         ","1564,7              ","1565,13,10,2        ","1566,77             ","1567,127            ","1568,21,10,7        ","1569,319            ","1570,667            ",
"1571,17,10,3        ","1572,501            ","1573,18,12,9        ","1574,9,8,5          ","1575,17             ","1576,20,9,2         ","1577,341            ","1578,731            ","1579,7,6,5          ","1580,647            ",
"1581,10,4,2         ","1582,121            ","1583,20             ","1584,21,19,13       ","1585,574            ","1586,399            ","1587,15,10,7        ","1588,85             ","1589,16,8,3         ","1590,169            ",
"1591,15             ","1592,12,7,5         ","1593,568            ","1594,10,7,1         ","1595,18,2,1         ","1596,3              ","1597,14,3,2         ","1598,13,7,3         ","1599,643            ","1600,14,11,1        ",
"1601,548            ","1602,783            ","1603,14,11,1        ","1604,317            ","1605,7,6,4          ","1606,153            ","1607,87             ","1608,15,13,1        ","1609,231            ","1610,11,5,3         ",
"1611,18,13,7        ","1612,771            ","1613,30,20,11       ","1614,15,6,3         ","1615,103            ","1616,13,4,3         ","1617,182            ","1618,211            ","1619,17,6,1         ","1620,27             ",
"1621,13,12,10       ","1622,15,14,10       ","1623,17             ","1624,13,11,5        ","1625,69             ","1626,11,5,1         ","1627,18,6,1         ","1628,603            ","1629,10,4,2         ","1630,741            ",
"1631,668            ","1632,17,15,3        ","1633,147            ","1634,227            ","1635,15,10,9        ","1636,37             ","1637,16,6,1         ","1638,173            ","1639,427            ","1640,7,5,1          ",
"1641,287            ","1642,231            ","1643,20,15,10       ","1644,18,9,1         ","1645,14,12,5        ","1646,16,5,1         ","1647,310            ","1648,18,13,1        ","1649,434            ","1650,579            ",
"1651,18,13,8        ","1652,45             ","1653,12,8,3         ","1654,16,9,5         ","1655,53             ","1656,19,15,10       ","1657,16             ","1658,17,6,5         ","1659,17,10,1        ","1660,37             ",
"1661,17,10,9        ","1662,21,13,7        ","1663,99             ","1664,17,9,6         ","1665,176            ","1666,271            ","1667,18,17,13       ","1668,459            ","1669,21,17,10       ","1670,6,5,2          ",
"1671,202            ","1672,5,4,3          ","1673,90             ","1674,755            ","1675,15,7,2         ","1676,363            ","1677,8,4,2          ","1678,129            ","1679,20             ","1680,11,6,2         ",
"1681,135            ","1682,15,8,7         ","1683,14,13,2        ","1684,10,4,3         ","1685,24,13,10       ","1686,19,14,11       ","1687,31             ","1688,15,8,6         ","1689,758            ","1690,16,11,5        ",
"1691,16,5,1         ","1692,359            ","1693,23,18,17       ","1694,501            ","1695,29             ","1696,15,6,3         ","1697,201            ","1698,459            ","1699,12,10,7        ","1700,225            ",
"1701,22,17,13       ","1702,24,22,5        ","1703,161            ","1704,14,11,3        ","1705,52             ","1706,19,17,6        ","1707,21,14,12       ","1708,93             ","1709,13,10,3        ","1710,201            ",
"1711,178            ","1712,15,12,5        ","1713,250            ","1714,7,6,4          ","1715,17,13,6        ","1716,221            ","1717,13,11,8        ","1718,17,14,9        ","1719,113            ","1720,17,14,10       ",
"1721,300            ","1722,39             ","1723,18,13,3        ","1724,261            ","1725,15,14,8        ","1726,753            ","1727,8,4,3          ","1728,11,10,5        ","1729,94             ","1730,15,13,1        ",
"1731,10,4,2         ","1732,14,11,10       ","1733,8,6,2          ","1734,461            ","1735,418            ","1736,19,14,6        ","1737,403            ","1738,267            ","1739,10,9,2         ","1740,259            ",
"1741,20,4,3         ","1742,869            ","1743,173            ","1744,19,18,2        ","1745,369            ","1746,255            ","1747,22,12,9        ","1748,567            ","1749,20,11,7        ","1750,457            ",
"1751,482            ","1752,6,3,2          ","1753,775            ","1754,19,17,6        ","1755,6,4,3          ","1756,99             ","1757,15,14,8        ","1758,6,5,2          ","1759,165            ","1760,8,3,2          ",
"1761,13,12,10       ","1762,25,21,17       ","1763,17,14,9        ","1764,105            ","1765,17,15,14       ","1766,10,3,2         ","1767,250            ","1768,25,6,5         ","1769,327            ","1770,279            ",
"1771,13,6,5         ","1772,371            ","1773,15,9,4         ","1774,117            ","1775,486            ","1776,10,9,3         ","1777,217            ","1778,635            ","1779,30,27,17       ","1780,457            ",
"1781,16,6,2         ","1782,57             ","1783,439            ","1784,23,21,6        ","1785,214            ","1786,20,13,6        ","1787,20,16,1        ","1788,819            ","1789,15,11,8        ","1790,593            ",
"1791,190            ","1792,17,14,3        ","1793,114            ","1794,21,18,3        ","1795,10,5,2         ","1796,12,9,5         ","1797,8,6,3          ","1798,69             ","1799,312            ","1800,22,5,2         ",
"1801,502            ","1802,843            ","1803,15,10,3        ","1804,747            ","1805,6,5,2          ","1806,101            ","1807,123            ","1808,19,16,9        ","1809,521            ","1810,171            ",
"1811,16,7,2         ","1812,12,6,5         ","1813,22,21,20       ","1814,545            ","1815,163            ","1816,23,18,1        ","1817,479            ","1818,495            ","1819,13,6,5         ","1820,11             ",
"1821,17,5,2         ","1822,18,8,1         ","1823,684            ","1824,7,5,1          ","1825,9              ","1826,18,11,3        ","1827,22,20,13       ","1828,273            ","1829,4,3,2          ","1830,381            ",
"1831,51             ","1832,18,13,7        ","1833,518            ","1834,9,5,1          ","1835,14,12,3        ","1836,243            ","1837,21,17,2        ","1838,53             ","1839,836            ","1840,21,10,2        ",
"1841,66             ","1842,12,10,7        ","1843,13,9,8         ","1844,339            ","1845,16,11,5        ","1846,901            ","1847,180            ","1848,16,13,3        ","1849,49             ","1850,6,3,2          ",
"1851,15,4,1         ","1852,16,13,6        ","1853,18,15,12       ","1854,885            ","1855,39             ","1856,11,9,4         ","1857,688            ","1858,16,15,7        ","1859,13,10,6        ","1860,13             ",
"1861,25,23,12       ","1862,149            ","1863,260            ","1864,11,9,1         ","1865,53             ","1866,11             ","1867,12,4,2         ","1868,9,7,5          ","1869,11,8,1         ","1870,121            ",
"1871,261            ","1872,10,5,2         ","1873,199            ","1874,20,4,3         ","1875,17,9,2         ","1876,13,9,4         ","1877,12,8,7         ","1878,253            ","1879,174            ","1880,15,4,2         ",
"1881,370            ","1882,9,6,1          ","1883,16,10,9        ","1884,669            ","1885,20,10,9        ","1886,833            ","1887,353            ","1888,17,13,2        ","1889,29             ","1890,371            ",
"1891,9,8,5          ","1892,8,7,1          ","1893,19,8,7         ","1894,12,11,10       ","1895,873            ","1896,26,11,2        ","1897,12,9,1         ","1898,10,7,2         ","1899,13,6,1         ","1900,235            ",
"1901,26,24,19       ","1902,733            ","1903,778            ","1904,12,11,1        ","1905,344            ","1906,931            ","1907,16,6,4         ","1908,945            ","1909,21,19,14       ","1910,18,13,11       ",
"1911,67             ","1912,20,15,10       ","1913,462            ","1914,14,5,1         ","1915,10,9,6         ","1916,18,11,10       ","1917,16,9,7         ","1918,477            ","1919,105            ","1920,11,3,2         ",
"1921,468            ","1922,23,16,15       ","1923,16,15,6        ","1924,327            ","1925,23,10,4        ","1926,357            ","1927,25             ","1928,17,16,7        ","1929,31             ","1930,7,5,2          ",
"1931,16,7,6         ","1932,277            ","1933,14,13,6        ","1934,413            ","1935,103            ","1936,15,10,1        ","1937,231            ","1938,747            ","1939,5,2,1          ","1940,113            ",
"1941,20,10,7        ","1942,15,9,6         ","1943,11             ","1944,27,22,18       ","1945,91             ","1946,51             ","1947,18,13,12       ","1948,603            ","1949,10,7,3         ","1950,9              ",
"1951,121            ","1952,15,14,6        ","1953,17             ","1954,16,11,2        ","1955,23,15,6        ","1956,279            ","1957,16,12,6        ","1958,89             ","1959,371            ","1960,17,15,2        ",
"1961,771            ","1962,99             ","1963,7,6,3          ","1964,21             ","1965,10,7,5         ","1966,801            ","1967,26             ","1968,25,19,14       ","1969,175            ","1970,10,7,2         ",
"1971,20,5,4         ","1972,12,11,1        ","1973,22,5,1         ","1974,165            ","1975,841            ","1976,25,19,17       ","1977,238            ","1978,11,8,6         ","1979,22,21,4        ","1980,33             ",
"1981,8,7,6          ","1982,14,9,2         ","1983,113            ","1984,13,11,5        ","1985,311            ","1986,891            ","1987,20,16,14       ","1988,555            ","1989,23,14,8        ","1990,133            ",
"1991,546            ","1992,6,3,2          ","1993,103            ","1994,15             ","1995,10,7,3         ","1996,307            ","1997,14,10,1        ","1998,15,12,2        ","1999,367            ","2000,13,10,6        ",
"2001,169            ","2002,22,21,11       ","2003,12,10,8        ","2004,441            ","2005,17,12,7        ","2006,917            ","2007,205            ","2008,26,23,13       ","2009,54             ","2010,459            ",
"2011,17,15,4        ","2012,19,15,4        ","2013,5,4,2          ","2014,9,7,6          ","2015,42             ","2016,21,15,7        ","2017,330            ","2018,20,7,3         ","2019,20,7,2         ","2020,81             ",
"2021,19,14,1        ","2022,349            ","2023,165            ","2024,40,35,9        ","2025,274            ","2026,475            ","2027,11,10,3        ","2028,93             ","2029,12,7,4         ","2030,13,12,2        ",
"2031,386            ","2032,7,6,2          ","2033,881            ","2034,143            ","2035,9,8,4          ","2036,71             ","2037,19,18,3        ","2038,16,11,6        ","2039,155            ","2040,7,2,1          ",
"2041,735            ","2042,16,8,7         ","2043,9,7,4          ","2044,45             ","2045,7,6,4          ","2046,12,11,3        ","2047,3              ","2048,19,14,13       ","2049,124            ","2050,15,13,8        ",
"2051,13,6,5         ","2052,323            ","2053,21,13,6        ","2054,201            ","2055,11             ","2056,13,12,3        ","2057,245            ","2058,343            ","2059,14,12,10       ","2060,387            ",
"2061,19,4,1         ","2062,16,3,2         ","2063,48             ","2064,17,9,2         ","2065,97             ","2066,71             ","2067,17,13,8        ","2068,18,10,7        ","2069,18,9,8         ","2070,237            ",
"2071,11,5,3         ","2072,13,10,3        ","2073,253            ","2074,231            ","2075,9,7,4          ","2076,851            ","2077,15,14,4        ","2078,16,6,5         ","2079,35             ","2080,4,3,1          ",
"2081,467            ","2082,523            ","2083,21,11,10       ","2084,4,2,1          ","2085,9,8,3          ","2086,261            ","2087,141            ","2088,18,11,5        ","2089,150            ","2090,9,4,1          ",
"2091,12,9,5         ","2092,17,15,7        ","2093,16,15,7        ","2094,645            ","2095,256            ","2096,19,4,2         ","2097,119            ","2098,19             ","2099,15,12,9        ","2100,35             ",
"2101,25,22,9        ","2102,33             ","2103,98             ","2104,19,15,9        ","2105,153            ","2106,111            ","2107,17,10,2        ","2108,21,5,3         ","2109,10,5,1         ","2110,12,9,6         ",
"2111,249            ","2112,16,13,7        ","2113,385            ","2114,155            ","2115,11,10,1        ","2116,25             ","2117,24,16,11       ","2118,385            ","2119,84             ","2120,17,14,6        ",
"2121,304            ","2122,91             ","2123,14,11,3        ","2124,45             ","2125,24,17,14       ","2126,881            ","2127,539            ","2128,23,9,1         ","2129,21             ","2130,239            ",
"2131,13,6,5         ","2132,213            ","2133,24,22,4        ","2134,23,13,2        ","2135,47             ","2136,15,12,9        ","2137,331            ","2138,13,9,2         ","2139,14,4,1         ","2140,283            ",
"2141,16,3,1         ","2142,69             ","2143,345            ","2144,13,7,3         ","2145,19             ","2146,595            ","2147,8,3,2          ","2148,549            ","2149,17,9,2         ","2150,569            ",
"2151,224            ","2152,24,13,7        ","2153,582            ","2154,10,7,5         ","2155,10,9,8         ","2156,405            ","2157,14,4,1         ","2158,93             ","2159,6              ","2160,31,25,14       ",
"2161,766            ","2162,47             ","2163,12,9,7         ","2164,561            ","2165,10,4,2         ","2166,693            ","2167,840            ","2168,11,9,3         ","2169,55             ","2170,411            ",
"2171,7,6,4          ","2172,6,4,1          ","2173,15,8,4         ","2174,225            ","2175,128            ","2176,15,8,1         ","2177,554            ","2178,15             ","2179,8,7,2          ","2180,111            ",
"2181,18,12,7        ","2182,93             ","2183,162            ","2184,11,10,5        ","2185,51             ","2186,51             ","2187,22,11,1        ","2188,99             ","2189,19,8,7         ","2190,441            ",
"2191,111            ","2192,8,5,3          ","2193,71             ","2194,15,13,9        ","2195,23,22,16       ","2196,539            ","2197,6,5,2          ","2198,893            ","2199,49             ","2200,20,15,5        ",
"2201,143            ","2202,15,3,2         ","2203,14,6,5         ","2204,11,7,1         ","2205,14,7,4         ","2206,793            ","2207,438            ","2208,21,16,6        ","2209,142            ","2210,539            ",
"2211,20,14,3        ","2212,423            ","2213,20,19,4        ","2214,1041           ","2215,39             ","2216,24,7,2         ","2217,455            ","2218,603            ","2219,22,12,11       ","2220,7              ",
"2221,17,16,6        ","2222,333            ","2223,17,6,2         ","2224,21,19,5        ","2225,47             ","2226,19,16,7        ","2227,14,9,8         ","2228,425            ","2229,17,8,7         ","2230,637            ",
"2231,654            ","2232,19,17,4        ","2233,249            ","2234,7,6,1          ","2235,20,17,11       ","2236,63             ","2237,7,4,2          ","2238,1053           ","2239,120            ","2240,23,7,1         ",
"2241,20             ","2242,7              ","2243,27,15,2        ","2244,399            ","2245,22,12,11       ","2246,23,15,6        ","2247,217            ","2248,9,4,3          ","2249,126            ","2250,927            ",
"2251,19,16,13       ","2252,75             ","2253,19,14,2        ","2254,10,9,2         ","2255,729            ","2256,14,9,6         ","2257,829            ","2258,983            ","2259,16,10,6        ","2260,12,4,1         ",
"2261,14,12,7        ","2262,57             ","2263,273            ","2264,15,7,2         ","2265,151            ","2266,343            ","2267,18,17,8        ","2268,115            ","2269,15,10,7        ","2270,369            ",
"2271,560            ","2272,21,10,9        ","2273,630            ","2274,239            ","2275,15,12,1        ","2276,21             ","2277,10,4,2         ","2278,17,14,7        ","2279,276            ","2280,13,4,2         ",
"2281,715            ","2282,975            ","2283,20,13,4        ","2284,889            ","2285,8,6,2          ","2286,249            ","2287,651            ","2288,17,16,7        ","2289,136            ","2290,23,6,5         ",
"2291,13,10,2        ","2292,89             ","2293,10,8,3         ","2294,21,17,10       ","2295,259            ","2296,15,10,1        ","2297,405            ","2298,15,13,3        ","2299,16,6,1         ","2300,95             ",
"2301,15,9,8         ","2302,15,8,1         ","2303,80             ","2304,8,7,5          ","2305,424            ","2306,551            ","2307,11,7,2         ","2308,31             ","2309,12,10,8        ","2310,233            ",
"2311,148            ","2312,19,6,4         ","2313,221            ","2314,879            ","2315,17,15,4        ","2316,21             ","2317,17,4,2         ","2318,245            ","2319,161            ","2320,13,11,5        ",
"2321,543            ","2322,83             ","2323,16,3,2         ","2324,717            ","2325,14,8,5         ","2326,13,10,7        ","2327,32             ","2328,15,9,2         ","2329,105            ","2330,15,5,1         ",
"2331,14             ","2332,349            ","2333,18,15,8        ","2334,1125           ","2335,553            ","2336,15,10,8        ","2337,523            ","2338,211            ","2339,10,3,2         ","2340,39             ",
"2341,24,18,16       ","2342,65             ","2343,415            ","2344,27,26,14       ","2345,29             ","2346,987            ","2347,11,10,2        ","2348,731            ","2349,31,16,9        ","2350,21,19,4        ",
"2351,950            ","2352,23,20,2        ","2353,328            ","2354,14,11,6        ","2355,12,11,6        ","2356,183            ","2357,10,9,8         ","2358,161            ","2359,172            ","2360,19,10,8        ",
"2361,646            ","2362,13,10,6        ","2363,9,7,4          ","2364,643            ","2365,21,14,5        ","2366,16,13,6        ","2367,610            ","2368,13,11,8        ","2369,77             ","2370,12,11,6        ",
"2371,20,18,17       ","2372,1139           ","2373,17,14,5        ","2374,24,16,13       ","2375,198            ","2376,7,5,4          ","2377,381            ","2378,243            ","2379,22,9,3         ","2380,1              ",
"2381,18,12,2        ","2382,429            ","2383,49             ","2384,21,19,1        ","2385,607            ","2386,11,9,1         ","2387,8,7,6          ","2388,11             ","2389,31,12,10       ","2390,629            ",
"2391,956            ","2392,31,13,3        ","2393,59             ","2394,423            ","2395,17,8,7         ","2396,173            ","2397,22,17,4        ","2398,15,13,11       ","2399,107            ","2400,20,19,17       ",
"2401,61             ","2402,251            ","2403,11,8,2         ","2404,67             ","2405,17,14,5        ","2406,14,12,5        ","2407,91             ","2408,23,6,4         ","2409,1198           ","2410,807            ",
"2411,12,2,1         ","2412,25             ","2413,11,6,1         ","2414,29             ","2415,154            ","2416,23,6,5         ","2417,225            ","2418,311            ","2419,22,16,6        ","2420,77             ",
"2421,11,8,4         ","2422,1117           ","2423,102            ","2424,21,16,6        ","2425,678            ","2426,20,4,3         ","2427,8,6,5          ","2428,301            ","2429,22,14,7        ","2430,477            ",
"2431,303            ","2432,29,22,19       ","2433,305            ","2434,507            ","2435,18,6,2         ","2436,145            ","2437,9,4,3          ","2438,929            ","2439,404            ","2440,12,7,5         ",
"2441,339            ","2442,127            ","2443,15,13,4        ","2444,1115           ","2445,23,20,10       ","2446,18,13,6        ","2447,786            ","2448,21,10,4        ","2449,621            ","2450,191            ",
"2451,10,4,3         ","2452,331            ","2453,21,14,11       ","2454,357            ","2455,313            ","2456,12,5,3         ","2457,238            ","2458,23,20,18       ","2459,17,7,4         ","2460,35             ",
"2461,19,18,10       ","2462,22,13,8        ","2463,1172           ","2464,5,4,3          ","2465,531            ","2466,599            ","2467,18,14,2        ","2468,99             ","2469,26,16,11       ","2470,217            ",
"2471,15,6,3         ","2472,12,3,1         ","2473,225            ","2474,899            ","2475,12,11,9        ","2476,17,3,2         ","2477,19,17,6        ","2478,765            ","2479,72             ","2480,20,5,2         ",
"2481,710            ","2482,11,7,6         ","2483,12,11,2        ","2484,523            ","2485,142            ","2486,19,14,9        ","2487,155            ","2488,23,13,9        ","2489,315            ","2490,8,7,5          ",
"2491,25,16,12       ","2492,141            ","2493,18,15,7        ","2494,13,8,2         ","2495,497            ","2496,12,3,1         ","2497,1171           ","2498,8,7,4          ","2499,13,12,9        ","2500,135            ",
"2501,22,21,5        ","2502,45             ","2503,316            ","2504,19,8,6         ","2505,131            ","2506,17,11,3        ","2507,13,8,1         ","2508,25             ","2509,14,13,3        ","2510,1113           ",
"2511,110            ","2512,29,21,7        ","2513,99             ","2514,183            ","2515,8,7,5          ","2516,563            ","2517,14,4,1         ","2518,18,13,2        ","2519,579            ","2520,31,15,13       ",
"2521,426            ","2522,16,10,5        ","2523,23,17,14       ","2524,15,6,4         ","2525,7,6,5          ","2526,141            ","2527,640            ","2528,19,9,4         ","2529,49             ","2530,14,5,3         ",
"2531,6,2,1          ","2532,26,22,13       ","2533,10,3,1         ","2534,185            ","2535,24,19,16       ","2536,21,10,9        ","2537,77             ","2538,315            ","2539,10,9,3         ","2540,209            ",
"2541,11,8,7         ","2542,97             ","2543,240            ","2544,21,20,6        ","2545,982            ","2546,891            ","2547,22,10,3        ","2548,373            ","2549,10,9,5         ","2550,333            ",
"2551,103            ","2552,28,3,2         ","2553,28             ","2554,1123           ","2555,9,6,2          ","2556,349            ","2557,18,17,7        ","2558,18,8,1         ","2559,23             ","2560,9,3,1          ",
"2561,201            ","2562,203            ","2563,12,11,10       ","2564,561            ","2565,25,16,14       ","2566,37             ","2567,122            ","2568,8,5,2          ","2569,69             ","2570,18,15,14       ",
"2571,18,16,9        ","2572,535            ","2573,12,11,3        ","2574,5              ","2575,867            ","2576,7,2,1          ","2577,674            ","2578,15,7,3         ","2579,23,6,1         ","2580,105            ",
"2581,26,14,12       ","2582,22,19,15       ","2583,31             ","2584,25,19,12       ","2585,263            ","2586,1047           ","2587,23,12,10       ","2588,13,8,1         ","2589,29,11,10       ","2590,1017           ",
"2591,219            ","2592,15,12,5        ","2593,297            ","2594,863            ","2595,24,17,2        ","2596,145            ","2597,16,8,7         ","2598,225            ","2599,289            ","2600,14,13,7        ",
"2601,406            ","2602,11,6,1         ","2603,18,8,7         ","2604,435            ","2605,19,14,5        ","2606,1181           ","2607,34             ","2608,15,11,2        ","2609,425            ","2610,427            ",
"2611,27,17,10       ","2612,21,14,6        ","2613,14,12,9        ","2614,553            ","2615,518            ","2616,17,8,7         ","2617,462            ","2618,71             ","2619,17,10,1        ","2620,835            ",
"2621,8,7,1          ","2622,11,5,3         ","2623,409            ","2624,15,10,4        ","2625,112            ","2626,43             ","2627,20,17,11       ","2628,47             ","2629,13,9,6         ","2630,177            ",
"2631,139            ","2632,19,5,3         ","2633,1241           ","2634,20,11,5        ","2635,25,21,14       ","2636,18,11,10       ","2637,9,6,4          ","2638,10,3,1         ","2639,144            ","2640,23,11,9        ",
"2641,736            ","2642,551            ","2643,16,13,10       ","2644,597            ","2645,18,11,10       ","2646,297            ","2647,513            ","2648,15,8,1         ","2649,689            ","2650,17,13,5        ",
"2651,7,5,4          ","2652,519            ","2653,17,4,2         ","2654,20,16,13       ","2655,53             ","2656,19,11,5        ","2657,242            ","2658,6,3,2          ","2659,20,18,16       ","2660,5              ",
"2661,17,14,2        ","2662,14,12,7        ","2663,458            ","2664,27,21,19       ","2665,772            ","2666,663            ","2667,254            ","2668,819            ","2669,18,4,2         ","2670,229            ",
"2671,46             ","2672,18,7,1         ","2673,530            ","2674,967            ","2675,13,10,9        ","2676,93             ","2677,17,8,6         ","2678,15,6,5         ","2679,286            ","2680,15,9,4         ",
"2681,635            ","2682,463            ","2683,11,6,1         ","2684,14,12,3        ","2685,8,2,1          ","2686,789            ","2687,225            ","2688,21,10,6        ","2689,36             ","2690,12,9,3         ",
"2691,14,10,8        ","2692,577            ","2693,10,5,3         ","2694,621            ","2695,123            ","2696,17,15,12       ","2697,170            ","2698,963            ","2699,32,30,29       ","2700,3              ",
"2701,12,10,5        ","2702,257            ","2703,67             ","2704,12,9,7         ","2705,12,10,5        ","2706,515            ","2707,9,6,4          ","2708,423            ","2709,10,9,3         ","2710,7,3,1          ",
"2711,690            ","2712,21,12,7        ","2713,840            ","2714,12,8,7         ","2715,30,26,15       ","2716,255            ","2717,14,8,3         ","2718,369            ","2719,102            ","2720,25,18,1        ",
"2721,826            ","2722,127            ","2723,9,6,5          ","2724,121            ","2725,21,17,2        ","2726,10,6,1         ","2727,430            ","2728,21,7,5         ","2729,96             ","2730,343            ",
"2731,15,11,2        ","2732,845            ","2733,19,8,7         ","2734,9,5,4          ","2735,933            ","2736,16,3,1         ","2737,226            ","2738,923            ","2739,12,9,5         ","2740,109            ",
"2741,6,5,4          ","2742,149            ","2743,447            ","2744,19,18,10       ","2745,484            ","2746,9,7,2          ","2747,15,11,6        ","2748,25             ","2749,22,18,17       ","2750,629            ",
"2751,49             ","2752,15,4,2         ","2753,716            ","2754,231            ","2755,13,7,6         ","2756,159            ","2757,24,23,12       ","2758,17,5,4         ","2759,842            ","2760,29,26,7        ",
"2761,108            ","2762,1319           ","2763,12,10,6        ","2764,687            ","2765,16,10,3        ","2766,1285           ","2767,102            ","2768,25,19,15       ","2769,269            ","2770,567            ",
"2771,13,12,5        ","2772,135            ","2773,30,25,20       ","2774,28,3,2         ","2775,802            ","2776,7,3,2          ","2777,22,21,17       ","2778,1095           ","2779,20,17,9        ","2780,51             ",
"2781,28,27,10       ","2782,22,10,9        ","2783,168            ","2784,29,21,15       ","2785,349            ","2786,339            ","2787,19,18,3        ","2788,21,16,2        ","2789,14,12,8        ","2790,837            ",
"2791,490            ","2792,12,7,2         ","2793,343            ","2794,11,9,4         ","2795,10,8,4         ","2796,769            ","2797,19,6,1         ","2798,20,14,5        ","2799,880            ","2800,17,14,6        ",
"2801,279            ","2802,18,14,3        ","2803,18,16,13       ","2804,609            ","2805,24,8,2         ","2806,729            ","2807,270            ","2808,15,13,1        ","2809,1342           ","2810,23,10,9        ",
"2811,10,9,7         ","2812,453            ","2813,13,7,6         ","2814,621            ","2815,84             ","2816,21,19,8        ","2817,109            ","2818,15,9,1         ","2819,10,6,5         ","2820,815            ",
"2821,16,6,4         ","2822,18,17,3        ","2823,592            ","2824,15,14,10       ","2825,288            ","2826,135            ","2827,19,10,6        ","2828,1103           ","2829,9,6,4          ","2830,17,15,13       ",
"2831,186            ","2832,27,18,1        ","2833,409            ","2834,15,13,7        ","2835,20,13,5        ","2836,1113           ","2837,17,8,3         ","2838,20,4,1         ","2839,1033           ","2840,20,15,9        ",
"2841,370            ","2842,1231           ","2843,7,3,2          ","2844,25             ","2845,10,9,1         ","2846,23,15,4        ","2847,329            ","2848,15,8,1         ","2849,114            ","2850,1411           ",
"2851,10,7,1         ","2852,1145           ","2853,14,8,1         ","2854,313            ","2855,41             ","2856,15,13,3        ","2857,756            ","2858,17,9,7         ","2859,29,20,11       ","2860,603            ",
"2861,20,16,10       ","2862,405            ","2863,139            ","2864,21,17,15       ","2865,212            ","2866,9,7,2          ","2867,15,13,10       ","2868,915            ","2869,8,6,1          ","2870,12,11,1        ",
"2871,272            ","2872,21,5,2         ","2873,75             ","2874,13,6,3         ","2875,20,16,2        ","2876,605            ","2877,10,7,4         ","2878,781            ","2879,149            ","2880,13,10,6        ",
"2881,1201           ","2882,1431           ","2883,16,13,12       ","2884,529            ","2885,13,11,6        ","2886,20,14,9        ","2887,469            ","2888,11,4,1         ","2889,76             ","2890,31             ",
"2891,16,15,10       ","2892,309            ","2893,27,7,2         ","2894,16,14,9        ","2895,358            ","2896,29,6,1         ","2897,15             ","2898,91             ","2899,19,10,1        ","2900,303            ",
"2901,11,3,2         ","2902,14,10,9        ","2903,279            ","2904,27,15,6        ","2905,321            ","2906,1155           ","2907,17,14,1        ","2908,19,13,10       ","2909,23,22,4        ","2910,1301           ",
"2911,685            ","2912,16,9,2         ","2913,238            ","2914,351            ","2915,18,7,5         ","2916,21             ","2917,16,15,4        ","2918,237            ","2919,149            ","2920,19,9,5         ",
"2921,480            ","2922,559            ","2923,11,6,5         ","2924,12,4,1         ","2925,12,4,3         ","2926,20,14,1        ","2927,974            ","2928,24,21,11       ","2929,651            ","2930,9,4,1          ",
"2931,13,8,1         ","2932,14,7,6         ","2933,15,14,13       ","2934,713            ","2935,13,12,7        ","2936,5,3,2          ","2937,172            ","2938,499            ","2939,30,17,5        ","2940,49             ",
"2941,23,18,17       ","2942,1425           ","2943,320            ","2944,5,3,2          ","2945,146            ","2946,551            ","2947,22,20,11       ","2948,17,3,2         ","2949,17,7,4         ","2950,397            ",
"2951,872            ","2952,17,13,2        ","2953,33             ","2954,9,6,5          ","2955,12,10,6        ","2956,823            ","2957,19,14,3        ","2958,23,13,5        ","2959,69             ","2960,12,3,2         ",
"2961,86             ","2962,319            ","2963,21,14,5        ","2964,83             ","2965,25,22,15       ","2966,861            ","2967,1028           ","2968,29,27,4        ","2969,561            ","2970,583            ",
"2971,18,13,2        ","2972,693            ","2973,18,10,4        ","2974,11,3,1         ","2975,192            ","2976,21,10,3        ","2977,126            ","2978,375            ","2979,12,11,6        ","2980,381            ",
"2981,13,2,1         ","2982,669            ","2983,330            ","2984,17,9,6         ","2985,166            ","2986,343            ","2987,8,3,2          ","2988,313            ","2989,18,9,7         ","2990,26,22,9        ",
"2991,292            ","2992,23,3,1         ","2993,569            ","2994,303            ","2995,9,6,4          ","2996,345            ","2997,12,6,5         ","2998,669            ","2999,1011           ","3000,15,12,9        ",
"3001,975            ","3002,22,21,10       ","3003,12,11,5        ","3004,351            ","3005,14,12,5        ","3006,15,9,6         ","3007,963            ","3008,15,13,1        ","3009,1349           ","3010,25,12,10       ",
"3011,22,8,6         ","3012,1327           ","3013,23,6,2         ","3014,17,15,5        ","3015,308            ","3016,38,25,9        ","3017,108            ","3018,203            ","3019,16,6,1         ","3020,413            ",
"3021,22,10,1        ","3022,14,12,1        ","3023,734            ","3024,32,3,2         ","3025,757            ","3026,19,18,13       ","3027,17,16,4        ","3028,135            ","3029,11,6,4         ","3030,12,9,4         ",
"3031,55             ","3032,17,15,4        ","3033,238            ","3034,399            ","3035,21,20,2        ","3036,391            ","3037,7,6,3          ","3038,633            ","3039,436            ","3040,27,21,3        ",
"3041,776            ","3042,415            ","3043,18,16,15       ","3044,69             ","3045,17,14,11       ","3046,1021           ","3047,19,15,4        ","3048,18,3,2         ","3049,765            ","3050,651            ",
"3051,19,17,16       ","3052,363            ","3053,22,20,15       ","3054,21,4,3         ","3055,13,7,1         ","3056,5,4,3          ","3057,110            ","3058,811            ","3059,15,10,1        ","3060,405            ",
"3061,22,15,1        ","3062,1053           ","3063,32             ","3064,25,11,9        ","3065,432            ","3066,455            ","3067,18,16,13       ","3068,215            ","3069,34,26,19       ","3070,20,13,8        ",
"3071,65             ","3072,11,10,5        ","3073,184            ","3074,17,9,3         ","3075,16,14,10       ","3076,475            ","3077,12,10,8        ","3078,105            ","3079,174            ","3080,21,19,16       ",
"3081,64             ","3082,9,6,1          ","3083,23,20,18       ","3084,109            ","3085,25,14,12       ","3086,1281           ","3087,49             ","3088,20,13,11       ","3089,261            ","3090,279            ",
"3091,12,7,5         ","3092,45             ","3093,14,11,8        ","3094,769            ","3095,419            ","3096,33,29,14       ","3097,1162           ","3098,18,17,11       ","3099,14,13,11       ","3100,45             ",
"3101,10,7,3         ","3102,225            ","3103,124            ","3104,23,9,5         ","3105,833            ","3106,6,2,1          ","3107,14,12,11       ","3108,61             ","3109,26,20,19       ","3110,1421           ",
"3111,199            ","3112,17,15,1        ","3113,191            ","3114,19,15,4        ","3115,25,18,16       ","3116,461            ","3117,19,8,4         ","3118,525            ","3119,315            ","3120,18,17,11       ",
"3121,493            ","3122,22,7,6         ","3123,15,10,4        ","3124,861            ","3125,24,21,18       ","3126,449            ","3127,139            ","3128,30,19,11       ","3129,23             ","3130,867            ",
"3131,22,8,7         ","3132,123            ","3133,6,4,3          ","3134,89             ","3135,356            ","3136,15,12,10       ","3137,587            ","3138,29,19,13       ","3139,14,11,10       ","3140,1115           ",
"3141,23,18,12       ","3142,981            ","3143,8              ","3144,23,21,8        ","3145,112            ","3146,18,11,6        ","3147,17,10,7        ","3148,1171           ","3149,22,3,2         ","3150,253            ",
"3151,1254           ","3152,21,17,6        ","3153,98             ","3154,19,17,6        ","3155,15,12,2        ","3156,565            ","3157,24,14,10       ","3158,19,9,5         ","3159,103            ","3160,7,6,2          ",
"3161,858            ","3162,315            ","3163,18,13,10       ","3164,113            ","3165,17,13,10       ","3166,18,10,1        ","3167,672            ","3168,33,31,18       ","3169,1123           ","3170,783            ",
"3171,19,14,13       ","3172,301            ","3173,20,17,14       ","3174,81             ","3175,646            ","3176,13,10,5        ","3177,484            ","3178,915            ","3179,22,12,2        ","3180,1085           ",
"3181,12,10,3        ","3182,1205           ","3183,1225           ","3184,11,10,2        ","3185,204            ","3186,891            ","3187,9,8,2          ","3188,129            ","3189,19,18,12       ","3190,12,4,1         ",
"3191,495            ","3192,25,8,7         ","3193,211            ","3194,1059           ","3195,19,14,1        ","3196,175            ","3197,22,16,14       ","3198,841            ","3199,54             ","3200,11,6,4         ",
"3201,674            ","3202,24,12,3        ","3203,14,7,3         ","3204,31             ","3205,17,9,2         ","3206,15,8,6         ","3207,704            ","3208,16,13,3        ","3209,81             ","3210,1303           ",
"3211,12,10,5        ","3212,1559           ","3213,30,16,1        ","3214,1197           ","3215,614            ","3216,21,11,3        ","3217,67             ","3218,10,9,8         ","3219,24,10,3        ","3220,19             ",
"3221,11,6,5         ","3222,145            ","3223,784            ","3224,23,19,1        ","3225,101            ","3226,9,7,5          ","3227,8,7,6          ","3228,1225           ","3229,12,9,7         ","3230,501            ",
"3231,15,9,8         ","3232,12,9,7         ","3233,575            ","3234,511            ","3235,21,11,8        ","3236,887            ","3237,19,8,4         ","3238,409            ","3239,98             ","3240,12,3,2         ",
"3241,127            ","3242,27,13,7        ","3243,22,13,5        ","3244,1249           ","3245,11,10,4        ","3246,1221           ","3247,426            ","3248,15,8,1         ","3249,149            ","3250,15,11,8        ",
"3251,9,6,5          ","3252,567            ","3253,10,5,3         ","3254,1485           ","3255,124            ","3256,31,26,2        ","3257,806            ","3258,203            ","3259,22,4,1         ","3260,237            ",
"3261,18,12,10       ","3262,15,13,7        ","3263,939            ","3264,17,5,2         ","3265,18,16,7        ","3266,19,2,1         ","3267,20,19,10       ","3268,73             ","3269,22,3,2         ","3270,237            ",
"3271,333            ","3272,23,10,1        ","3273,1408           ","3274,775            ","3275,24,13,10       ","3276,69             ","3277,25,22,1        ","3278,22,12,1        ","3279,446            ","3280,16,15,6        ",
"3281,47             ","3282,783            ","3283,30,28,21       ","3284,24,17,13       ","3285,18,4,1         ","3286,397            ","3287,717            ","3288,21,18,11       ","3289,43             ","3290,11,7,3         ",
"3291,18,7,1         ","3292,61             ","3293,20,18,15       ","3294,249            ","3295,594            ","3296,19,14,13       ","3297,7              ","3298,639            ","3299,18,17,14       ","3300,55             ",
"3301,24,10,4        ","3302,605            ","3303,1336           ","3304,19,17,3        ","3305,806            ","3306,127            ","3307,15,10,2        ","3308,717            ","3309,23,20,6        ","3310,1              ",
"3311,618            ","3312,14,9,3         ","3313,436            ","3314,1019           ","3315,12,8,2         ","3316,1641           ","3317,22,17,7        ","3318,585            ","3319,58             ","3320,17,10,4        ",
"3321,20             ","3322,567            ","3323,28,14,10       ","3324,173            ","3325,25,19,10       ","3326,1145           ","3327,875            ","3328,17,9,2         ","3329,525            ","3330,191            ",
"3331,18,17,11       ","3332,587            ","3333,16,8,7         ","3334,6,4,1          ","3335,636            ","3336,11,10,5        ","3337,370            ","3338,1155           ","3339,22,16,12       ","3340,11,7,5         ",
"3341,25,19,12       ","3342,9,6,5          ","3343,73             ","3344,30,27,15       ","3345,796            ","3346,15,6,1         ","3347,23,18,16       ","3348,177            ","3349,20,19,17       ","3350,1401           ",
"3351,731            ","3352,21,20,19       ","3353,389            ","3354,10,9,3         ","3355,10,6,4         ","3356,339            ","3357,24,17,15       ","3358,19,8,6         ","3359,99             ","3360,18,15,5        ",
"3361,12,10,4        ","3362,11,7,4         ","3363,14,10,2        ","3364,85             ","3365,24,15,2        ","3366,257            ","3367,136            ","3368,7,5,1          ","3369,1541           ","3370,15,10,1        ",
"3371,30,29,18       ","3372,47             ","3373,14,6,4         ","3374,417            ","3375,49             ","3376,11,9,1         ","3377,236            ","3378,623            ","3379,25,20,9        ","3380,659            ",
"3381,7,4,1          ","3382,217            ","3383,956            ","3384,21,9,3         ","3385,603            ","3386,19,9,2         ","3387,26,25,16       ","3388,169            ","3389,17,15,4        ","3390,1381           ",
"3391,465            ","3392,23,13,6        ","3393,1615           ","3394,13,12,3        ","3395,22,10,6        ","3396,13,6,1         ","3397,19,4,1         ","3398,245            ","3399,416            ","3400,14,13,6        ",
"3401,531            ","3402,387            ","3403,15,12,6        ","3404,173            ","3405,24,9,2         ","3406,22,13,12       ","3407,507            ","3408,16,15,6        ","3409,244            ","3410,1023           ",
"3411,14,8,5         ","3412,325            ","3413,14,9,6         ","3414,93             ","3415,1272           ","3416,28,27,1        ","3417,32             ","3418,15             ","3419,12,9,3         ","3420,423            ",
"3421,19,14,5        ","3422,1121           ","3423,11             ","3424,22,15,6        ","3425,189            ","3426,1071           ","3427,16,12,1        ","3428,17,16,13       ","3429,16,12,6        ","3430,153            ",
"3431,153            ","3432,25,2,1         ","3433,28,25,12       ","3434,14,13,12       ","3435,15,14,5        ","3436,159            ","3437,18,16,10       ","3438,393            ","3439,147            ","3440,27,16,1        ",
"3441,394            ","3442,8,7,3          ","3443,26,19,3        ","3444,69             ","3445,21,5,2         ","3446,21,17,8        ","3447,404            ","3448,17,11,6        ","3449,917            ","3450,11,8,3         ",
"3451,19,14,9        ","3452,1145           ","3453,16,6,1         ","3454,25,23,21       ","3455,21             ","3456,19,18,9        ","3457,120            ","3458,519            ","3459,19,18,12       ","3460,1495           ",
"3461,20,10,7        ","3462,225            ","3463,289            ","3464,11,6,3         ","3465,304            ","3466,43             ","3467,28,26,6        ","3468,921            ","3469,38,16,6        ","3470,917            ",
"3471,314            ","3472,17,14,7        ","3473,720            ","3474,735            ","3475,30,16,13       ","3476,525            ","3477,16,15,12       ","3478,465            ","3479,155            ","3480,19,15,13       ",
"3481,546            ","3482,15,5,4         ","3483,12,5,2         ","3484,1329           ","3485,8,7,4          ","3486,1085           ","3487,120            ","3488,12,11,1        ","3489,518            ","3490,16,12,3        ",
"3491,19,14,7        ","3492,57             ","3493,19,18,1        ","3494,25,19,9        ","3495,254            ","3496,35,21,4        ","3497,1025           ","3498,567            ","3499,29,24,4        ","3500,375            ",
"3501,15,8,2         ","3502,15,13,6        ","3503,993            ","3504,23,17,10       ","3505,103            ","3506,13,5,3         ","3507,21,14,6        ","3508,10,7,6         ","3509,23,12,7        ","3510,81             ",
"3511,1141           ","3512,37,35,6        ","3513,41             ","3514,11,9,4         ","3515,17,10,9        ","3516,667            ","3517,22,14,12       ","3518,16,14,9        ","3519,569            ","3520,32,29,3        ",
"3521,129            ","3522,399            ","3523,23,12,2        ","3524,1439           ","3525,10,7,5         ","3526,12,11,10       ","3527,476            ","3528,25,18,7        ","3529,270            ","3530,10,9,5         ",
"3531,18,3,1         ","3532,1561           ","3533,30,3,2         ","3534,973            ","3535,162            ","3536,12,7,5         ","3537,218            ","3538,13,6,5         ","3539,16,2,1         ","3540,75             ",
"3541,23,7,2         ","3542,345            ","3543,377            ","3544,21,14,2        ","3545,998            ","3546,151            ","3547,26,23,12       ","3548,255            ","3549,14,6,3         ","3550,1269           ",
"3551,183            ","3552,15,9,6         ","3553,13,3,2         ","3554,24,23,17       ","3555,28,25,15       ","3556,127            ","3557,14,8,5         ","3558,397            ","3559,69             ","3560,17,3,2         ",
"3561,257            ","3562,927            ","3563,18,15,6        ","3564,225            ","3565,22,17,12       ","3566,8,6,1          ","3567,24,20,12       ","3568,21,12,10       ","3569,1028           ","3570,699            ",
"3571,30,13,3        ","3572,1143           ","3573,13,8,2         ","3574,889            ","3575,339            ","3576,19,10,3        ","3577,348            ","3578,17,9,5         ","3579,20,14,6        ","3580,915            ",
"3581,22,15,2        ","3582,713            ","3583,747            ","3584,25,12,10       ","3585,7              ","3586,19,14,8        ","3587,26,6,5         ","3588,843            ","3589,30,28,8        ","3590,1713           ",
"3591,509            ","3592,38,33,14       ","3593,72             ","3594,59             ","3595,28,14,2        ","3596,383            ","3597,22,9,3         ","3598,24,5,1         ","3599,114            ","3600,9,5,2          ",
"3601,669            ","3602,10,2,1         ","3603,23,11,6        ","3604,637            ","3605,8,7,4          ","3606,861            ","3607,142            ","3608,15,14,10       ","3609,1016           ","3610,12,5,2         ",
"3611,18,7,1         ","3612,215            ","3613,17,7,6         ","3614,29             ","3615,47             ","3616,25,18,7        ","3617,377            ","3618,1539           ","3619,13,12,5        ","3620,231            ",
"3621,22,21,16       ","3622,481            ","3623,10,9,7         ","3624,29,27,12       ","3625,279            ","3626,26,25,13       ","3627,7,6,4          ","3628,957            ","3629,15,10,2        ","3630,729            ",
"3631,90             ","3632,26,17,5        ","3633,553            ","3634,651            ","3635,15,8,2         ","3636,391            ","3637,7,6,5          ","3638,28,8,1         ","3639,76             ","3640,20,15,10       ",
"3641,1626           ","3642,771            ","3643,14,13,8        ","3644,1365           ","3645,21,14,6        ","3646,20,17,6        ","3647,45             ","3648,23,7,2         ","3649,394            ","3650,1691           ",
"3651,15,13,6        ","3652,721            ","3653,10,9,8         ","3654,273            ","3655,112            ","3656,17,12,11       ","3657,928            ","3658,1471           ","3659,18,13,2        ","3660,61             ",
"3661,16,11,6        ","3662,1365           ","3663,130            ","3664,35,24,14       ","3665,189            ","3666,30,20,11       ","3667,15,6,4         ","3668,269            ","3669,22,7,4         ","3670,23,4,3         ",
"3671,101            ","3672,19,17,8        ","3673,544            ","3674,27,15,11       ","3675,30,10,9        ","3676,609            ","3677,25,20,7        ","3678,501            ","3679,21             ","3680,14,13,7        ",
"3681,115            ","3682,471            ","3683,15,13,10       ","3684,81             ","3685,9,4,3          ","3686,81             ","3687,889            ","3688,32,13,11       ","3689,759            ","3690,839            ",
"3691,26,9,2         ","3692,6,5,3          ","3693,26,20,18       ","3694,1129           ","3695,62             ","3696,36,33,22       ","3697,91             ","3698,1719           ","3699,24,21,5        ","3700,675            ",
"3701,4,2,1          ","3702,1281           ","3703,429            ","3704,14,13,1        ","3705,148            ","3706,1195           ","3707,11,6,1         ","3708,147            ","3709,16,14,6        ","3710,797            ",
"3711,1735           ","3712,13,12,7        ","3713,413            ","3714,459            ","3715,20,18,11       ","3716,24,11,4        ","3717,18,15,4        ","3718,23,18,10       ","3719,488            ","3720,17,15,11       ",
"3721,31             ","3722,15,7,5         ","3723,18,6,4         ","3724,10,9,8         ","3725,21,14,8        ","3726,609            ","3727,42             ","3728,9,4,2          ","3729,184            ","3730,1191           ",
"3731,26,20,5        ","3732,1327           ","3733,8,7,3          ","3734,1305           ","3735,46             ","3736,33,22,18       ","3737,287            ","3738,75             ","3739,18,10,5        ","3740,95             ",
"3741,16,15,4        ","3742,25,18,11       ","3743,279            ","3744,27,14,2        ","3745,684            ","3746,22,9,7         ","3747,32,22,11       ","3748,19,11,8        ","3749,15,4,1         ","3750,1013           ",
"3751,435            ","3752,9,4,2          ","3753,407            ","3754,1611           ","3755,15,13,8        ","3756,291            ","3757,18,16,5        ","3758,21,20,9        ","3759,208            ","3760,23,9,1         ",
"3761,30             ","3762,383            ","3763,23,10,2        ","3764,1307           ","3765,28,19,12       ","3766,21,15,1        ","3767,672            ","3768,14,7,2         ","3769,300            ","3770,107            ",
"3771,13,10,9        ","3772,61             ","3773,10,9,4         ","3774,24,9,4         ","3775,1416           ","3776,7,5,4          ","3777,1414           ","3778,9,5,1          ","3779,23,8,2         ","3780,63             ",
"3781,10,9,6         ","3782,1785           ","3783,272            ","3784,29,13,6        ","3785,87             ","3786,1027           ","3787,14,6,1         ","3788,1173           ","3789,16,15,4        ","3790,22,21,17       ",
"3791,45             ","3792,20,7,5         ","3793,481            ","3794,17,4,3         ","3795,8,7,5          ","3796,127            ","3797,16,8,6         ","3798,1337           ","3799,202            ","3800,24,23,21       ",
"3801,112            ","3802,16,15,8        ","3803,18,15,6        ","3804,349            ","3805,18,12,9        ","3806,9,7,5          ","3807,68             ","3808,29,18,4        ","3809,938            ","3810,323            ",
"3811,9,8,4          ","3812,1799           ","3813,11,8,7         ","3814,22,21,11       ","3815,143            ","3816,19,13,9        ","3817,252            ","3818,17,8,6         ","3819,16,6,3         ","3820,20,11,3        ",
"3821,8,7,6          ","3822,29             ","3823,609            ","3824,19,13,2        ","3825,437            ","3826,23,8,1         ","3827,18,13,8        ","3828,1217           ","3829,13,9,6         ","3830,713            ",
"3831,310            ","3832,35,13,2        ","3833,35             ","3834,567            ","3835,15,5,4         ","3836,681            ","3837,22,18,3        ","3838,273            ","3839,503            ","3840,27,9,1         ",
"3841,840            ","3842,1331           ","3843,16,5,2         ","3844,1063           ","3845,11,10,9        ","3846,693            ","3847,108            ","3848,29,18,13       ","3849,71             ","3850,583            ",
"3851,29,24,19       ","3852,169            ","3853,12,7,5         ","3854,765            ","3855,1399           ","3856,39,25,3        ","3857,50             ","3858,459            ","3859,14,8,7         ","3860,35             ",
"3861,31,10,2        ","3862,18,16,5        ","3863,834            ","3864,19,15,9        ","3865,289            ","3866,315            ","3867,20,14,6        ","3868,13,12,9        ","3869,24,22,13       ","3870,913            ",
"3871,264            ","3872,10,3,2         ","3873,32             ","3874,20,8,3         ","3875,11,10,4        ","3876,157            ","3877,17,11,4        ","3878,19,9,2         ","3879,121            ","3880,27,5,1         ",
"3881,810            ","3882,1775           ","3883,20,9,2         ","3884,45             ","3885,15,8,3         ","3886,273            ","3887,915            ","3888,45,42,6        ","3889,340            ","3890,20,19,10       ",
"3891,17,9,2         ","3892,289            ","3893,16,13,2        ","3894,1197           ","3895,777            ","3896,15,7,5         ","3897,310            ","3898,25,9,1         ","3899,21,20,12       ","3900,65             ",
"3901,26,6,1         ","3902,1845           ","3903,350            ","3904,17,13,2        ","3905,26             ","3906,251            ","3907,15,4,1         ","3908,855            ","3909,14,12,11       ","3910,28,22,13       ",
"3911,1673           ","3912,24,11,2        ","3913,393            ","3914,531            ","3915,25,22,9        ","3916,445            ","3917,16,12,11       ","3918,117            ","3919,285            ","3920,15,13,8        ",
"3921,785            ","3922,26,21,1        ","3923,24,21,3        ","3924,245            ","3925,18,16,5        ","3926,17,16,12       ","3927,367            ","3928,8,7,5          ","3929,1440           ","3930,199            ",
"3931,23,9,4         ","3932,1563           ","3933,30,19,3        ","3934,28,12,5        ","3935,20,15,8        ","3936,15,5,3         ","3937,252            ","3938,1835           ","3939,28,19,10       ","3940,21,5,2         ",
"3941,19,11,6        ","3942,57             ","3943,1125           ","3944,31,29,28       ","3945,427            ","3946,1155           ","3947,22,10,5        ","3948,293            ","3949,28,22,3        ","3950,873            ",
"3951,752            ","3952,11,6,5         ","3953,698            ","3954,503            ","3955,24,8,5         ","3956,429            ","3957,18,16,10       ","3958,27,4,2         ","3959,891            ","3960,29,15,2        ",
"3961,756            ","3962,255            ","3963,13,8,1         ","3964,735            ","3965,14,3,2         ","3966,337            ","3967,357            ","3968,25,18,14       ","3969,196            ","3970,163            ",
"3971,10,7,2         ","3972,595            ","3973,13,11,8        ","3974,861            ","3975,322            ","3976,36,3,1         ","3977,221            ","3978,19,9,7         ","3979,25,9,2         ","3980,16,9,4         ",
"3981,21,11,8        ","3982,21,13,8        ","3983,11             ","3984,19,5,2         ","3985,1038           ","3986,12,8,7         ","3987,11,4,2         ","3988,1017           ","3989,6,5,2          ","3990,469            ",
"3991,168            ","3992,27,8,6         ","3993,1468           ","3994,19,12,9        ","3995,12,9,8         ","3996,19             ","3997,16,13,3        ","3998,153            ","3999,1250           ","4000,31,18,17       ",
"4001,137            ","4002,24,11,6        ","4003,14,12,5        ","4004,1479           ","4005,17,12,2        ","4006,17,6,1         ","4007,705            ","4008,24,9,6         ","4009,124            ","4010,18,15,2        ",
"4011,28,15,9        ","4012,21,20,8        ","4013,18,17,15       ","4014,125            ","4015,249            ","4016,33,32,23       ","4017,22             ","4018,1467           ","4019,7,6,1          ","4020,375            ",
"4021,24,19,16       ","4022,7,4,2          ","4023,985            ","4024,16,9,7         ","4025,599            ","4026,23,20,10       ","4027,9,7,4          ","4028,22,12,7        ","4029,14,11,4        ","4030,93             ",
"4031,1805           ","4032,15,13,6        ","4033,223            ","4034,1163           ","4035,25,16,1        ","4036,157            ","4037,21,14,10       ","4038,953            ","4039,1408           ","4040,29,20,15       ",
"4041,410            ","4042,23,21,13       ","4043,6,5,1          ","4044,1659           ","4045,22,12,10       ","4046,981            ","4047,158            ","4048,21,5,2         ","4049,215            ","4050,71             ",
"4051,24,14,7        ","4052,17             ","4053,17,14,5        ","4054,981            ","4055,854            ","4056,21,17,6        ","4057,871            ","4058,419            ","4059,13,6,3         ","4060,435            ",
"4061,28,20,10       ","4062,765            ","4063,118            ","4064,33,29,7        ","4065,356            ","4066,847            ","4067,24,8,5         ","4068,825            ","4069,18,9,1         ","4070,1529           ",
"4071,661            ","4072,13,10,6        ","4073,575            ","4074,595            ","4075,21,10,6        ","4076,19,15,7        ","4077,24,18,2        ","4078,29,18,16       ","4079,224            ","4080,15,9,6         ",
"4081,78             ","4082,16,10,3        ","4083,19,10,4        ","4084,1435           ","4085,12,11,6        ","4086,1445           ","4087,769            ","4088,15,7,2         ","4089,463            ","4090,79             ",
"4091,23,12,10       ","4092,1491           ","4093,23,22,18       ","4094,321            ","4095,616            ","4096,27,15,1        ","4097,1232           ","4098,3              ","4099,19,18,2        ","4100,615            ",
"4101,18,10,6        ","4102,57             ","4103,1278           ","4104,30,13,3        ","4105,252            ","4106,123            ","4107,27,6,2         ","4108,1615           ","4109,19,12,1        ","4110,16,12,1        ",
"4111,201            ","4112,23,12,1        ","4113,913            ","4114,219            ","4115,16,12,1        ","4116,245            ","4117,19,18,13       ","4118,22,12,1        ","4119,1015           ","4120,26,17,9        ",
"4121,12,6,3         ","4122,595            ","4123,10,9,1         ","4124,345            ","4125,2              ","4126,133            ","4127,276            ","4128,31,2,1         ","4129,1315           ","4130,21,7,5         ",
"4131,18,14,5        ","4132,873            ","4133,19,14,12       ","4134,1045           ","4135,1554           ","4136,31,29,15       ","4137,862            ","4138,1899           ","4139,15,7,2         ","4140,549            ",
"4141,28,23,2        ","4142,525            ","4143,421            ","4144,15,10,1        ","4145,51             ","4146,131            ","4147,14,10,5        ","4148,1857           ","4149,28,8,2         ","4150,573            ",
"4151,186            ","4152,25,13,3        ","4153,20,13,5        ","4154,231            ","4155,17,10,7        ","4156,1165           ","4157,19,17,10       ","4158,133            ","4159,81             ","4160,27,18,12       ",
"4161,1361           ","4162,2047           ","4163,22,15,5        ","4164,2045           ","4165,18,13,2        ","4166,645            ","4167,698            ","4168,17,10,6        ","4169,105            ","4170,387            ",
"4171,24,8,1         ","4172,13,9,5         ","4173,16,12,10       ","4174,1297           ","4175,1698           ","4176,26,15,5        ","4177,805            ","4178,18,2,1         ","4179,14,6,3         ","4180,273            ",
"4181,26,18,1        ","4182,1985           ","4183,1984           ","4184,29,15,7        ","4185,341            ","4186,1411           ","4187,15,14,6        ","4188,947            ","4189,16,10,1        ","4190,11,7,6         ",
"4191,454            ","4192,15,11,5        ","4193,200            ","4194,18,5,2         ","4195,21,13,2        ","4196,1565           ","4197,16,13,6        ","4198,19,14,6        ","4199,225            ","4200,12,5,2         ",
"4201,76             ","4202,1031           ","4203,10,4,1         ","4204,1327           ","4205,8,4,3          ","4206,381            ","4207,1846           ","4208,15,6,3         ","4209,826            ","4210,1491           ",
"4211,14,12,6        ","4212,243            ","4213,18,15,10       ","4214,473            ","4215,34             ","4216,13,3,2         ","4217,347            ","4218,287            ","4219,24,6,4         ","4220,525            ",
"4221,13,10,3        ","4222,18,10,1        ","4223,144            ","4224,8,3,2          ","4225,9              ","4226,30,23,10       ","4227,19,11,2        ","4228,145            ","4229,7,6,1          ","4230,533            ",
"4231,756            ","4232,18,13,7        ","4233,5              ","4234,799            ","4235,15,3,2         ","4236,459            ","4237,21,19,14       ","4238,389            ","4239,904            ","4240,31,6,1         ",
"4241,273            ","4242,503            ","4243,14,12,10       ","4244,387            ","4245,26,20,15       ","4246,273            ","4247,783            ","4248,11,6,2         ","4249,387            ","4250,7,6,4          ",
"4251,23,18,17       ","4252,28,10,7        ","4253,21,12,11       ","4254,11,5,3         ","4255,754            ","4256,15,13,8        ","4257,578            ","4258,9,7,5          ","4259,17,12,7        ","4260,99             ",
"4261,23,20,18       ","4262,1301           ","4263,217            ","4264,15,14,5        ","4265,362            ","4266,727            ","4267,24,8,2         ","4268,147            ","4269,19,17,16       ","4270,18,11,7        ",
"4271,1775           ","4272,11,8,1         ","4273,385            ","4274,1859           ","4275,13,12,10       ","4276,1471           ","4277,26,3,1         ","4278,309            ","4279,945            ","4280,17,14,5        ",
"4281,226            ","4282,1671           ","4283,30,27,15       ","4284,81             ","4285,20,18,11       ","4286,12,5,4         ","4287,679            ","4288,5,4,3          ","4289,689            ","4290,99             ",
"4291,18,14,10       ","4292,22,18,7        ","4293,20,19,17       ","4294,9,8,7          ","4295,302            ","4296,14,5,2         ","4297,15,4,2         ","4298,30,24,11       ","4299,17,16,14       ","4300,175            ",
"4301,12,11,2        ","4302,569            ","4303,84             ","4304,12,7,2         ","4305,116            ","4306,9,5,1          ","4307,28,24,2        ","4308,901            ","4309,23,15,10       ","4310,13,10,2        ",
"4311,455            ","4312,21,5,2         ","4313,1016           ","4314,1071           ","4315,9,8,4          ","4316,431            ","4317,20,18,11       ","4318,973            ","4319,1850           ","4320,21,20,14       ",
"4321,390            ","4322,111            ","4323,16,6,3         ","4324,987            ","4325,22,16,12       ","4326,485            ","4327,540            ","4328,20,17,15       ","4329,833            ","4330,1351           ",
"4331,12,9,2         ","4332,593            ","4333,21,17,10       ","4334,17,12,6        ","4335,826            ","4336,18,11,5        ","4337,1991           ","4338,287            ","4339,25,22,16       ","4340,725            ",
"4341,28,14,11       ","4342,1477           ","4343,678            ","4344,8,7,5          ","4345,271            ","4346,1911           ","4347,10,8,5         ","4348,429            ","4349,13,11,10       ","4350,301            ",
"4351,900            ","4352,33,27,20       ","4353,1042           ","4354,11,5,3         ","4355,24,23,14       ","4356,667            ","4357,16,7,6         ","4358,645            ","4359,595            ","4360,21,4,2         ",
"4361,272            ","4362,539            ","4363,15,8,2         ","4364,1523           ","4365,22,12,10       ","4366,1773           ","4367,197            ","4368,27,12,6        ","4369,154            ","4370,26,15,11       ",
"4371,18,15,5        ","4372,151            ","4373,8,7,1          ","4374,729            ","4375,253            ","4376,18,7,1         ","4377,155            ","4378,1939           ","4379,16,13,8        ","4380,745            ",
"4381,22,19,12       ","4382,1541           ","4383,886            ","4384,27,19,17       ","4385,19,17,10       ","4386,175            ","4387,23,18,4        ","4388,18,8,5         ","4389,15,10,3        ","4390,1029           ",
"4391,84             ","4392,20,19,5        ","4393,15,13,9        ","4394,1535           ","4395,33,25,18       ","4396,925            ","4397,25,18,11       ","4398,933            ","4399,585            ","4400,37,35,3        ",
"4401,394            ","4402,351            ","4403,15,14,4        ","4404,543            ","4405,21,13,2        ","4406,137            ","4407,21,3,2         ","4408,9,8,7          ","4409,218            ","4410,211            ",
"4411,22,6,3         ","4412,1769           ","4413,23,22,20       ","4414,19,6,4         ","4415,1269           ","4416,31,10,6        ","4417,442            ","4418,23,19,7        ","4419,13,11,8        ","4420,865            ",
"4421,32,22,18       ","4422,1069           ","4423,271            ","4424,21,19,13       ","4425,533            ","4426,11,6,1         ","4427,27,22,16       ","4428,63             ","4429,16,6,4         ","4430,14,4,1         ",
"4431,47             ","4432,25,5,3         ","4433,350            ","4434,207            ","4435,12,5,2         ","4436,273            ","4437,20,8,2         ","4438,8,6,1          ","4439,869            ","4440,26,21,14       ",
"4441,909            ","4442,1187           ","4443,16,6,4         ","4444,1839           ","4445,254            ","4446,589            ","4447,21             ","4448,11,9,8         ","4449,644            ","4450,1603           ",
"4451,17,12,8        ","4452,905            ","4453,26,15,2        ","4454,621            ","4455,1189           ","4456,24,9,7         ","4457,329            ","4458,255            ","4459,13,9,6         ","4460,155            ",
"4461,15,10,6        ","4462,21,16,3        ","4463,582            ","4464,13,3,1         ","4465,351            ","4466,639            ","4467,30,29,11       ","4468,1621           ","4469,19,18,16       ","4470,2117           ",
"4471,471            ","4472,30,7,2         ","4473,112            ","4474,799            ","4475,16,5,3         ","4476,595            ","4477,37,22,4        ","4478,25,21,8        ","4479,1165           ","4480,28,21,15       ",
"4481,273            ","4482,919            ","4483,8,7,2          ","4484,975            ","4485,8,2,1          ","4486,1749           ","4487,843            ","4488,38,35,13       ","4489,193            ","4490,1907           ",
"4491,18,7,3         ","4492,895            ","4493,22,8,1         ","4494,401            ","4495,1              ","4496,17,10,7        ","4497,299            ","4498,23,8,1         ","4499,27,8,5         ","4500,5              ",
"4501,7,6,1          ","4502,657            ","4503,7,5,1          ","4504,12,9,6         ","4505,794            ","4506,13,9,3         ","4507,14,9,4         ","4508,285            ","4509,14,5,4         ","4510,20,13,9        ",
"4511,173            ","4512,12,3,1         ","4513,196            ","4514,323            ","4515,8,6,3          ","4516,715            ","4517,21,16,11       ","4518,577            ","4519,1191           ","4520,39,25,23       ",
"4521,650            ","4522,1327           ","4523,17,12,7        ","4524,1339           ","4525,16,11,8        ","4526,849            ","4527,674            ","4528,23,13,9        ","4529,345            ","4530,151            ",
"4531,8,5,1          ","4532,25,22,20       ","4533,15,4,1         ","4534,381            ","4535,993            ","4536,25,11,7        ","4537,21             ","4538,2223           ","4539,11,8,6         ","4540,715            ",
"4541,12,11,2        ","4542,897            ","4543,358            ","4544,25,14,7        ","4545,523            ","4546,27,23,16       ","4547,6,5,1          ","4548,831            ","4549,23,12,7        ","4550,297            ",
"4551,730            ","4552,34,27,18       ","4553,704            ","4554,207            ","4555,25,22,12       ","4556,26,21,12       ","4557,98             ","4558,1869           ","4559,1356           ","4560,14,13,7        ",
"4561,835            ","4562,87             ","4563,20,11,1        ","4564,165            ","4565,18,6,2         ","4566,905            ","4567,126            ","4568,22,17,6        ","4569,2110           ","4570,2079           ",
"4571,10,6,1         ","4572,81             ","4573,24,15,6        ","4574,69             ","4575,638            ","4576,26,19,9        ","4577,9,8,4          ","4578,1419           ","4579,10,6,2         ","4580,21,12,5        ",
"4581,27,13,10       ","4582,14,12,1        ","4583,1358           ","4584,19,15,9        ","4585,223            ","4586,483            ","4587,13,6,1         ","4588,265            ","4589,26,18,16       ","4590,497            ",
"4591,1254           ","4592,21,16,11       ","4593,22,16,12       ","4594,30,11,4        ","4595,15,14,1        ","4596,371            ","4597,34,13,12       ","4598,32,28,9        ","4599,25             ","4600,17,14,1        ",
"4601,68             ","4602,675            ","4603,24,22,5        ","4604,1907           ","4605,8,5,2          ","4606,2013           ","4607,1026           ","4608,23,20,13       ","4609,780            ","4610,239            ",
"4611,23,13,10       ","4612,1557           ","4613,27,14,10       ","4614,965            ","4615,232            ","4616,27,23,5        ","4617,287            ","4618,975            ","4619,10,8,7         ","4620,77             ",
"4621,28,15,4        ","4622,21,20,17       ","4623,136            ","4624,26,23,10       ","4625,42             ","4626,367            ","4627,16,8,5         ","4628,1779           ","4629,20,3,2         ","4630,14,3,2         ",
"4631,25,17,7        ","4632,19,16,2        ","4633,1035           ","4634,1535           ","4635,21,16,1        ","4636,901            ","4637,18,17,3        ","4638,30,24,15       ","4639,448            ","4640,25,8,7         ",
"4641,149            ","4642,1311           ","4643,15,13,10       ","4644,189            ","4645,24,11,5        ","4646,16,13,9        ","4647,959            ","4648,8,5,3          ","4649,207            ","4650,567            ",
"4651,29,24,8        ","4652,95             ","4653,30,21,13       ","4654,21,20,1        ","4655,474            ","4656,27,25,4        ","4657,417            ","4658,1943           ","4659,8,7,5          ","4660,885            ",
"4661,26,21,2        ","4662,297            ","4663,841            ","4664,37,6,5         ","4665,1663           ","4666,24,17,11       ","4667,36,25,20       ","4668,917            ","4669,18,14,10       ","4670,29,12,2        ",
"4671,392            ","4672,27,25,23       ","4673,147            ","4674,10,5,4         ","4675,26,25,21       ","4676,603            ","4677,19,11,10       ","4678,2245           ","4679,1146           ","4680,10,9,3         ",
"4681,216            ","4682,119            ","4683,35,28,14       ","4684,819            ","4685,24,10,1        ","4686,285            ","4687,1330           ","4688,13,7,6         ","4689,421            ","4690,283            ",
"4691,26,21,3        ","4692,21             ","4693,26,13,6        ","4694,1725           ","4695,1522           ","4696,18,17,11       ","4697,386            ","4698,351            ","4699,36,7,5         ","4700,873            ",
"4701,23,21,18       ","4702,17,3,2         ","4703,248            ","4704,11,8,1         ","4705,1033           ","4706,2151           ","4707,17,16,11       ","4708,1543           ","4709,21,12,11       ","4710,2257           ",
"4711,426            ","4712,25,16,6        ","4713,67             ","4714,19,17,6        ","4715,26,24,7        ","4716,97             ","4717,30,17,16       ","4718,16,14,1        ","4719,466            ","4720,24,19,9        ",
"4721,10,9,7         ","4722,24,19,18       ","4723,19,14,2        ","4724,617            ","4725,13,10,8        ","4726,1693           ","4727,408            ","4728,26,21,14       ","4729,73             ","4730,19,12,10       ",
"4731,14,6,5         ","4732,157            ","4733,14,9,5         ","4734,2193           ","4735,412            ","4736,15,10,1        ","4737,248            ","4738,12,7,5         ","4739,27,26,6        ","4740,1941           ",
"4741,21,10,8        ","4742,2201           ","4743,857            ","4744,19,14,6        ","4745,281            ","4746,363            ","4747,25,24,8        ","4748,1257           ","4749,29,19,16       ","4750,541            ",
"4751,1946           ","4752,29,5,2         ","4753,2368           ","4754,923            ","4755,19,6,4         ","4756,279            ","4757,30,22,17       ","4758,401            ","4759,883            ","4760,28,11,9        ",
"4761,170            ","4762,7,6,4          ","4763,17,16,7        ","4764,477            ","4765,30,19,7        ","4766,25,22,21       ","4767,178            ","4768,25,17,3        ","4769,119            ","4770,507            ",
"4771,24,5,4         ","4772,213            ","4773,26,12,5        ","4774,16,13,6        ","4775,2381           ","4776,27,23,6        ","4777,348            ","4778,18,5,3         ","4779,14,8,1         ","4780,321            ",
"4781,22,19,5        ","4782,1397           ","4783,369            ","4784,30,29,7        ","4785,382            ","4786,20,3,1         ","4787,19,6,5         ","4788,9              ","4789,14,7,2         ","4790,1233           ",
"4791,707            ","4792,29,18,4        ","4793,413            ","4794,19,12,7        ","4795,23,7,2         ","4796,18,8,7         ","4797,15,14,3        ","4798,117            ","4799,158            ","4800,29,19,11       ",
"4801,1146           ","4802,291            ","4803,7,5,4          ","4804,18,15,4        ","4805,1922           ","4806,2349           ","4807,12             ","4808,13,4,2         ","4809,91             ","4810,1171           ",
"4811,13,10,2        ","4812,22,15,13       ","4813,18,7,6         ","4814,22,10,9        ","4815,638            ","4816,33,31,25       ","4817,491            ","4818,459            ","4819,28,25,7        ","4820,515            ",
"4821,16,13,2        ","4822,33,17,13       ","4823,1094           ","4824,25,16,3        ","4825,558            ","4826,24,19,17       ","4827,29,20,14       ","4828,913            ","4829,20,14,2        ","4830,1493           ",
"4831,337            ","4832,33,30,5        ","4833,458            ","4834,19,17,2        ","4835,28,10,5        ","4836,301            ","4837,14,9,1         ","4838,17,12,7        ","4839,238            ","4840,25,21,2        ",
"4841,19,13,3        ","4842,33,29,18       ","4843,22,21,3        ","4844,16,15,1        ","4845,38,21,17       ","4846,1477           ","4847,1085           ","4848,28,27,6        ","4849,184            ","4850,243            ",
"4851,24,17,2        ","4852,561            ","4853,17,7,4         ","4854,633            ","4855,172            ","4856,27,23,21       ","4857,34             ","4858,355            ","4859,25,22,14       ","4860,81             ",
"4861,15,7,6         ","4862,15,8,1         ","4863,166            ","4864,29,22,17       ","4865,1551           ","4866,23,15,2        ","4867,18,11,1        ","4868,593            ","4869,22,16,4        ","4870,213            ",
"4871,1251           ","4872,24,9,2         ","4873,1798           ","4874,555            ","4875,26,16,10       ","4876,585            ","4877,23,20,6        ","4878,1457           ","4879,1342           ","4880,32,21,7        ",
"4881,1276           ","4882,28,7,4         ","4883,26,8,2         ","4884,91             ","4885,27,21,12       ","4886,1989           ","4887,139            ","4888,35,21,8        ","4889,45             ","4890,1967           ",
"4891,25,19,16       ","4892,2381           ","4893,15,12,2        ","4894,469            ","4895,623            ","4896,21,19,12       ","4897,210            ","4898,25,12,2        ","4899,33,28,6        ","4900,697            ",
"4901,20,18,14       ","4902,1253           ","4903,774            ","4904,27,18,15       ","4905,296            ","4906,22,21,6        ","4907,14,10,3        ","4908,111            ","4909,30,16,11       ","4910,377            ",
"4911,1955           ","4912,30,29,7        ","4913,693            ","4914,259            ","4915,16,9,1         ","4916,1793           ","4917,34,5,4         ","4918,889            ","4919,380            ","4920,11,9,5         ",
"4921,277            ","4922,2387           ","4923,10,3,1         ","4924,1545           ","4925,19,6,2         ","4926,693            ","4927,21             ","4928,29,9,3         ","4929,49             ","4930,2143           ",
"4931,23,21,18       ","4932,1039           ","4933,13,11,8        ","4934,413            ","4935,133            ","4936,27,22,15       ","4937,63             ","4938,19,9,3         ","4939,24,8,1         ","4940,383            ",
"4941,17,14,1        ","4942,13,12,9        ","4943,494            ","4944,19,6,4         ","4945,1011           ","4946,23,9,1         ","4947,24,6,4         ","4948,601            ","4949,30,25,2        ","4950,517            ",
"4951,217            ","4952,29,11,5        ","4953,938            ","4954,15,10,7        ","4955,27,12,5        ","4956,559            ","4957,11,6,5         ","4958,1709           ","4959,920            ","4960,25,20,6        ",
"4961,843            ","4962,23,11,6        ","4963,20,17,15       ","4964,13,10,5        ","4965,13,12,6        ","4966,2205           ","4967,1292           ","4968,26,25,17       ","4969,1084           ","4970,1131           ",
"4971,12,6,2         ","4972,709            ","4973,26,22,16       ","4974,1229           ","4975,2301           ","4976,42,7,1         ","4977,644            ","4978,315            ","4979,29,11,8        ","4980,111            ",
"4981,33,15,12       ","4982,1701           ","4983,1070           ","4984,23,16,9        ","4985,384            ","4986,239            ","4987,10,7,4         ","4988,375            ","4989,15,8,2         ","4990,23,19,3        ",
"4991,201            ","4992,15,8,6         ","4993,39             ","4994,1791           ","4995,28,25,19       ","4996,18,15,13       ","4997,31,11,6        ","4998,161            ","4999,13,11,9        ","5000,17,15,7        ",
"5001,637            ","5002,33,13,8        ","5003,18,16,8        ","5004,671            ","5005,22,13,6        ","5006,12,3,2         ","5007,464            ","5008,21,10,3        ","5009,38             ","5010,17,8,6         ",
"5011,29,20,15       ","5012,33             ","5013,38,35,15       ","5014,1197           ","5015,206            ","5016,15,12,9        ","5017,385            ","5018,731            ","5019,23,19,2        ","5020,97             ",
"5021,14,11,2        ","5022,329            ","5023,777            ","5024,33,23,14       ","5025,1379           ","5026,20,15,11       ","5027,28,9,5         ","5028,1089           ","5029,22,3,2         ","5030,2373           ",
"5031,496            ","5032,25,6,2         ","5033,1122           ","5034,387            ","5035,24,21,10       ","5036,1295           ","5037,22,15,3        ","5038,45             ","5039,489            ","5040,24,5,3         ",
"5041,646            ","5042,1607           ","5043,23,17,8        ","5044,1165           ","5045,25,24,2        ","5046,17,11,4        ","5047,415            ","5048,34,15,10       ","5049,133            ","5050,2467           ",
"5051,22,17,15       ","5052,833            ","5053,26,18,11       ","5054,1493           ","5055,211            ","5056,22,9,6         ","5057,126            ","5058,1411           ","5059,20,19,14       ","5060,161            ",
"5061,16,11,7        ","5062,141            ","5063,795            ","5064,21,12,11       ","5065,126            ","5066,783            ","5067,12,6,2         ","5068,1635           ","5069,18,5,3         ","5070,16,13,7        ",
"5071,258            ","5072,25,5,3         ","5073,476            ","5074,2119           ","5075,18,15,5        ","5076,1467           ","5077,18,11,5        ","5078,2201           ","5079,35             ","5080,21,7,6         ",
"5081,1562           ","5082,35             ","5083,25,19,6        ","5084,173            ","5085,20,14,13       ","5086,23,18,14       ","5087,210            ","5088,22,21,3        ","5089,88             ","5090,147            ",
"5091,18,13,10       ","5092,843            ","5093,15,6,2         ","5094,1377           ","5095,489            ","5096,19,18,13       ","5097,454            ","5098,243            ","5099,24,2,1         ","5100,675            ",
"5101,18,16,15       ","5102,22,18,11       ","5103,148            ","5104,30,13,2        ","5105,72             ","5106,1307           ","5107,17,2,1         ","5108,191            ","5109,26,19,7        ","5110,2209           ",
"5111,279            ","5112,42,33,9        ","5113,559            ","5114,899            ","5115,14,8,5         ","5116,1387           ","5117,19,14,6        ","5118,2045           ","5119,130            ","5120,33,27,5        ",
"5121,457            ","5122,199            ","5123,11,8,5         ","5124,279            ","5125,23,18,4        ","5126,22,14,9        ","5127,1519           ","5128,24,15,6        ","5129,1514           ","5130,603            ",
"5131,21,7,4         ","5132,15             ","5133,15,11,8        ","5134,1629           ","5135,141            ","5136,27,25,4        ","5137,1701           ","5138,1571           ","5139,36,22,1        ","5140,1015           ",
"5141,24,14,5        ","5142,12,11,3        ","5143,1767           ","5144,15,11,5        ","5145,308            ","5146,1771           ","5147,12,10,2        ","5148,103            ","5149,30,22,2        ","5150,213            ",
"5151,724            ","5152,15,8,1         ","5153,708            ","5154,16,5,2         ","5155,15,14,1        ","5156,14,6,1         ","5157,8,6,3          ","5158,21,20,2        ","5159,494            ","5160,35,31,13       ",
"5161,315            ","5162,419            ","5163,20,17,5        ","5164,12,7,3         ","5165,18,16,10       ","5166,117            ","5167,2193           ","5168,15,11,5        ","5169,1196           ","5170,1411           ",
"5171,18,3,2         ","5172,2247           ","5173,23,22,2        ","5174,189            ","5175,347            ","5176,24,21,3        ","5177,963            ","5178,15,13,10       ","5179,30,12,9        ","5180,2055           ",
"5181,23,7,2         ","5182,16,13,6        ","5183,1869           ","5184,20,11,5        ","5185,373            ","5186,1755           ","5187,16,8,5         ","5188,2305           ","5189,28,22,2        ","5190,677            ",
"5191,330            ","5192,11,8,2         ","5193,1006           ","5194,25,15,13       ","5195,27,11,6        ","5196,617            ","5197,20,15,7        ","5198,27,10,8        ","5199,1546           ","5200,33,27,19       ",
"5201,125            ","5202,1519           ","5203,14,4,3         ","5204,917            ","5205,9,8,6          ","5206,465            ","5207,588            ","5208,23,22,2        ","5209,156            ","5210,2219           ",
"5211,20,19,1        ","5212,487            ","5213,19,8,7         ","5214,12,9,8         ","5215,354            ","5216,27,19,2        ","5217,1507           ","5218,2335           ","5219,23,3,2         ","5220,205            ",
"5221,12,11,8        ","5222,1637           ","5223,1787           ","5224,29,15,1        ","5225,503            ","5226,2607           ","5227,24,10,7        ","5228,327            ","5229,28,19,13       ","5230,13,12,11       ",
"5231,1188           ","5232,21,11,2        ","5233,205            ","5234,275            ","5235,16,6,1         ","5236,475            ","5237,12,10,7        ","5238,765            ","5239,549            ","5240,33,27,21       ",
"5241,101            ","5242,895            ","5243,10,9,1         ","5244,2321           ","5245,28,23,3        ","5246,2477           ","5247,235            ","5248,27,18,1        ","5249,197            ","5250,1371           ",
"5251,35,25,14       ","5252,627            ","5253,24,17,14       ","5254,1305           ","5255,167            ","5256,9,5,2          ","5257,1537           ","5258,1359           ","5259,10,8,4         ","5260,1455           ",
"5261,22,10,9        ","5262,22,20,1        ","5263,769            ","5264,16,11,9        ","5265,41             ","5266,483            ","5267,31,25,14       ","5268,297            ","5269,23,6,1         ","5270,341            ",
"5271,1106           ","5272,29,18,10       ","5273,1395           ","5274,17,11,10       ","5275,16,10,1        ","5276,609            ","5277,9,7,6          ","5278,2337           ","5279,1299           ","5280,13,11,1        ",
"5281,29,9,4         ","5282,13,10,9        ","5283,25,17,2        ","5284,16,9,5         ","5285,25,24,23       ","5286,20,14,7        ","5287,196            ","5288,11,10,1        ","5289,1424           ","5290,17,9,4         ",
"5291,24,18,5        ","5292,315            ","5293,25,9,2         ","5294,14,3,1         ","5295,1133           ","5296,8,3,2          ","5297,446            ","5298,575            ","5299,17,12,1        ","5300,2195           ",
"5301,14,8,1         ","5302,2205           ","5303,434            ","5304,27,6,5         ","5305,1863           ","5306,15,4,1         ","5307,12,10,4        ","5308,18,14,11       ","5309,7,6,1          ","5310,837            ",
"5311,142            ","5312,22,3,2         ","5313,598            ","5314,7              ","5315,18,14,3        ","5316,1067           ","5317,17,4,3         ","5318,125            ","5319,1573           ","5320,19,17,3        ",
"5321,351            ","5322,1199           ","5323,15,11,2        ","5324,15             ","5325,18,14,11       ","5326,1545           ","5327,723            ","5328,30,27,9        ","5329,1219           ","5330,803            ",
"5331,18,5,3         ","5332,171            ","5333,25,24,19       ","5334,545            ","5335,16,15,11       ","5336,23,21,8        ","5337,2279           ","5338,1647           ","5339,17,16,15       ","5340,731            ",
"5341,22,15,13       ","5342,27,9,3         ","5343,485            ","5344,17,11,10       ","5345,339            ","5346,171            ","5347,24,22,11       ","5348,2259           ","5349,16,13,10       ","5350,15,14,5        ",
"5351,707            ","5352,23,20,1        ","5353,1419           ","5354,22,7,6         ","5355,16,11,2        ","5356,51             ","5357,29,24,10       ","5358,2485           ","5359,81             ","5360,19,11,1        ",
"5361,35             ","5362,15,7,1         ","5363,20,7,1         ","5364,863            ","5365,14,13,8        ","5366,20,3,2         ","5367,194            ","5368,19,18,3        ","5369,152            ","5370,1919           ",
"5371,18,15,6        ","5372,1151           ","5373,20,14,13       ","5374,24,19,14       ","5375,188            ","5376,7,4,1          ","5377,547            ","5378,1059           ","5379,23,17,4        ","5380,423            ",
"5381,13,11,10       ","5382,26,24,17       ","5383,1509           ","5384,17,15,4        ","5385,376            ","5386,2055           ","5387,28,21,8        ","5388,2261           ","5389,18,10,9        ","5390,2409           ",
"5391,434            ","5392,7,3,2          ","5393,215            ","5394,1523           ","5395,18,13,1        ","5396,2255           ","5397,9,5,2          ","5398,357            ","5399,485            ","5400,33,17,3        ",
"5401,420            ","5402,18,15,9        ","5403,14,11,6        ","5404,387            ","5405,17,14,12       ","5406,1205           ","5407,955            ","5408,30,23,1        ","5409,1720           ","5410,2343           ",
"5411,28,10,3        ","5412,917            ","5413,21,18,7        ","5414,25,2,1         ","5415,331            ","5416,34,31,19       ","5417,1256           ","5418,303            ","5419,25,24,23       ","5420,945            ",
"5421,30,29,6        ","5422,445            ","5423,311            ","5424,16,15,13       ","5425,186            ","5426,18,11,8        ","5427,18,12,11       ","5428,117            ","5429,40,22,5        ","5430,513            ",
"5431,2163           ","5432,37,34,23       ","5433,791            ","5434,19,18,15       ","5435,24,18,14       ","5436,1229           ","5437,21,8,2         ","5438,1289           ","5439,203            ","5440,24,15,10       ",
"5441,1254           ","5442,1635           ","5443,20,10,6        ","5444,1235           ","5445,20,19,7        ","5446,865            ","5447,860            ","5448,43,33,15       ","5449,103            ","5450,479            ",
"5451,30,19,16       ","5452,2691           ","5453,13,4,2         ","5454,893            ","5455,91             ","5456,21,14,10       ","5457,767            ","5458,1839           ","5459,36,20,2        ","5460,29             ",
"5461,30,28,5        ","5462,15,11,1        ","5463,167            ","5464,15,5,2         ","5465,54             ","5466,32,23,10       ","5467,22,8,5         ","5468,95             ","5469,32,23,2        ","5470,13,12,1        ",
"5471,198            ","5472,21,15,3        ","5473,589            ","5474,1247           ","5475,18,16,13       ","5476,30,23,11       ","5477,23,18,10       ","5478,305            ","5479,370            ","5480,13,10,3        ",
"5481,167            ","5482,20,17,9        ","5483,22,2,1         ","5484,1029           ","5485,16,8,2         ","5486,14,9,8         ","5487,1834           ","5488,21,19,9        ","5489,1290           ","5490,1143           ",
"5491,24,14,1        ","5492,135            ","5493,15,12,7        ","5494,537            ","5495,279            ","5496,13,11,4        ","5497,1729           ","5498,19,12,7        ","5499,29,21,18       ","5500,175            ",
"5501,27,19,2        ","5502,2537           ","5503,237            ","5504,20,19,1        ","5505,98             ","5506,23,20,12       ","5507,15,10,7        ","5508,729            ","5509,11,9,4         ","5510,19,15,2        ",
"5511,554            ","5512,13,11,6        ","5513,1814           ","5514,535            ","5515,19,3,2         ","5516,1563           ","5517,40,13,11       ","5518,26,23,7        ","5519,773            ","5520,10,5,2         ",
"5521,1209           ","5522,26,15,2        ","5523,26,20,13       ","5524,2113           ","5525,24,21,6        ","5526,1505           ","5527,318            ","5528,25,18,14       ","5529,1756           ","5530,1467           ",
"5531,20,15,1        ","5532,1017           ","5533,19,16,10       ","5534,1425           ","5535,217            ","5536,20,5,3         ","5537,492            ","5538,28,22,7        ","5539,14,9,7         ","5540,1089           ",
"5541,15,9,4         ","5542,957            ","5543,248            ","5544,11,10,2        ","5545,298            ","5546,23,12,6        ","5547,22,4,3         ","5548,403            ","5549,33,11,10       ","5550,1273           ",
"5551,712            ","5552,15,9,8         ","5553,116            ","5554,16,5,2         ","5555,24,20,5        ","5556,269            ","5557,39,35,8        ","5558,1301           ","5559,938            ","5560,55,46,10       ",
"5561,773            ","5562,995            ","5563,22,19,13       ","5564,705            ","5565,17,14,5        ","5566,2185           ","5567,239            ","5568,33,22,7        ","5569,4              ","5570,17,16,3        ",
"5571,27,11,2        ","5572,1053           ","5573,18,11,6        ","5574,901            ","5575,699            ","5576,27,23,6        ","5577,328            ","5578,15,9,3         ","5579,25,20,12       ","5580,81             ",
"5581,20,6,4         ","5582,1697           ","5583,1037           ","5584,13,9,7         ","5585,1338           ","5586,371            ","5587,21,16,7        ","5588,39             ","5589,29,27,8        ","5590,1381           ",
"5591,870            ","5592,29,20,7        ","5593,124            ","5594,15             ","5595,21,12,2        ","5596,853            ","5597,20,6,3         ","5598,101            ","5599,565            ","5600,8,5,3          ",
"5601,487            ","5602,963            ","5603,22,20,4        ","5604,2251           ","5605,32,23,1        ","5606,1905           ","5607,43             ","5608,22,5,2         ","5609,287            ","5610,271            ",
"5611,20,9,7         ","5612,135            ","5613,20,17,14       ","5614,6,3,1          ","5615,461            ","5616,30,15,6        ","5617,6              ","5618,17,15,2        ","5619,11,8,6         ","5620,1251           ",
"5621,12,11,4        ","5622,2465           ","5623,709            ","5624,21,18,14       ","5625,28             ","5626,943            ","5627,13,9,8         ","5628,863            ","5629,23,12,4        ","5630,357            ",
"5631,1502           ","5632,17,15,5        ","5633,143            ","5634,759            ","5635,17,10,3        ","5636,555            ","5637,8,6,5          ","5638,20,17,13       ","5639,1365           ","5640,29,27,23       ",
"5641,568            ","5642,33,23,2        ","5643,10,3,1         ","5644,2233           ","5645,19,16,2        ","5646,23,8,5         ","5647,17,16,9        ","5648,21,15,8        ","5649,49             ","5650,967            ",
"5651,10,7,2         ","5652,929            ","5653,16,11,5        ","5654,149            ","5655,434            ","5656,27,12,9        ","5657,165            ","5658,9,4,3          ","5659,12,8,2         ","5660,39             ",
"5661,26,14,10       ","5662,2637           ","5663,90             ","5664,31,29,11       ","5665,714            ","5666,1215           ","5667,10,8,1         ","5668,34,27,3        ","5669,27,4,1         ","5670,41             ",
"5671,37             ","5672,26,25,10       ","5673,82             ","5674,18,15,13       ","5675,17,15,4        ","5676,1259           ","5677,27,26,2        ","5678,31,21,8        ","5679,271            ","5680,40,17,2        ",
"5681,326            ","5682,35,16,1        ","5683,22,18,11       ","5684,87             ","5685,10,7,5         ","5686,27,7,3         ","5687,2007           ","5688,41,20,11       ","5689,1384           ","5690,1623           ",
"5691,21,15,4        ","5692,561            ","5693,24,4,2         ","5694,1609           ","5695,732            ","5696,26,21,14       ","5697,19,8,2         ","5698,14,9,5         ","5699,12,8,5         ","5700,705            ",
"5701,16,6,5         ","5702,22,15,8        ","5703,82             ","5704,27,25,14       ","5705,248            ","5706,2199           ","5707,24,21,16       ","5708,1151           ","5709,22,9,1         ","5710,409            ",
"5711,441            ","5712,10,9,3         ","5713,27             ","5714,1775           ","5715,28,6,3         ","5716,14,13,8        ","5717,21,6,5         ","5718,1361           ","5719,375            ","5720,32,11,2        ",
"5721,1562           ","5722,19,18,14       ","5723,28,19,6        ","5724,103            ","5725,22,9,3         ","5726,309            ","5727,1310           ","5728,25,24,7        ","5729,515            ","5730,25,18,10       ",
"5731,13,11,8        ","5732,2267           ","5733,10,8,5         ","5734,2629           ","5735,744            ","5736,25,18,10       ","5737,507            ","5738,30,17,4        ","5739,18,15,13       ","5740,115            ",
"5741,16,6,4         ","5742,1085           ","5743,1621           ","5744,21,11,8        ","5745,544            ","5746,279            ","5747,13,4,2         ","5748,18,17,2        ","5749,26,19,18       ","5750,377            ",
"5751,127            ","5752,21,20,7        ","5753,1721           ","5754,1235           ","5755,8,7,2          ","5756,371            ","5757,22,18,16       ","5758,805            ","5759,1431           ","5760,29,23,10       ",
"5761,615            ","5762,2759           ","5763,18,13,1        ","5764,2019           ","5765,17,10,7        ","5766,13,10,4        ","5767,124            ","5768,21,14,3        ","5769,83             ","5770,9,7,2          ",
"5771,16,14,13       ","5772,343            ","5773,12,11,8        ","5774,15,5,4         ","5775,266            ","5776,19,12,1        ","5777,134            ","5778,1071           ","5779,21,7,4         ","5780,1535           ",
"5781,24,14,6        ","5782,2377           ","5783,954            ","5784,25,22,6        ","5785,1161           ","5786,20,19,7        ","5787,30,20,15       ","5788,1585           ","5789,21,14,12       ","5790,197            ",
"5791,2101           ","5792,33,13,11       ","5793,437            ","5794,2383           ","5795,15,14,3        ","5796,831            ","5797,33,26,23       ","5798,1853           ","5799,934            ","5800,25,7,6         ",
"5801,129            ","5802,1015           ","5803,16,15,10       ","5804,13,8,1         ","5805,10,7,3         ","5806,369            ","5807,731            ","5808,43,10,1        ","5809,369            ","5810,47             ",
"5811,21,17,2        ","5812,295            ","5813,14,13,1        ","5814,2233           ","5815,1083           ","5816,17,15,7        ","5817,343            ","5818,763            ","5819,1058           ","5820,61             ",
"5821,18,11,4        ","5822,2145           ","5823,916            ","5824,23,17,10       ","5825,323            ","5826,2027           ","5827,28,16,10       ","5828,17,8,5         ","5829,24,6,5         ","5830,27,23,11       ",
"5831,275            ","5832,21,18,13       ","5833,264            ","5834,935            ","5835,13,5,2         ","5836,91             ","5837,13,9,2         ","5838,153            ","5839,169            ","5840,23,14,2        ",
"5841,250            ","5842,21,18,7        ","5843,20,7,6         ","5844,1809           ","5845,18,5,1         ","5846,20,17,3        ","5847,1013           ","5848,19,8,6         ","5849,105            ","5850,27             ",
"5851,9,6,1          ","5852,15,13,10       ","5853,46,36,18       ","5854,2217           ","5855,1334           ","5856,23,15,6        ","5857,516            ","5858,2735           ","5859,28,25,16       ","5860,1899           ",
"5861,16,2,1         ","5862,18,3,2         ","5863,58             ","5864,27,11,10       ","5865,1249           ","5866,30,23,2        ","5867,17,6,2         ","5868,373            ","5869,26,23,4        ","5870,15,9,5         ",
"5871,287            ","5872,19,15,10       ","5873,113            ","5874,267            ","5875,20,13,9        ","5876,243            ","5877,37,36,30       ","5878,24,9,1         ","5879,2556           ","5880,21,10,3        ",
"5881,81             ","5882,975            ","5883,19,6,4         ","5884,14,11,10       ","5885,38,29,14       ","5886,297            ","5887,142            ","5888,23,10,4        ","5889,541            ","5890,13,8,3         ",
"5891,20,15,9        ","5892,63             ","5893,28,3,1         ","5894,21,15,2        ","5895,781            ","5896,30,23,1        ","5897,390            ","5898,247            ","5899,35,21,10       ","5900,125            ",
"5901,23,15,12       ","5902,1981           ","5903,380            ","5904,32,19,5        ","5905,172            ","5906,23,18,15       ","5907,25,17,2        ","5908,2101           ","5909,34,24,14       ","5910,449            ",
"5911,2545           ","5912,33,22,13       ","5913,292            ","5914,25,13,7        ","5915,30,29,28       ","5916,20,15,3        ","5917,21,12,6        ","5918,13,12,8        ","5919,1843           ","5920,16,15,6        ",
"5921,311            ","5922,495            ","5923,18,10,5        ","5924,1017           ","5925,24,7,3         ","5926,325            ","5927,1305           ","5928,16,7,2         ","5929,16,6,4         ","5930,17,13,10       ",
"5931,30,26,14       ","5932,2673           ","5933,15,11,6        ","5934,28,25,4        ","5935,84             ","5936,27,4,1         ","5937,49             ","5938,23,7,3         ","5939,12,5,3         ","5940,99             ",
"5941,20,18,11       ","5942,245            ","5943,1075           ","5944,23,21,14       ","5945,9,5,3          ","5946,33,20,3        ","5947,14,11,4        ","5948,117            ","5949,23,21,18       ","5950,32,13,8        ",
"5951,216            ","5952,25,23,2        ","5953,1767           ","5954,95             ","5955,28,8,5         ","5956,385            ","5957,18,6,2         ","5958,2297           ","5959,1864           ","5960,37,35,25       ",
"5961,2081           ","5962,2599           ","5963,35,28,6        ","5964,1475           ","5965,27,19,12       ","5966,609            ","5967,2359           ","5968,21,14,4        ","5969,24             ","5970,399            ",
"5971,11,3,2         ","5972,315            ","5973,20,8,3         ","5974,23,19,3        ","5975,284            ","5976,18,9,6         ","5977,657            ","5978,1151           ","5979,29,25,2        ","5980,1951           ",
"5981,21,14,13       ","5982,45             ","5983,1960           ","5984,17,7,1         ","5985,203            ","5986,895            ","5987,23,18,4        ","5988,1067           ","5989,36,20,2        ","5990,2729           ",
"5991,680            ","5992,29,9,2         ","5993,1133           ","5994,17,9,5         ","5995,26,25,20       ","5996,20,18,3        ","5997,10,8,1         ","5998,1765           ","5999,362            ","6000,23,21,12       ",
"6001,648            ","6002,2895           ","6003,25,19,14       ","6004,2287           ","6005,22,13,8        ","6006,1025           ","6007,435            ","6008,30,27,15       ","6009,346            ","6010,2907           ",
"6011,36,30,5        ","6012,533            ","6013,31,24,16       ","6014,21,14,9        ","6015,91             ","6016,35,34,2        ","6017,261            ","6018,1315           ","6019,19,18,11       ","6020,645            ",
"6021,32,22,17       ","6022,2217           ","6023,143            ","6024,39,33,26       ","6025,586            ","6026,915            ","6027,98             ","6028,18,8,7         ","6029,22,17,3        ","6030,1377           ",
"6031,613            ","6032,44,21,14       ","6033,406            ","6034,439            ","6035,28,14,13       ","6036,1577           ","6037,10,7,1         ","6038,21,17,11       ","6039,1556           ","6040,25,11,5        ",
"6041,1476           ","6042,21,3,2         ","6043,15,12,6        ","6044,2525           ","6045,19,16,10       ","6046,16,3,2         ","6047,411            ","6048,17,15,8        ","6049,988            ","6050,1227           ",
"6051,34,17,1        ","6052,127            ","6053,15,11,2        ","6054,24,22,21       ","6055,1242           ","6056,7,6,1          ","6057,2378           ","6058,1155           ","6059,39,34,20       ","6060,243            ",
"6061,31,25,6        ","6062,15,7,2         ","6063,28,24,9        ","6064,23,18,11       ","6065,129            ","6066,67             ","6067,30,18,10       ","6068,1149           ","6069,21,5,2         ","6070,37             ",
"6071,789            ","6072,28,15,13       ","6073,1753           ","6074,35             ","6075,26,24,6        ","6076,1387           ","6077,17,11,8        ","6078,1241           ","6079,382            ","6080,19,8,6         ",
"6081,1081           ","6082,20,2,1         ","6083,33,26,6        ","6084,279            ","6085,16,13,7        ","6086,557            ","6087,1948           ","6088,23,10,3        ","6089,1062           ","6090,11             ",
"6091,15,9,4         ","6092,1475           ","6093,14,9,6         ","6094,973            ","6095,2186           ","6096,20,11,2        ","6097,346            ","6098,1395           ","6099,22,16,14       ","6100,577            ",
"6101,24,20,11       ","6102,22,17,16       ","6103,376            ","6104,13,11,6        ","6105,823            ","6106,2079           ","6107,23,12,10       ","6108,213            ","6109,17,11,4        ","6110,26,19,13       ",
"6111,467            ","6112,35,12,1        ","6113,1283           ","6114,11,6,5         ","6115,22,19,10       ","6116,873            ","6117,34,33,30       ","6118,1765           ","6119,287            ","6120,4,3,1          ",
"6121,490            ","6122,32,24,11       ","6123,25,22,6        ","6124,19             ","6125,22,8,6         ","6126,20,15,5        ","6127,31,9,4         ","6128,34,15,2        ","6129,1421           ","6130,24,22,7        ",
"6131,36,34,7        ","6132,135            ","6133,16,7,3         ","6134,2445           ","6135,572            ","6136,17,7,5         ","6137,1682           ","6138,26,11,10       ","6139,14,13,3        ","6140,135            ",
"6141,16,13,6        ","6142,2245           ","6143,1005           ","6144,26,7,1         ","6145,348            ","6146,71             ","6147,29,24,6        ","6148,25,18,16       ","6149,23,20,14       ","6150,1297           ",
"6151,538            ","6152,28,27,13       ","6153,77             ","6154,23,12,10       ","6155,34,33,4        ","6156,25             ","6157,17,16,14       ","6158,14,6,5         ","6159,1165           ","6160,38,15,10       ",
"6161,1556           ","6162,603            ","6163,17,12,7        ","6164,1179           ","6165,25,15,12       ","6166,5,4,2          ","6167,33             ","6168,20,11,2        ","6169,1204           ","6170,1179           ",
"6171,22,10,8        ","6172,3              ","6173,10,9,1         ","6174,1029           ","6175,823            ","6176,29,15,1        ","6177,430            ","6178,1719           ","6179,16,8,1         ","6180,245            ",
"6181,22,13,6        ","6182,1773           ","6183,56             ","6184,39,13,12       ","6185,308            ","6186,15,6,4         ","6187,26,25,18       ","6188,1223           ","6189,26,8,5         ","6190,877            ",
"6191,1074           ","6192,20,5,2         ","6193,919            ","6194,21,9,2         ","6195,30,24,23       ","6196,1807           ","6197,25,14,4        ","6198,213            ","6199,109            ","6200,29,10,7        ",
"6201,922            ","6202,867            ","6203,20,15,10       ","6204,691            ","6205,14,12,1        ","6206,22,7,5         ","6207,1363           ","6208,25,23,14       ","6209,935            ","6210,711            ",
"6211,19,18,5        ","6212,27,16,14       ","6213,15,14,12       ","6214,913            ","6215,134            ","6216,39,30,9        ","6217,711            ","6218,383            ","6219,17,14,4        ","6220,889            ",
"6221,21,12,3        ","6222,693            ","6223,1033           ","6224,13,4,2         ","6225,317            ","6226,1035           ","6227,18,9,8         ","6228,2691           ","6229,12,7,6         ","6230,1317           ",
"6231,359            ","6232,17,3,1         ","6233,777            ","6234,22,18,7        ","6235,23,18,10       ","6236,1701           ","6237,32,14,9        ","6238,2353           ","6239,921            ","6240,11,10,2        ",
"6241,592            ","6242,32,28,27       ","6243,17,10,5        ","6244,475            ","6245,28,26,4        ","6246,1565           ","6247,586            ","6248,18,7,2         ","6249,1000           ","6250,363            ",
"6251,35,34,31       ","6252,15,10,6        ","6253,14,10,2        ","6254,30,29,4        ","6255,2318           ","6256,11,10,5        ","6257,852            ","6258,647            ","6259,18,12,3        ","6260,1601           ",
"6261,17,14,12       ","6262,261            ","6263,1466           ","6264,17,16,7        ","6265,502            ","6266,10,7,5         ","6267,26,8,5         ","6268,973            ","6269,31,8,3         ","6270,737            ",
"6271,54             ","6272,17,10,6        ","6273,1106           ","6274,999            ","6275,15,14,5        ","6276,1787           ","6277,16,10,6        ","6278,749            ","6279,290            ","6280,9,7,5          ",
"6281,2021           ","6282,1895           ","6283,14,11,4        ","6284,16,13,8        ","6285,26,14,5        ","6286,741            ","6287,104            ","6288,34,25,5        ","6289,237            ","6290,1127           ",
"6291,29,6,5         ","6292,2317           ","6293,30,20,18       ","6294,57             ","6295,82             ","6296,35,19,10       ","6297,190            ","6298,15,10,1        ","6299,25,13,2        ","6300,7              ",
"6301,17,8,7         ","6302,2105           ","6303,467            ","6304,13,3,1         ","6305,1052           ","6306,2079           ","6307,28,27,5        ","6308,405            ","6309,23,13,10       ","6310,11,7,2         ",
"6311,1155           ","6312,35,33,14       ","6313,355            ","6314,16,11,7        ","6315,42,40,31       ","6316,21             ","6317,11,6,1         ","6318,333            ","6319,1213           ","6320,29,28,10       ",
"6321,1              ","6322,387            ","6323,19,15,14       ","6324,1273           ","6325,18,4,2         ","6326,1029           ","6327,22,15,10       ","6328,15,6,1         ","6329,21,16,1        ","6330,623            ",
"6331,21,12,1        ","6332,2781           ","6333,22,14,2        ","6334,1977           ","6335,368            ","6336,22,15,9        ","6337,2086           ","6338,459            ","6339,17,10,7        ","6340,1137           ",
"6341,16,14,9        ","6342,1309           ","6343,939            ","6344,21,15,2        ","6345,2566           ","6346,31,22,16       ","6347,11,6,2         ","6348,75             ","6349,8,6,1          ","6350,11,7,6         ",
"6351,1234           ","6352,21,11,4        ","6353,1025           ","6354,1155           ","6355,30,27,16       ","6356,1115           ","6357,37,27,12       ","6358,229            ","6359,305            ","6360,13,11,1        ",
"6361,31,17,3        ","6362,1967           ","6363,32,23,14       ","6364,67             ","6365,21,14,5        ","6366,273            ","6367,142            ","6368,31,9,1         ","6369,19,11,10       ","6370,1147           ",
"6371,30,18,17       ","6372,135            ","6373,21,18,9        ","6374,12,9,8         ","6375,313            ","6376,28,27,5        ","6377,275            ","6378,2643           ","6379,30,10,5        ","6380,1085           ",
"6381,33,26,3        ","6382,2061           ","6383,1013           ","6384,34,29,7        ","6385,364            ","6386,543            ","6387,28,14,4        ","6388,2731           ","6389,19,17,4        ","6390,581            ",
"6391,324            ","6392,39,34,10       ","6393,103            ","6394,1447           ","6395,29,7,4         ","6396,91             ","6397,17,6,4         ","6398,12,11,10       ","6399,146            ","6400,37,12,3        ",
"6401,1146           ","6402,947            ","6403,15,10,4        ","6404,1779           ","6405,18,10,7        ","6406,613            ","6407,231            ","6408,31,12,10       ","6409,72             ","6410,18,15,2        ",
"6411,23,18,14       ","6412,1131           ","6413,18,17,10       ","6414,34,15,9        ","6415,663            ","6416,29,15,7        ","6417,19             ","6418,1095           ","6419,9,7,4          ","6420,903            ",
"6421,24,16,14       ","6422,621            ","6423,26,19,1        ","6424,29,18,5        ","6425,231            ","6426,207            ","6427,35,29,18       ","6428,791            ","6429,18,16,13       ","6430,1333           ",
"6431,3              ","6432,26,13,7        ","6433,810            ","6434,651            ","6435,15,9,4         ","6436,1141           ","6437,23,18,4        ","6438,425            ","6439,630            ","6440,21,18,14       ",
"6441,41             ","6442,19,18,5        ","6443,25,17,16       ","6444,1647           ","6445,30,10,4        ","6446,2633           ","6447,1547           ","6448,25,23,8        ","6449,777            ","6450,1707           ",
"6451,26,14,13       ","6452,381            ","6453,29,24,14       ","6454,825            ","6455,732            ","6456,31,25,17       ","6457,840            ","6458,119            ","6459,25,17,2        ","6460,2073           ",
"6461,36,15,6        ","6462,24,3,2         ","6463,93             ","6464,25,22,6        ","6465,224            ","6466,26,8,7         ","6467,7,6,2          ","6468,217            ","6469,24,22,6        ","6470,477            ",
"6471,1910           ","6472,31,30,2        ","6473,1211           ","6474,563            ","6475,18,13,2        ","6476,1535           ","6477,31,18,15       ","6478,213            ","6479,84             ","6480,11,10,1        ",
"6481,538            ","6482,17,8,3         ","6483,10,5,1         ","6484,43             ","6485,21,8,6         ","6486,23,11,1        ","6487,880            ","6488,21,13,7        ","6489,706            ","6490,111            ",
"6491,17,16,6        ","6492,1169           ","6493,38,11,4        ","6494,29,27,5        ","6495,283            ","6496,21,5,2         ","6497,1736           ","6498,2079           ","6499,26,9,2         ","6500,375            ",
"6501,24,21,14       ","6502,465            ","6503,330            ","6504,23,15,9        ","6505,1911           ","6506,15,7,5         ","6507,25,12,9        ","6508,20,11,3        ","6509,14,12,7        ","6510,61             ",
"6511,2673           ","6512,29,27,13       ","6513,682            ","6514,2571           ","6515,27,26,12       ","6516,18,12,3        ","6517,24,11,2        ","6518,513            ","6519,725            ","6520,37,29,11       ",
"6521,695            ","6522,675            ","6523,12,6,3         ","6524,1283           ","6525,16,12,10       ","6526,2137           ","6527,242            ","6528,16,7,2         ","6529,765            ","6530,15,9,5         ",
"6531,17,14,12       ","6532,15,10,7        ","6533,18,11,9        ","6534,45             ","6535,31             ","6536,25,10,9        ","6537,542            ","6538,31             ","6539,12,8,2         ","6540,333            ",
"6541,14,11,7        ","6542,33,29,9        ","6543,28,21,7        ","6544,19,15,1        ","6545,1322           ","6546,279            ","6547,12,11,10       ","6548,945            ","6549,34,15,6        ","6550,2401           ",
"6551,941            ","6552,27,22,6        ","6553,265            ","6554,159            ","6555,28,24,22       ","6556,885            ","6557,34,30,17       ","6558,153            ","6559,879            ","6560,19,13,11       ",
"6561,1834           ","6562,651            ","6563,35,30,21       ","6564,525            ","6565,19,15,8        ","6566,10,3,1         ","6567,1112           ","6568,19,15,1        ","6569,1410           ","6570,1323           ",
"6571,14,13,6        ","6572,20,15,11       ","6573,17,10,5        ","6574,29,15,14       ","6575,884            ","6576,27,25,19       ","6577,2341           ","6578,1587           ","6579,32,15,6        ","6580,2577           ",
"6581,10,8,6         ","6582,17,13,8        ","6583,859            ","6584,37,23,7        ","6585,476            ","6586,34,32,15       ","6587,27,4,2         ","6588,1617           ","6589,30,25,7        ","6590,957            ",
"6591,1999           ","6592,45,42,1        ","6593,279            ","6594,2679           ","6595,33,8,5         ","6596,665            ","6597,18,14,5        ","6598,885            ","6599,189            ","6600,21,19,16       ",
"6601,457            ","6602,14,8,3         ","6603,30,20,8        ","6604,1279           ","6605,25,15,14       ","6606,2365           ","6607,813            ","6608,9,4,2          ","6609,286            ","6610,27,26,8        ",
"6611,13,10,3        ","6612,289            ","6613,28,22,15       ","6614,2105           ","6615,136            ","6616,33,9,3         ","6617,71             ","6618,2379           ","6619,7,6,1          ","6620,341            ",
"6621,21,19,6        ","6622,645            ","6623,491            ","6624,15,14,9        ","6625,549            ","6626,20,3,1         ","6627,26,7,5         ","6628,2259           ","6629,11,9,4         ","6630,1617           ",
"6631,823            ","6632,27,20,17       ","6633,535            ","6634,559            ","6635,14,13,9        ","6636,1189           ","6637,29,26,21       ","6638,3185           ","6639,2135           ","6640,43,32,9        ",
"6641,167            ","6642,1063           ","6643,42,25,9        ","6644,917            ","6645,23,18,3        ","6646,9,8,5          ","6647,77             ","6648,25,19,16       ","6649,202            ","6650,1391           ",
"6651,22,19,14       ","6652,1143           ","6653,8,7,3          ","6654,1809           ","6655,54             ","6656,19,15,1        ","6657,839            ","6658,31,30,19       ","6659,20,16,1        ","6660,475            ",
"6661,14,12,1        ","6662,2901           ","6663,416            ","6664,24,15,6        ","6665,147            ","6666,999            ","6667,13,8,2         ","6668,221            ","6669,16,7,5         ","6670,673            ",
"6671,930            ","6672,26,21,5        ","6673,256            ","6674,983            ","6675,16,10,1        ","6676,3141           ","6677,26,9,7         ","6678,41             ","6679,550            ","6680,29,7,3         ",
"6681,124            ","6682,38,21,5        ","6683,12,5,3         ","6684,1275           ","6685,18,11,1        ","6686,617            ","6687,872            ","6688,55,32,9        ","6689,1764           ","6690,1911           ",
"6691,15,12,1        ","6692,2237           ","6693,10,6,4         ","6694,2989           ","6695,3072           ","6696,45,19,7        ","6697,2613           ","6698,18,14,11       ","6699,14,12,3        ","6700,625            ",
"6701,19,8,4         ","6702,1145           ","6703,675            ","6704,11,10,6        ","6705,218            ","6706,1683           ","6707,32,15,14       ","6708,189            ","6709,18,12,7        ","6710,1397           ",
"6711,2929           ","6712,31,26,2        ","6713,11             ","6714,751            ","6715,17,6,1         ","6716,1781           ","6717,16,11,7        ","6718,14,9,7         ","6719,455            ","6720,12,9,7         ",
"6721,210            ","6722,2387           ","6723,21,18,4        ","6724,1017           ","6725,23,3,2         ","6726,21             ","6727,397            ","6728,21,8,2         ","6729,631            ","6730,3              ",
"6731,32,27,6        ","6732,965            ","6733,8,5,3          ","6734,21,14,9        ","6735,1241           ","6736,27,14,2        ","6737,1197           ","6738,35,24,5        ","6739,29,24,1        ","6740,41             ",
"6741,18,15,11       ","6742,9,4,3          ","6743,240            ","6744,29,21,15       ","6745,136            ","6746,1563           ","6747,22,21,1        ","6748,1273           ","6749,18,16,4        ","6750,2781           ",
"6751,1104           ","6752,11,8,2         ","6753,35             ","6754,1483           ","6755,30,20,3        ","6756,225            ","6757,466            ","6758,3105           ","6759,29             ","6760,37,15,7        ",
"6761,15             ","6762,28,4,3         ","6763,32,21,11       ","6764,989            ","6765,23,3,2         ","6766,17,5,4         ","6767,300            ","6768,18,15,10       ","6769,97             ","6770,34,31,24       ",
"6771,36,13,12       ","6772,321            ","6773,32,20,6        ","6774,733            ","6775,1293           ","6776,25,11,6        ","6777,925            ","6778,34,33,1        ","6779,16,6,2         ","6780,655            ",
"6781,16,15,4        ","6782,3321           ","6783,518            ","6784,16,15,1        ","6785,452            ","6786,171            ","6787,25,5,2         ","6788,2345           ","6789,28,19,9        ","6790,22,8,5         ",
"6791,107            ","6792,27,25,24       ","6793,571            ","6794,707            ","6795,17,2,1         ","6796,895            ","6797,20,10,6        ","6798,1029           ","6799,1240           ","6800,26,25,1        ",
"6801,140            ","6802,29,25,3        ","6803,32,21,16       ","6804,49             ","6805,24,20,7        ","6806,25,23,16       ","6807,1568           ","6808,37,19,13       ","6809,27,10,5        ","6810,679            ",
"6811,21,20,8        ","6812,1115           ","6813,24,19,16       ","6814,32,26,25       ","6815,518            ","6816,22,5,2         ","6817,682            ","6818,1571           ","6819,21,11,8        ","6820,747            ",
"6821,19,13,8        ","6822,1425           ","6823,14,5,1         ","6824,21,14,10       ","6825,133            ","6826,435            ","6827,26,12,8        ","6828,63             ","6829,20,16,6        ","6830,537            ",
"6831,115            ","6832,35,32,25       ","6833,35             ","6834,23,14,1        ","6835,23,4,2         ","6836,473            ","6837,21,17,14       ","6838,357            ","6839,96             ","6840,14,9,3         ",
"6841,427            ","6842,18,17,7        ","6843,26,9,6         ","6844,20,15,5        ","6845,26,20,6        ","6846,2497           ","6847,2247           ","6848,29,22,18       ","6849,221            ","6850,21,7,4         ",
"6851,31,30,4        ","6852,839            ","6853,28,27,15       ","6854,21,14,1        ","6855,254            ","6856,30,29,17       ","6857,386            ","6858,747            ","6859,16,12,9        ","6860,531            ",
"6861,21,10,3        ","6862,1405           ","6863,956            ","6864,11,5,2         ","6865,2494           ","6866,647            ","6867,16,4,2         ","6868,43             ","6869,17,10,1        ","6870,27,22,21       ",
"6871,1719           ","6872,25,13,2        ","6873,2056           ","6874,2631           ","6875,22,21,4        ","6876,287            ","6877,15,14,2        ","6878,21,15,5        ","6879,9,6,2          ","6880,31,30,19       ",
"6881,152            ","6882,1883           ","6883,32,26,25       ","6884,383            ","6885,22,21,12       ","6886,565            ","6887,495            ","6888,24,11,9        ","6889,652            ","6890,16,15,8        ",
"6891,30,15,10       ","6892,421            ","6893,20,12,6        ","6894,12,9,8         ","6895,256            ","6896,29,17,11       ","6897,27,18,8        ","6898,439            ","6899,6,5,2          ","6900,915            ",
"6901,6,4,1          ","6902,645            ","6903,2981           ","6904,36,13,11       ","6905,2513           ","6906,1667           ","6907,23,12,2        ","6908,1613           ","6909,36,35,8        ","6910,1953           ",
"6911,1031           ","6912,25,15,12       ","6913,414            ","6914,16,11,4        ","6915,18,15,7        ","6916,13,4,1         ","6917,22,13,8        ","6918,1653           ","6919,15,14,2        ","6920,8,3,1          ",
"6921,1046           ","6922,25,15,13       ","6923,17,9,2         ","6924,93             ","6925,24,9,7         ","6926,29,9,3         ","6927,653            ","6928,8,7,5          ","6929,3216           ","6930,699            ",
"6931,21,14,13       ","6932,627            ","6933,35,26,4        ","6934,15,10,9        ","6935,678            ","6936,37,31,30       ","6937,582            ","6938,963            ","6939,16,12,6        ","6940,399            ",
"6941,27,12,11       ","6942,1949           ","6943,211            ","6944,23,21,8        ","6945,17,3,2         ","6946,23,16,14       ","6947,25,19,18       ","6948,63             ","6949,16,5,2         ","6950,11,9,3         ",
"6951,434            ","6952,32,21,19       ","6953,1820           ","6954,735            ","6955,13,7,4         ","6956,1727           ","6957,24,10,3        ","6958,2113           ","6959,1070           ","6960,14,9,3         ",
"6961,570            ","6962,16,11,1        ","6963,24,20,6        ","6964,13             ","6965,18,8,7         ","6966,249            ","6967,2269           ","6968,35,32,17       ","6969,1073           ","6970,1867           ",
"6971,28,20,6        ","6972,455            ","6973,36,34,14       ","6974,369            ","6975,992            ","6976,19,18,9        ","6977,285            ","6978,23,18,3        ","6979,11,8,6         ","6980,485            ",
"6981,17,16,11       ","6982,21,16,8        ","6983,168            ","6984,8,3,2          ","6985,439            ","6986,579            ","6987,21,6,4         ","6988,445            ","6989,15,12,2        ","6990,1673           ",
"6991,510            ","6992,27,11,9        ","6993,166            ","6994,28,12,3        ","6995,25,12,4        ","6996,1025           ","6997,27,17,4        ","6998,1241           ","6999,623            ","7000,27,26,11       ",
"7001,1631           ","7002,3375           ","7003,16,6,5         ","7004,291            ","7005,14,11,4        ","7006,981            ","7007,914            ","7008,33,25,6        ","7009,1932           ","7010,14,13,6        ",
"7011,5,2,1          ","7012,273            ","7013,8,5,2          ","7014,633            ","7015,1483           ","7016,23,10,7        ","7017,175            ","7018,1695           ","7019,33,14,13       ","7020,117            ",
"7021,23,6,4         ","7022,1337           ","7023,242            ","7024,22,15,10       ","7025,1701           ","7026,195            ","7027,20,9,2         ","7028,25,16,2        ","7029,29,23,16       ","7030,793            ",
"7031,1029           ","7032,19,13,9        ","7033,16             ","7034,2679           ","7035,29,9,8         ","7036,1353           ","7037,26,24,20       ","7038,2961           ","7039,669            ","7040,19,18,7        ",
"7041,587            ","7042,2871           ","7043,15,12,6        ","7044,23             ","7045,19,6,3         ","7046,1961           ","7047,238            ","7048,39,17,4        ","7049,794            ","7050,1379           ",
"7051,7,6,3          ","7052,3471           ","7053,13,6,1         ","7054,17,11,1        ","7055,803            ","7056,27,24,10       ","7057,937            ","7058,1103           ","7059,31,17,4        ","7060,765            ",
"7061,24,23,1        ","7062,2597           ","7063,265            ","7064,11,5,2         ","7065,599            ","7066,21,14,11       ","7067,19,11,10       ","7068,549            ","7069,28,17,14       ","7070,1217           ",
"7071,137            ","7072,37,26,17       ","7073,2202           ","7074,259            ","7075,31,26,20       ","7076,677            ","7077,674            ","7078,11,10,2        ","7079,351            ","7080,27,18,16       ",
"7081,333            ","7082,423            ","7083,26,22,2        ","7084,345            ","7085,20,15,14       ","7086,22,6,3         ","7087,1245           ","7088,32,5,2         ","7089,2519           ","7090,21,15,1        ",
"7091,9,7,4          ","7092,1929           ","7093,22,18,2        ","7094,23,13,12       ","7095,67             ","7096,27,17,13       ","7097,936            ","7098,2695           ","7099,16,4,1         ","7100,921            ",
"7101,8,7,1          ","7102,28,21,8        ","7103,63             ","7104,15,10,4        ","7105,1954           ","7106,3123           ","7107,8,2,1          ","7108,235            ","7109,26,21,8        ","7110,41             ",
"7111,1665           ","7112,35,5,2         ","7113,1618           ","7114,13,12,3        ","7115,34,9,5         ","7116,3417           ","7117,27,26,10       ","7118,1113           ","7119,935            ","7120,17,15,5        ",
"7121,953            ","7122,35,13,2        ","7123,26,22,6        ","7124,89             ","7125,11,10,5        ","7126,2785           ","7127,42             ","7128,19,13,2        ","7129,130            ","7130,35,24,21       ",
"7131,21,10,7        ","7132,273            ","7133,36,34,10       ","7134,729            ","7135,553            ","7136,16,3,2         ","7137,337            ","7138,20,7,6         ","7139,26,21,11       ","7140,225            ",
"7141,26,9,1         ","7142,27,20,15       ","7143,2426           ","7144,33,13,3        ","7145,1127           ","7146,259            ","7147,20,17,9        ","7148,935            ","7149,9,7,6          ","7150,33             ",
"7151,660            ","7152,37,23,16       ","7153,301            ","7154,15,14,8        ","7155,34,21,18       ","7156,1117           ","7157,20,18,16       ","7158,33,23,12       ","7159,1332           ","7160,27,26,9        ",
"7161,49             ","7162,1647           ","7163,7,3,2          ","7164,33             ","7165,21,17,2        ","7166,3521           ","7167,3529           ","7168,13,10,6        ","7169,1110           ","7170,1887           ",
"7171,22,18,3        ","7172,2549           ","7173,28,26,19       ","7174,16,13,4        ","7175,584            ","7176,33,31,21       ","7177,918            ","7178,16,7,6         ","7179,30,20,15       ","7180,415            ",
"7181,24,13,11       ","7182,245            ","7183,30             ","7184,33,27,2        ","7185,1064           ","7186,19,10,1        ","7187,18,14,12       ","7188,23,19,7        ","7189,18,14,8        ","7190,897            ",
"7191,1201           ","7192,29,14,6        ","7193,2412           ","7194,1763           ","7195,32,30,7        ","7196,1607           ","7197,17,14,12       ","7198,11,2,1         ","7199,21             ","7200,29,23,3        ",
"7201,153            ","7202,1631           ","7203,686            ","7204,1695           ","7205,21,5,2         ","7206,2349           ","7207,246            ","7208,29,23,21       ","7209,460            ","7210,3111           ",
"7211,29,8,6         ","7212,29,26,4        ","7213,25,15,8        ","7214,28,7,2         ","7215,19             ","7216,15,8,1         ","7217,891            ","7218,3263           ","7219,23,6,5         ","7220,2975           ",
"7221,13,12,10       ","7222,2733           ","7223,245            ","7224,15,12,10       ","7225,333            ","7226,2807           ","7227,29,22,7        ","7228,1165           ","7229,19,4,2         ","7230,2421           ",
"7231,2185           ","7232,35,12,9        ","7233,1435           ","7234,29,22,18       ","7235,19,18,7        ","7236,75             ","7237,21,10,2        ","7238,19,14,6        ","7239,1610           ","7240,33,14,2        ",
"7241,308            ","7242,87             ","7243,25,10,1        ","7244,497            ","7245,26,23,9        ","7246,2505           ","7247,726            ","7248,17,7,4         ","7249,274            ","7250,2427           ",
"7251,19,14,13       ","7252,1885           ","7253,32,13,7        ","7254,933            ","7255,283            ","7256,22,21,7        ","7257,3472           ","7258,2731           ","7259,38,19,1        ","7260,121            ",
"7261,28,3,2         ","7262,32,13,12       ","7263,256            ","7264,41,36,19       ","7265,776            ","7266,139            ","7267,32,17,6        ","7268,14,4,3         ","7269,33,32,30       ","7270,829            ",
"7271,1325           ","7272,23,10,4        ","7273,789            ","7274,38,31,18       ","7275,8,2,1          ","7276,1621           ","7277,24,23,7        ","7278,1741           ","7279,3247           ","7280,37,6,4         ",
"7281,179            ","7282,26,8,7         ","7283,34,22,12       ","7284,625            ","7285,29,18,5        ","7286,1793           ","7287,1349           ","7288,25,23,17       ","7289,1253           ","7290,1431           ",
"7291,29,24,1        ","7292,3033           ","7293,34,14,8        ","7294,22,13,10       ","7295,1961           ","7296,37,7,2         ","7297,570            ","7298,15,13,11       ","7299,26,11,3        ","7300,925            ",
"7301,23,22,7        ","7302,1521           ","7303,3280           ","7304,37,30,17       ","7305,602            ","7306,7              ","7307,19,15,2        ","7308,287            ","7309,23,15,2        ","7310,3557           ",
"7311,341            ","7312,25,24,3        ","7313,45             ","7314,2787           ","7315,25,10,4        ","7316,1415           ","7317,20,19,4        ","7318,2625           ","7319,330            ","7320,35,28,10       ",
"7321,202            ","7322,1587           ","7323,26,11,2        ","7324,523            ","7325,35,29,6        ","7326,381            ","7327,2947           ","7328,41,30,26       ","7329,70             ","7330,11,10,9        ",
"7331,28,19,6        ","7332,643            ","7333,26,21,5        ","7334,237            ","7335,1421           ","7336,34,21,5        ","7337,828            ","7338,1351           ","7339,14,5,1         ","7340,311            ",
"7341,29,5,2         ","7342,577            ","7343,170            ","7344,33,28,3        ","7345,1344           ","7346,671            ","7347,27,26,2        ","7348,2863           ","7349,12,6,2         ","7350,573            ",
"7351,601            ","7352,20,5,3         ","7353,410            ","7354,2443           ","7355,27,26,7        ","7356,1179           ","7357,30,16,8        ","7358,20,15,6        ","7359,2864           ","7360,23,18,2        ",
"7361,155            ","7362,355            ","7363,34,24,19       ","7364,377            ","7365,26,20,5        ","7366,397            ","7367,213            ","7368,19,13,11       ","7369,1041           ","7370,1683           ",
"7371,28,16,9        ","7372,1429           ","7373,11,8,6         ","7374,829            ","7375,172            ","7376,41,22,16       ","7377,407            ","7378,523            ","7379,22,8,4         ","7380,105            ",
"7381,32,10,2        ","7382,2537           ","7383,20             ","7384,31,26,9        ","7385,912            ","7386,751            ","7387,23,20,10       ","7388,629            ","7389,22,17,13       ","7390,13,12,10       ",
"7391,35             ","7392,33,27,21       ","7393,1407           ","7394,1127           ","7395,8,4,2          ","7396,29,16,2        ","7397,28,26,21       ","7398,145            ","7399,2715           ","7400,19,9,5         ",
"7401,1814           ","7402,871            ","7403,30,20,14       ","7404,297            ","7405,17,14,6        ","7406,27,20,1        ","7407,27,21,17       ","7408,13,3,1         ","7409,854            ","7410,2179           ",
"7411,24,18,16       ","7412,1797           ","7413,17,6,2         ","7414,13,12,2        ","7415,10,9,5         ","7416,35,23,9        ","7417,634            ","7418,867            ","7419,32,29,2        ","7420,26,25,5        ",
"7421,26,14,2        ","7422,2961           ","7423,285            ","7424,18,13,7        ","7425,371            ","7426,1371           ","7427,30,17,1        ","7428,343            ","7429,30,10,4        ","7430,11,9,6         ",
"7431,65             ","7432,30,19,7        ","7433,420            ","7434,2295           ","7435,13,5,2         ","7436,315            ","7437,31,20,19       ","7438,3285           ","7439,2505           ","7440,22,21,15       ",
"7441,1053           ","7442,10,6,5         ","7443,23,12,6        ","7444,679            ","7445,12,5,2         ","7446,1217           ","7447,1              ","7448,21,20,14       ","7449,625            ","7450,379            ",
"7451,16,14,9        ","7452,1701           ","7453,30,29,7        ","7454,24,13,5        ","7455,284            ","7456,27,8,1         ","7457,12,9,2         ","7458,3127           ","7459,40,32,14       ","7460,1535           ",
"7461,20,19,7        ","7462,345            ","7463,2939           ","7464,21,18,14       ","7465,277            ","7466,2087           ","7467,25,20,4        ","7468,789            ","7469,30,26,22       ","7470,17,8,3         ",
"7471,400            ","7472,23,13,7        ","7473,457            ","7474,23,17,15       ","7475,24,10,8        ","7476,423            ","7477,23,16,2        ","7478,1797           ","7479,1069           ","7480,32,15,2        ",
"7481,887            ","7482,18,4,3         ","7483,25,18,2        ","7484,3305           ","7485,26,8,1         ","7486,22,19,16       ","7487,2940           ","7488,21,16,6        ","7489,2644           ","7490,2843           ",
"7491,10,9,7         ","7492,1015           ","7493,20,10,3        ","7494,20,9,8         ","7495,241            ","7496,23,21,12       ","7497,49             ","7498,33,15,12       ","7499,27,14,9        ","7500,125            ",
"7501,21,13,2        ","7502,20,17,8        ","7503,628            ","7504,45,17,2        ","7505,1451           ","7506,135            ","7507,34,14,9        ","7508,3503           ","7509,21,10,4        ","7510,26,7,2         ",
"7511,51             ","7512,22,21,3        ","7513,2697           ","7514,38,21,5        ","7515,18,17,11       ","7516,27,25,18       ","7517,20,19,10       ","7518,3653           ","7519,15             ","7520,19,9,7         ",
"7521,1501           ","7522,2331           ","7523,35,22,1        ","7524,75             ","7525,17,11,4        ","7526,533            ","7527,1507           ","7528,18,13,1        ","7529,953            ","7530,307            ",
"7531,13,10,3        ","7532,705            ","7533,11,8,7         ","7534,2349           ","7535,2726           ","7536,42,21,14       ","7537,1377           ","7538,735            ","7539,26,19,10       ","7540,2127           ",
"7541,28,10,2        ","7542,549            ","7543,1173           ","7544,23,13,7        ","7545,1679           ","7546,15,8,5         ","7547,24,22,11       ","7548,1689           ","7549,22,16,12       ","7550,27,26,9        ",
"7551,145            ","7552,17,8,3         ","7553,492            ","7554,12,11,6        ","7555,26,13,2        ","7556,2835           ","7557,18,16,12       ","7558,1501           ","7559,185            ","7560,41,21,3        ",
"7561,846            ","7562,1547           ","7563,29,8,7         ","7564,1845           ","7565,24,22,13       ","7566,209            ","7567,151            ","7568,15,5,3         ","7569,3409           ","7570,3303           ",
"7571,16,14,7        ","7572,2413           ","7573,12,7,6         ","7574,197            ","7575,2174           ","7576,41,40,11       ","7577,846            ","7578,423            ","7579,14,11,3        ","7580,761            ",
"7581,23,21,14       ","7582,13,6,2         ","7583,653            ","7584,51,46,10       ","7585,268            ","7586,3251           ","7587,15,9,4         ","7588,655            ","7589,15,10,7        ","7590,869            ",
"7591,1236           ","7592,45,10,1        ","7593,1210           ","7594,3471           ","7595,34,32,13       ","7596,55             ","7597,32,11,7        ","7598,1469           ","7599,2066           ","7600,19,18,2        ",
"7601,2555           ","7602,555            ","7603,6,5,2          ","7604,1257           ","7605,28,15,3        ","7606,24,9,7         ","7607,111            ","7608,39,25,10       ","7609,495            ","7610,18,11,2        ",
"7611,32,27,6        ","7612,1671           ","7613,25,8,6         ","7614,945            ","7615,19,13,7        ","7616,31,21,14       ","7617,18,5,3         ","7618,22,17,6        ","7619,29,18,6        ","7620,203            ",
"7621,32,29,19       ","7622,581            ","7623,637            ","7624,9,2,1          ","7625,474            ","7626,291            ","7627,40,15,2        ","7628,3773           ","7629,35,10,7        ","7630,2833           ",
"7631,92             ","7632,54,3,2         ","7633,24,14,7        ","7634,2963           ","7635,27,11,2        ","7636,733            ","7637,13,10,8        ","7638,2673           ","7639,3729           ","7640,29,3,2         ",
"7641,925            ","7642,663            ","7643,16,5,1         ","7644,161            ","7645,28,15,10       ","7646,1233           ","7647,1105           ","7648,37,33,10       ","7649,2222           ","7650,199            ",
"7651,24,16,13       ","7652,2165           ","7653,21,14,11       ","7654,20,14,1        ","7655,3629           ","7656,30,13,7        ","7657,1069           ","7658,3627           ","7659,17,13,10       ","7660,2287           ",
"7661,30,20,4        ","7662,2473           ","7663,1203           ","7664,30,23,5        ","7665,97             ","7666,1351           ","7667,27,26,7        ","7668,77             ","7669,30,6,3         ","7670,13,11,4        ",
"7671,769            ","7672,39,5,1         ","7673,120            ","7674,1891           ","7675,9,6,1          ","7676,21,14,11       ","7677,38,25,11       ","7678,2325           ","7679,1497           ","7680,27,9,3         ",
"7681,1500           ","7682,479            ","7683,23,14,7        ","7684,1419           ","7685,10,9,8         ","7686,581            ","7687,867            ","7688,35,16,6        ","7689,728            ","7690,23,19,11       ",
"7691,36,29,2        ","7692,1683           ","7693,30,9,4         ","7694,2685           ","7695,119            ","7696,17,16,15       ","7697,282            ","7698,111            ","7699,10,6,3         ","7700,177            ",
"7701,20,14,8        ","7702,541            ","7703,2786           ","7704,15,12,10       ","7705,1962           ","7706,831            ","7707,19,18,15       ","7708,13             ","7709,18,4,2         ","7710,3853           ",
"7711,3084           ","7712,27,22,5        ","7713,1060           ","7714,367            ","7715,22,16,14       ","7716,1157           ","7717,7,6,1          ","7718,11,5,3         ","7719,1993           ","7720,27,25,4        ",
"7721,1382           ","7722,15             ","7723,30,21,9        ","7724,1967           ","7725,23,22,17       ","7726,30,23,7        ","7727,1007           ","7728,21,6,3         ","7729,594            ","7730,1979           ",
"7731,11,10,1        ","7732,49             ","7733,15,8,3         ","7734,2089           ","7735,717            ","7736,22,11,3        ","7737,13,5,1         ","7738,3499           ","7739,48,33,29       ","7740,47             ",
"7741,32,22,11       ","7742,377            ","7743,3007           ","7744,33,28,27       ","7745,1364           ","7746,22,19,10       ","7747,28,26,12       ","7748,1155           ","7749,28,25,2        ","7750,721            ",
"7751,273            ","7752,35,30,2        ","7753,1459           ","7754,31,7,5         ","7755,16,7,2         ","7756,29,6,4         ","7757,17,10,7        ","7758,1633           ","7759,42             ","7760,32,23,21       ",
"7761,2074           ","7762,231            ","7763,14,10,6        ","7764,499            ","7765,18,17,1        ","7766,1341           ","7767,410            ","7768,27,18,15       ","7769,2933           ","7770,1943           ",
"7771,38,35,27       ","7772,2879           ","7773,30,19,18       ","7774,3585           ","7775,243            ","7776,41,39,36       ","7777,150            ","7778,24,23,3        ","7779,40,22,14       ","7780,325            ",
"7781,24,22,5        ","7782,25,17,1        ","7783,118            ","7784,7,4,2          ","7785,818            ","7786,16,15,9        ","7787,26,18,7        ","7788,435            ","7789,17,13,2        ","7790,1533           ",
"7791,749            ","7792,47,31,29       ","7793,233            ","7794,675            ","7795,38,33,8        ","7796,1841           ","7797,14,10,1        ","7798,29,22,3        ","7799,137            ","7800,11,10,5        ",
"7801,558            ","7802,2103           ","7803,19,14,2        ","7804,9,8,2          ","7805,23,14,5        ","7806,17,12,6        ","7807,1533           ","7808,25,24,10       ","7809,2233           ","7810,699            ",
"7811,34,23,18       ","7812,413            ","7813,38,30,28       ","7814,2121           ","7815,994            ","7816,20,3,2         ","7817,47             ","7818,1291           ","7819,8,5,3          ","7820,35             ",
"7821,14,10,8        ","7822,2929           ","7823,458            ","7824,39,36,14       ","7825,966            ","7826,3483           ","7827,31,28,6        ","7828,163            ","7829,15,14,8        ","7830,1281           ",
"7831,825            ","7832,37,19,3        ","7833,613            ","7834,16,15,9        ","7835,28,20,10       ","7836,23,20,7        ","7837,30,23,1        ","7838,3789           ","7839,374            ","7840,33,29,23       ",
"7841,2829           ","7842,29,10,4        ","7843,16,9,6         ","7844,23,10,7        ","7845,32,31,7        ","7846,23,22,2        ","7847,270            ","7848,34,31,21       ","7849,967            ","7850,3591           ",
"7851,28,13,5        ","7852,2235           ","7853,30,28,26       ","7854,213            ","7855,1087           ","7856,12,3,2         ","7857,215            ","7858,3643           ","7859,22,3,2         ","7860,2505           ",
"7861,20,16,2        ","7862,17,13,10       ","7863,1568           ","7864,19,13,1        ","7865,654            ","7866,79             ","7867,40,35,21       ","7868,1227           ","7869,17,6,2         ","7870,981            ",
"7871,2462           ","7872,27,22,18       ","7873,154            ","7874,855            ","7875,28,21,13       ","7876,3165           ","7877,18,7,4         ","7878,129            ","7879,24,19,8        ","7880,25,19,17       ",
"7881,26,9,6         ","7882,17,15,10       ","7883,17,16,6        ","7884,215            ","7885,35,30,13       ","7886,25,15,13       ","7887,664            ","7888,12,9,7         ","7889,2400           ","7890,531            ",
"7891,18,5,1         ","7892,1113           ","7893,20,5,2         ","7894,21,16,13       ","7895,197            ","7896,45,39,7        ","7897,940            ","7898,29,8,2         ","7899,11,10,2        ","7900,1681           ",
"7901,17,13,10       ","7902,2729           ","7903,612            ","7904,45,34,25       ","7905,1612           ","7906,15,11,1        ","7907,20,10,6        ","7908,1333           ","7909,20,2,1         ","7910,221            ",
"7911,197            ","7912,7,3,2          ","7913,1466           ","7914,29,11,4        ","7915,32,22,6        ","7916,25,12,4        ","7917,27,26,23       ","7918,19,6,1         ","7919,756            ","7920,20,19,5        ",
"7921,2206           ","7922,1335           ","7923,26,21,14       ","7924,1089           ","7925,10,3,2         ","7926,1653           ","7927,321            ","7928,23,15,5        ","7929,1178           ","7930,17,10,5        ",
"7931,27,24,17       ","7932,515            ","7933,15,11,10       ","7934,137            ","7935,133            ","7936,40,23,21       ","7937,617            ","7938,891            ","7939,11,4,2         ","7940,795            ",
"7941,15,14,2        ","7942,1057           ","7943,80             ","7944,14,7,1         ","7945,2967           ","7946,51             ","7947,18,13,10       ","7948,3001           ","7949,28,17,7        ","7950,38,27,6        ",
"7951,498            ","7952,19,13,2        ","7953,413            ","7954,23,21,20       ","7955,16,11,1        ","7956,1557           ","7957,26,14,1        ","7958,1121           ","7959,424            ","7960,19,13,12       ",
"7961,1412           ","7962,1463           ","7963,11,7,2         ","7964,1253           ","7965,36,31,15       ","7966,1153           ","7967,483            ","7968,27,13,12       ","7969,1054           ","7970,29,19,3        ",
"7971,18,16,15       ","7972,1695           ","7973,21,14,3        ","7974,13,12,10       ","7975,387            ","7976,44,5,3         ","7977,1249           ","7978,14,4,3         ","7979,24,2,1         ","7980,15             ",
"7981,20,15,14       ","7982,25,8,4         ","7983,2678           ","7984,37,18,2        ","7985,504            ","7986,28,10,3        ","7987,7,6,1          ","7988,1679           ","7989,24,22,12       ","7990,1041           ",
"7991,2160           ","7992,26,25,17       ","7993,2073           ","7994,2423           ","7995,17,12,8        ","7996,2581           ","7997,16,3,2         ","7998,1989           ","7999,952            ","8000,16,3,1         ",
"8001,127            ","8002,12,4,3         ","8003,26,21,2        ","8004,3087           ","8005,18,16,11       ","8006,2201           ","8007,554            ","8008,23,22,17       ","8009,3159           ","8010,687            ",
"8011,20,16,5        ","8012,1541           ","8013,28,26,20       ","8014,1753           ","8015,776            ","8016,31,30,25       ","8017,141            ","8018,18,15,9        ","8019,39,33,16       ","8020,1713           ",
"8021,32,18,3        ","8022,917            ","8023,16,11,9        ","8024,21,14,11       ","8025,229            ","8026,1843           ","8027,11,10,9        ","8028,279            ","8029,33,19,16       ","8030,53             ",
"8031,13,12,3        ","8032,19,15,13       ","8033,2240           ","8034,695            ","8035,30,24,4        ","8036,131            ","8037,34,33,30       ","8038,13,9,8         ","8039,98             ","8040,39,13,7        ",
"8041,1305           ","8042,15,8,5         ","8043,25,17,16       ","8044,3627           ","8045,18,8,3         ","8046,1389           ","8047,1444           ","8048,30,23,3        ","8049,1009           ","8050,31,12,11       ",
"8051,24,15,5        ","8052,11,9,2         ","8053,20,19,12       ","8054,1025           ","8055,1069           ","8056,27,16,5        ","8057,960            ","8058,1115           ","8059,34,21,6        ","8060,297            ",
"8061,10,7,2         ","8062,2449           ","8063,273            ","8064,27,23,9        ","8065,253            ","8066,32,27,15       ","8067,42,29,17       ","8068,1603           ","8069,15,14,4        ","8070,413            ",
"8071,358            ","8072,23,11,6        ","8073,883            ","8074,28,26,3        ","8075,29,24,16       ","8076,1731           ","8077,30,27,18       ","8078,669            ","8079,1523           ","8080,39,14,11       ",
"8081,768            ","8082,239            ","8083,31,17,6        ","8084,2519           ","8085,31,22,13       ","8086,1597           ","8087,989            ","8088,25,10,8        ","8089,967            ","8090,3759           ",
"8091,16,9,1         ","8092,351            ","8093,20,5,3         ","8094,2889           ","8095,907            ","8096,32,11,2        ","8097,2513           ","8098,2667           ","8099,28,25,23       ","8100,9              ",
"8101,15,6,4         ","8102,31,2,1         ","8103,2333           ","8104,30,23,17       ","8105,1611           ","8106,771            ","8107,25,16,1        ","8108,627            ","8109,15,9,4         ","8110,217            ",
"8111,1130           ","8112,15,12,2        ","8113,3058           ","8114,1667           ","8115,20,17,5        ","8116,1057           ","8117,32,15,14       ","8118,21,15,1        ","8119,10             ","8120,8,3,2          ",
"8121,3494           ","8122,19,12,4        ","8123,47,22,18       ","8124,269            ","8125,26,18,10       ","8126,28,25,15       ","8127,218            ","8128,25,24,19       ","8129,548            ","8130,719            ",
"8131,25,7,6         ","8132,9,5,4          ","8133,30,19,18       ","8134,25             ","8135,468            ","8136,11,3,2         ","8137,739            ","8138,1043           ","8139,24,12,10       ","8140,1683           ",
"8141,32,8,6         ","8142,29,28,20       ","8143,1890           ","8144,28,27,17       ","8145,728            ","8146,1911           ","8147,22,8,1         ","8148,133            ","8149,18,8,4         ","8150,89             ",
"8151,3841           ","8152,29,25,14       ","8153,1020           ","8154,995            ","8155,18,10,5        ","8156,3641           ","8157,19,16,14       ","8158,23,17,7        ","8159,1026           ","8160,52,45,10       ",
"8161,292            ","8162,1391           ","8163,29,28,25       ","8164,471            ","8165,29,26,9        ","8166,381            ","8167,2553           ","8168,25,16,6        ","8169,481            ","8170,17,6,5         ",
"8171,21,17,8        ","8172,539            ","8173,11,8,7         ","8174,21,9,8         ","8175,661            ","8176,43,32,21       ","8177,905            ","8178,2611           ","8179,24,21,13       ","8180,185            ",
"8181,9,6,4          ","8182,1477           ","8183,1139           ","8184,32,27,6        ","8185,777            ","8186,10,7,3         ","8187,29,22,16       ","8188,1155           ","8189,41,10,4        ","8190,1869           ",
"8191,714            ","8192,9,5,2          ","8193,1055           ","8194,3847           ","8195,15,14,4        ","8196,2477           ","8197,21,8,2         ","8198,657            ","8199,2758           ","8200,18,15,3        ",
"8201,365            ","8202,15,12,11       ","8203,33,28,23       ","8204,1727           ","8205,21,18,13       ","8206,16,14,9        ","8207,5              ","8208,19,13,11       ","8209,943            ","8210,3507           ",
"8211,34,18,13       ","8212,1773           ","8213,24,10,4        ","8214,21,16,3        ","8215,469            ","8216,27,24,17       ","8217,94             ","8218,1443           ","8219,29,27,10       ","8220,327            ",
"8221,24,22,11       ","8222,2345           ","8223,308            ","8224,39,36,25       ","8225,2588           ","8226,447            ","8227,25,18,12       ","8228,23,18,6        ","8229,36,29,3        ","8230,2149           ",
"8231,3564           ","8232,22,15,9        ","8233,1407           ","8234,215            ","8235,38,36,21       ","8236,351            ","8237,23,18,11       ","8238,15,5,3         ","8239,1462           ","8240,14,13,7        ",
"8241,1694           ","8242,36,35,2        ","8243,35,14,2        ","8244,343            ","8245,18,16,14       ","8246,173            ","8247,2050           ","8248,25,15,13       ","8249,20,11,9        ","8250,3399           ",
"8251,13,10,3        ","8252,2861           ","8253,9,5,2          ","8254,3157           ","8255,1496           ","8256,32,21,14       ","8257,1530           ","8258,1407           ","8259,21,15,4        ","8260,225            ",
"8261,20,17,14       ","8262,693            ","8263,2232           ","8264,15,6,3         ","8265,161            ","8266,12,7,6         ","8267,21,16,2        ","8268,477            ","8269,24,13,2        ","8270,21,17,4        ",
"8271,44             ","8272,32,25,23       ","8273,3500           ","8274,419            ","8275,35,10,9        ","8276,915            ","8277,30,8,3         ","8278,193            ","8279,2439           ","8280,30,19,9        ",
"8281,226            ","8282,351            ","8283,25,23,4        ","8284,2197           ","8285,47,42,24       ","8286,3957           ","8287,1755           ","8288,27,5,4         ","8289,98             ","8290,43,24,14       ",
"8291,28,26,19       ","8292,637            ","8293,14,12,8        ","8294,21,12,11       ","8295,938            ","8296,37,19,6        ","8297,2846           ","8298,21,14,11       ","8299,29,28,8        ","8300,185            ",
"8301,27,13,10       ","8302,1305           ","8303,3789           ","8304,32,17,15       ","8305,417            ","8306,17,12,9        ","8307,19,17,10       ","8308,16,9,8         ","8309,28,26,10       ","8310,3333           ",
"8311,1470           ","8312,45,44,30       ","8313,4117           ","8314,18,15,9        ","8315,20,15,2        ","8316,405            ","8317,30,28,19       ","8318,21,16,10       ","8319,458            ","8320,41,39,5        ",
"8321,2985           ","8322,7,5,2          ","8323,35,12,10       ","8324,1149           ","8325,31,14,10       ","8326,14,5,4         ","8327,596            ","8328,37,23,14       ","8329,775            ","8330,1107           ",
"8331,37,34,10       ","8332,651            ","8333,26,18,14       ","8334,3285           ","8335,129            ","8336,33,10,2        ","8337,643            ","8338,16,15,7        ","8339,13,12,7        ","8340,553            ",
"8341,50,48,19       ","8342,2921           ","8343,1667           ","8344,27,15,1        ","8345,777            ","8346,26,25,10       ","8347,29,7,6         ","8348,1737           ","8349,29,22,7        ","8350,3177           ",
"8351,170            ","8352,35,18,14       ","8353,2548           ","8354,1515           ","8355,18,6,5         ","8356,22,18,13       ","8357,22,12,5        ","8358,677            ","8359,1905           ","8360,15,14,5        ",
"8361,24,20,8        ","8362,655            ","8363,20,3,2         ","8364,2443           ","8365,22,12,4        ","8366,2381           ","8367,154            ","8368,35,17,4        ","8369,29,15,1        ","8370,1643           ",
"8371,13,8,2         ","8372,17             ","8373,14,5,2         ","8374,4125           ","8375,2316           ","8376,45,39,17       ","8377,2035           ","8378,3851           ","8379,26,15,8        ","8380,1815           ",
"8381,22,15,5        ","8382,32,22,13       ","8383,23,13,8        ","8384,19,4,2         ","8385,2369           ","8386,907            ","8387,14,12,3        ","8388,691            ","8389,39,16,13       ","8390,3797           ",
"8391,1336           ","8392,17,11,1        ","8393,312            ","8394,30,10,3        ","8395,18,12,4        ","8396,17,14,11       ","8397,25,6,1         ","8398,3481           ","8399,4191           ","8400,29,28,11       ",
"8401,1105           ","8402,287            ","8403,22,6,1         ","8404,805            ","8405,32,22,16       ","8406,30,9,1         ","8407,1557           ","8408,20,9,2         ","8409,2506           ","8410,33,17,5        ",
"8411,30,27,5        ","8412,1049           ","8413,26,25,24       ","8414,3197           ","8415,1061           ","8416,40,33,22       ","8417,2240           ","8418,2187           ","8419,15,10,1        ","8420,2751           ",
"8421,27,26,20       ","8422,33,22,9        ","8423,168            ","8424,33,31,28       ","8425,3              ","8426,1539           ","8427,14,13,8        ","8428,129            ","8429,35,14,6        ","8430,361            ",
"8431,97             ","8432,17,15,13       ","8433,1255           ","8434,1459           ","8435,33,28,26       ","8436,401            ","8437,34,27,15       ","8438,17,10,7        ","8439,43             ","8440,18,9,6         ",
"8441,992            ","8442,1863           ","8443,16,12,6        ","8444,905            ","8445,38,6,5         ","8446,3201           ","8447,213            ","8448,21,17,6        ","8449,25             ","8450,38,36,7        ",
"8451,13,5,2         ","8452,11,8,6         ","8453,14,11,5        ","8454,21,6,4         ","8455,412            ","8456,15,13,8        ","8457,230            ","8458,19,10,6        ","8459,10,9,7         ","8460,127            ",
"8461,24,22,14       ","8462,33,32,31       ","8463,397            ","8464,34,15,5        ","8465,936            ","8466,451            ","8467,31,24,21       ","8468,15,11,3        ","8469,26,14,13       ","8470,1713           ",
"8471,827            ","8472,30,21,5        ","8473,2398           ","8474,37,6,1         ","8475,6,4,1          ","8476,85             ","8477,46,34,26       ","8478,405            ","8479,1425           ","8480,21,6,3         ",
"8481,641            ","8482,331            ","8483,26,19,10       ","8484,1421           ","8485,23,10,5        ","8486,22,21,19       ","8487,4112           ","8488,13,6,3         ","8489,3096           ","8490,26,16,13       ",
"8491,35,32,25       ","8492,497            ","8493,33,26,23       ","8494,10,7,4         ","8495,122            ","8496,25,19,3        ","8497,540            ","8498,15,14,11       ","8499,28,18,15       ","8500,753            ",
"8501,37,36,31       ","8502,3157           ","8503,91             ","8504,35,24,10       ","8505,109            ","8506,3555           ","8507,31,6,5         ","8508,1207           ","8509,19,16,15       ","8510,2709           ",
"8511,4177           ","8512,33,27,4        ","8513,3044           ","8514,19,14,8        ","8515,27,10,7        ","8516,1221           ","8517,14,8,5         ","8518,721            ","8519,36             ","8520,28,15,13       ",
"8521,2646           ","8522,3603           ","8523,21,18,5        ","8524,1575           ","8525,36,19,2        ","8526,637            ","8527,435            ","8528,15,4,2         ","8529,2296           ","8530,2019           ",
"8531,18,2,1         ","8532,787            ","8533,23,20,4        ","8534,27,7,1         ","8535,2996           ","8536,19,10,3        ","8537,242            ","8538,20,11,4        ","8539,12,9,4         ","8540,465            ",
"8541,26,9,5         ","8542,30,28,9        ","8543,969            ","8544,31,5,2         ","8545,1944           ","8546,19,11,10       ","8547,21,13,10       ","8548,519            ","8549,41,23,6        ","8550,893            ",
"8551,639            ","8552,29,10,1        ","8553,4171           ","8554,33,17,7        ","8555,14,13,7        ","8556,2011           ","8557,30,23,17       ","8558,4193           ","8559,2161           ","8560,21,13,3        ",
"8561,15,5,1         ","8562,939            ","8563,13,5,2         ","8564,801            ","8565,33,14,11       ","8566,2581           ","8567,24,16,11       ","8568,28,25,10       ","8569,1429           ","8570,37,10,3        ",
"8571,12,8,2         ","8572,1081           ","8573,22,14,4        ","8574,22,13,2        ","8575,457            ","8576,19,9,1         ","8577,439            ","8578,30,7,4         ","8579,13,11,6        ","8580,143            ",
"8581,8,7,3          ","8582,1817           ","8583,3448           ","8584,32,15,13       ","8585,137            ","8586,407            ","8587,34,8,2         ","8588,29             ","8589,15,12,10       ","8590,27,23,17       ",
"8591,431            ","8592,23,5,4         ","8593,94             ","8594,21,20,5        ","8595,17,13,10       ","8596,13,7,6         ","8597,33,27,26       ","8598,23,14,1        ","8599,2385           ","8600,21,14,3        ",
"8601,734            ","8602,1431           ","8603,16,9,1         ","8604,1381           ","8605,30,23,7        ","8606,19,17,7        ","8607,203            ","8608,47,44,33       ","8609,434            ","8610,21,17,14       ",
"8611,25,18,1        ","8612,287            ","8613,24,15,14       ","8614,1585           ","8615,3713           ","8616,22,19,11       ","8617,1150           ","8618,1947           ","8619,29,28,5        ","8620,1197           ",
"8621,22,10,2        ","8622,33,24,19       ","8623,1483           ","8624,4,3,2          ","8625,256            ","8626,103            ","8627,38,15,11       ","8628,25,24,7        ","8629,33,16,11       ","8630,20,6,3         ",
"8631,857            ","8632,41,32,3        ","8633,3234           ","8634,19,14,8        ","8635,23,14,13       ","8636,2345           ","8637,20,13,7        ","8638,3961           ","8639,441            ","8640,23,10,4        ",
"8641,81             ","8642,15,11,6        ","8643,26,18,2        ","8644,103            ","8645,17,14,12       ","8646,4293           ","8647,145            ","8648,31,17,6        ","8649,280            ","8650,783            ",
"8651,26,11,3        ","8652,833            ","8653,26,18,10       ","8654,2529           ","8655,2863           ","8656,39,14,4        ","8657,884            ","8658,3323           ","8659,14,9,4         ","8660,1157           ",
"8661,30,7,1         ","8662,31,22,18       ","8663,2306           ","8664,29,19,11       ","8665,2416           ","8666,2111           ","8667,22,21,18       ","8668,1839           ","8669,20,12,3        ","8670,1061           ",
"8671,1329           ","8672,29,23,12       ","8673,28             ","8674,3403           ","8675,18,17,10       ","8676,927            ","8677,13,11,6        ","8678,25,19,15       ","8679,1370           ","8680,32,7,2         ",
"8681,1175           ","8682,947            ","8683,19,18,11       ","8684,3815           ","8685,31,9,6         ","8686,2653           ","8687,21,18,3        ","8688,25,20,7        ","8689,855            ","8690,24,14,11       ",
"8691,40,17,5        ","8692,1095           ","8693,32,24,15       ","8694,1809           ","8695,2283           ","8696,25,20,6        ","8697,164            ","8698,2583           ","8699,26,20,3        ","8700,1295           ",
"8701,33,5,2         ","8702,24,17,15       ","8703,281            ","8704,39,20,2        ","8705,59             ","8706,25,22,6        ","8707,8,6,1          ","8708,417            ","8709,19,16,10       ","8710,26,25,18       ",
"8711,360            ","8712,30,13,3        ","8713,1785           ","8714,231            ","8715,33,32,8        ","8716,36,22,21       ","8717,37,18,16       ","8718,3465           ","8719,7              ","8720,27,17,5        ",
"8721,467            ","8722,1551           ","8723,32,12,2        ","8724,2279           ","8725,25,9,6         ","8726,21,19,8        ","8727,748            ","8728,13,7,1         ","8729,68             ","8730,959            ",
"8731,30,26,16       ","8732,525            ","8733,40,32,31       ","8734,2817           ","8735,1326           ","8736,35,33,24       ","8737,3235           ","8738,28,18,11       ","8739,28,20,2        ","8740,2835           ",
"8741,32,27,21       ","8742,1053           ","8743,90             ","8744,45,12,11       ","8745,79             ","8746,4183           ","8747,18,14,7        ","8748,63             ","8749,29,22,6        ","8750,53             ",
"8751,1922           ","8752,30,29,11       ","8753,693            ","8754,2871           ","8755,25,24,14       ","8756,1181           ","8757,35,26,12       ","8758,17,8,4         ","8759,3675           ","8760,27,9,4         ",
"8761,27,25,15       ","8762,2159           ","8763,18,17,5        ","8764,10,3,1         ","8765,14,9,3         ","8766,1677           ","8767,70             ","8768,27,10,8        ","8769,188            ","8770,603            ",
"8771,37,4,2         ","8772,37             ","8773,20,5,3         ","8774,30,29,11       ","8775,508            ","8776,26,19,9        ","8777,257            ","8778,16,5,2         ","8779,45,5,2         ","8780,495            ",
"8781,34,10,1        ","8782,33,10,4        ","8783,860            ","8784,26,25,7        ","8785,1597           ","8786,30,18,3        ","8787,49,45,22       ","8788,22,15,13       ","8789,27,7,2         ","8790,17,2,1         ",
"8791,463            ","8792,24,9,2         ","8793,272            ","8794,14,7,2         ","8795,12,5,3         ","8796,1585           ","8797,26,18,7        ","8798,1301           ","8799,656            ","8800,25,14,6        ",
"8801,309            ","8802,2139           ","8803,31,21,4        ","8804,549            ","8805,42,16,9        ","8806,1773           ","8807,3569           ","8808,15,9,6         ","8809,1089           ","8810,24,17,7        ",
"8811,22,8,2         ","8812,2295           ","8813,37,4,2         ","8814,1497           ","8815,1174           ","8816,17,8,6         ","8817,1654           ","8818,29,11,9        ","8819,15,13,4        ","8820,147            ",
"8821,28,24,23       ","8822,32,28,25       ","8823,1028           ","8824,19,14,6        ","8825,303            ","8826,4275           ","8827,30,17,10       ","8828,1133           ","8829,15,9,8         ","8830,3889           ",
"8831,891            ","8832,15,9,6         ","8833,328            ","8834,683            ","8835,20,16,5        ","8836,1171           ","8837,20,10,6        ","8838,1653           ","8839,285            ","8840,33,22,16       ",
"8841,539            ","8842,4143           ","8843,33,20,17       ","8844,355            ","8845,31,24,2        ","8846,21,20,12       ","8847,1100           ","8848,33,4,3         ","8849,2324           ","8850,1191           ",
"8851,33,14,4        ","8852,1697           ","8853,23,17,16       ","8854,12,5,1         ","8855,138            ","8856,14,5,2         ","8857,2493           ","8858,29,23,17       ","8859,35,30,27       ","8860,3577           ",
"8861,18,16,10       ","8862,49             ","8863,1099           ","8864,37,12,7        ","8865,2713           ","8866,29,16,5        ","8867,32,9,5         ","8868,623            ","8869,34,19,7        ","8870,1029           ",
"8871,2422           ","8872,51,4,2         ","8873,689            ","8874,2239           ","8875,19,18,1        ","8876,381            ","8877,21,13,10       ","8878,3949           ","8879,2369           ","8880,36,9,6         ",
"8881,990            ","8882,17,11,6        ","8883,28,27,10       ","8884,2121           ","8885,30,26,20       ","8886,469            ","8887,1107           ","8888,43,13,9        ","8889,1216           ","8890,2007           ",
"8891,10,9,4         ","8892,249            ","8893,27,7,6         ","8894,17,6,5         ","8895,958            ","8896,41,10,6        ","8897,1439           ","8898,287            ","8899,29,2,1         ","8900,2285           ",
"8901,17,12,2        ","8902,10,9,2         ","8903,222            ","8904,40,25,10       ","8905,433            ","8906,35,16,13       ","8907,22,21,16       ","8908,3031           ","8909,22,17,9        ","8910,1749           ",
"8911,963            ","8912,18,17,1        ","8913,158            ","8914,16,4,3         ","8915,11,6,5         ","8916,2259           ","8917,28,21,3        ","8918,16,10,9        ","8919,2479           ","8920,33,32,31       ",
"8921,6              ","8922,787            ","8923,11,8,6         ","8924,797            ","8925,22,11,7        ","8926,853            ","8927,1425           ","8928,35,29,2        ","8929,358            ","8930,83             ",
"8931,17,6,5         ","8932,507            ","8933,24,10,4        ","8934,1125           ","8935,861            ","8936,17,3,1         ","8937,3733           ","8938,2295           ","8939,22,21,14       ","8940,529            ",
"8941,36,35,31       ","8942,21,16,13       ","8943,3635           ","8944,39,34,1        ","8945,563            ","8946,967            ","8947,28,20,6        ","8948,2637           ","8949,29,22,13       ","8950,9,5,1          ",
"8951,506            ","8952,27,14,2        ","8953,25             ","8954,25,23,1        ","8955,18,13,1        ","8956,4231           ","8957,16,10,3        ","8958,1029           ","8959,225            ","8960,12,7,5         ",
"8961,176            ","8962,691            ","8963,30,26,10       ","8964,939            ","8965,30,7,5         ","8966,1233           ","8967,2744           ","8968,29,11,10       ","8969,435            ","8970,2191           ",
"8971,23,5,4         ","8972,1619           ","8973,24,19,12       ","8974,981            ","8975,1128           ","8976,23,8,2         ","8977,966            ","8978,18,17,5        ","8979,29,22,16       ","8980,3093           ",
"8981,22,2,1         ","8982,169            ","8983,345            ","8984,9,8,6          ","8985,2674           ","8986,495            ","8987,16,12,10       ","8988,1513           ","8989,15,7,2         ","8990,333            ",
"8991,2020           ","8992,35,6,2         ","8993,2079           ","8994,1051           ","8995,19,16,13       ","8996,25,16,12       ","8997,33,22,1        ","8998,23,10,2        ","8999,1386           ","9000,28,19,17       ",
"9001,1599           ","9002,3995           ","9003,37,20,10       ","9004,649            ","9005,19,14,4        ","9006,1477           ","9007,222            ","9008,31,17,7        ","9009,29             ","9010,17,12,1        ",
"9011,31,14,10       ","9012,1053           ","9013,32,9,7         ","9014,1217           ","9015,12,3,1         ","9016,23,21,8        ","9017,155            ","9018,1327           ","9019,26,22,15       ","9020,287            ",
"9021,28,22,10       ","9022,861            ","9023,4350           ","9024,32,29,11       ","9025,744            ","9026,35             ","9027,23,14,3        ","9028,2935           ","9029,36,26,1        ","9030,32,8,1         ",
"9031,714            ","9032,45,19,1        ","9033,1615           ","9034,2095           ","9035,30,22,5        ","9036,449            ","9037,28,14,5        ","9038,21,9,8         ","9039,1741           ","9040,9,6,4          ",
"9041,813            ","9042,103            ","9043,27,26,23       ","9044,2819           ","9045,33,8,6         ","9046,36,30,15       ","9047,287            ","9048,23,16,10       ","9049,2490           ","9050,1319           ",
"9051,17,10,7        ","9052,2725           ","9053,21,15,12       ","9054,609            ","9055,946            ","9056,11,3,2         ","9057,2345           ","9058,235            ","9059,24,15,6        ","9060,151            ",
"9061,26,18,7        ","9062,3929           ","9063,2320           ","9064,33,4,2         ","9065,2022           ","9066,15,6,1         ","9067,9,2,1          ","9068,2565           ","9069,36,31,12       ","9070,23,13,3        ",
"9071,2276           ","9072,45,38,6        ","9073,20,16,5        ","9074,207            ","9075,30,17,15       ","9076,2395           ","9077,16,6,4         ","9078,2681           ","9079,2179           ","9080,17,10,7        ",
"9081,190            ","9082,19,17,14       ","9083,31,18,5        ","9084,1699           ","9085,26,13,5        ","9086,2445           ","9087,23,19,7        ","9088,33,31,1        ","9089,440            ","9090,18,7,3         ",
"9091,20,9,7         ","9092,29             ","9093,11,8,4         ","9094,2769           ","9095,2546           ","9096,27,26,11       ","9097,1260           ","9098,25,15,14       ","9099,16,9,1         ","9100,55             ",
"9101,14,8,6         ","9102,15,14,2        ","9103,4200           ","9104,47,33,24       ","9105,1493           ","9106,1723           ","9107,28,13,6        ","9108,575            ","9109,9,5,2          ","9110,32,17,8        ",
"9111,487            ","9112,9,7,5          ","9113,3563           ","9114,539            ","9115,30,9,7         ","9116,1841           ","9117,18,16,7        ","9118,21,11,10       ","9119,917            ","9120,35,25,5        ",
"9121,249            ","9122,47,29,23       ","9123,15,13,10       ","9124,23,17,12       ","9125,26,12,10       ","9126,181            ","9127,1120           ","9128,39,25,22       ","9129,23             ","9130,2991           ",
"9131,7,5,4          ","9132,207            ","9133,26,9,4         ","9134,1545           ","9135,944            ","9136,21,14,1        ","9137,2163           ","9138,2671           ","9139,10,3,1         ","9140,1365           ",
"9141,36,7,1         ","9142,4545           ","9143,1268           ","9144,35,25,4        ","9145,546            ","9146,12,2,1         ","9147,31,16,2        ","9148,1921           ","9149,30,28,7        ","9150,469            ",
"9151,1330           ","9152,33,29,7        ","9153,682            ","9154,3087           ","9155,25,11,6        ","9156,281            ","9157,30,10,7        ","9158,809            ","9159,3470           ","9160,22,15,3        ",
"9161,1046           ","9162,2807           ","9163,20,7,6         ","9164,1913           ","9165,13,12,3        ","9166,19,10,3        ","9167,12,3,2         ","9168,15,10,4        ","9169,229            ","9170,1103           ",
"9171,38,5,4         ","9172,33,26,8        ","9173,31,17,12       ","9174,29,23,8        ","9175,2806           ","9176,43,37,30       ","9177,884            ","9178,19,17,8        ","9179,10,6,5         ","9180,1153           ",
"9181,23,13,6        ","9182,1769           ","9183,30,13,1        ","9184,33,26,14       ","9185,207            ","9186,3159           ","9187,20,18,4        ","9188,4305           ","9189,26,14,8        ","9190,2217           ",
"9191,3936           ","9192,21,18,13       ","9193,1216           ","9194,16,10,5        ","9195,14,13,1        ","9196,31,12,5        ","9197,14,12,5        ","9198,1365           ","9199,109            ","9200,31,24,2        ",
"9201,146            ","9202,211            ","9203,28,20,6        ","9204,645            ","9205,14,11,3        ","9206,4085           ","9207,397            ","9208,35,10,9        ","9209,2181           ","9210,2603           ",
"9211,36,19,17       ","9212,3839           ","9213,38,7,5         ","9214,397            ","9215,1217           ","9216,21,14,8        ","9217,1956           ","9218,2919           ","9219,30,6,4         ","9220,1875           ",
"9221,33,26,5        ","9222,33,23,11       ","9223,1023           ","9224,35,21,7        ","9225,181            ","9226,4315           ","9227,38,29,3        ","9228,145            ","9229,20,19,17       ","9230,17,12,8        ",
"9231,3899           ","9232,49,18,8        ","9233,545            ","9234,315            ","9235,23,22,2        ","9236,22,14,9        ","9237,18,16,12       ","9238,49             ","9239,1629           ","9240,17,11,7        ",
"9241,909            ","9242,239            ","9243,5,2,1          ","9244,441            ","9245,43,35,18       ","9246,27,18,3        ","9247,48             ","9248,37,18,13       ","9249,1663           ","9250,531            ",
"9251,8,3,2          ","9252,327            ","9253,42,28,10       ","9254,24,17,13       ","9255,298            ","9256,19,6,4         ","9257,1364           ","9258,3843           ","9259,22,16,6        ","9260,2729           ",
"9261,30,18,10       ","9262,1549           ","9263,3173           ","9264,39,17,14       ","9265,1123           ","9266,23,14,6        ","9267,23,8,5         ","9268,3183           ","9269,42,18,14       ","9270,837            ",
"9271,1488           ","9272,13,4,3         ","9273,502            ","9274,1219           ","9275,10,6,2         ","9276,135            ","9277,11,3,2         ","9278,2145           ","9279,1526           ","9280,23,7,2         ",
"9281,2049           ","9282,2307           ","9283,20,7,6         ","9284,1883           ","9285,29,6,5         ","9286,25,20,14       ","9287,2520           ","9288,49,43,18       ","9289,358            ","9290,1731           ",
"9291,8,5,1          ","9292,3087           ","9293,20,18,3        ","9294,3373           ","9295,2149           ","9296,29,17,15       ","9297,1838           ","9298,2139           ","9299,22,21,1        ","9300,135            ",
"9301,35,25,18       ","9302,605            ","9303,208            ","9304,27,13,9        ","9305,3344           ","9306,675            ","9307,31,25,4        ","9308,1559           ","9309,19,16,10       ","9310,3141           ",
"9311,2657           ","9312,21,19,16       ","9313,924            ","9314,27,23,12       ","9315,26,21,8        ","9316,1233           ","9317,23,20,2        ","9318,18,6,3         ","9319,477            ","9320,55,22,8        ",
"9321,2627           ","9322,4027           ","9323,18,4,1         ","9324,665            ","9325,18,16,1        ","9326,35,23,20       ","9327,4165           ","9328,21,14,8        ","9329,2910           ","9330,4263           ",
"9331,31,30,2        ","9332,2081           ","9333,26,14,8        ","9334,3141           ","9335,1176           ","9336,17,5,3         ","9337,546            ","9338,23,8,5         ","9339,23,14,1        ","9340,1339           ",
"9341,19,18,14       ","9342,19,10,8        ","9343,2700           ","9344,51,44,5        ","9345,353            ","9346,18,10,3        ","9347,16,14,7        ","9348,19,9,3         ","9349,25,18,2        ","9350,1221           ",
"9351,56             ","9352,31,26,15       ","9353,3221           ","9354,16,7,4         ","9355,22,16,4        ","9356,1773           ","9357,35,34,2        ","9358,453            ","9359,1227           ","9360,28,23,1        ",
"9361,369            ","9362,23,13,1        ","9363,26,21,17       ","9364,3297           ","9365,21,20,7        ","9366,2245           ","9367,3172           ","9368,38,7,1         ","9369,116            ","9370,2311           ",
"9371,28,21,17       ","9372,269            ","9373,28,10,4        ","9374,18,9,2         ","9375,4459           ","9376,23,5,1         ","9377,914            ","9378,1347           ","9379,14,9,5         ","9380,561            ",
"9381,19,9,6         ","9382,3297           ","9383,1124           ","9384,17,11,6        ","9385,523            ","9386,3863           ","9387,31,30,9        ","9388,24,7,3         ","9389,20,7,3         ","9390,2601           ",
"9391,1239           ","9392,29,24,11       ","9393,623            ","9394,3471           ","9395,17,15,4        ","9396,369            ","9397,32,14,7        ","9398,2769           ","9399,1295           ","9400,18,13,1        ",
"9401,429            ","9402,267            ","9403,30,8,1         ","9404,2009           ","9405,18,4,1         ","9406,28,27,7        ","9407,260            ","9408,28,15,6        ","9409,405            ","9410,32,11,8        ",
"9411,24,22,1        ","9412,11,9,2         ","9413,11,10,9        ","9414,673            ","9415,1678           ","9416,19,11,6        ","9417,218            ","9418,823            ","9419,30,19,13       ","9420,2701           ",
"9421,14,9,5         ","9422,22,10,9        ","9423,1280           ","9424,22,9,6         ","9425,699            ","9426,21,6,5         ","9427,23,18,8        ","9428,21,17,7        ","9429,21,9,2         ","9430,37,18,5        ",
"9431,3113           ","9432,52,43,25       ","9433,42             ","9434,19,14,12       ","9435,7,5,4          ","9436,225            ","9437,14,12,1        ","9438,15,13,6        ","9439,105            ","9440,25,22,14       ",
"9441,479            ","9442,4611           ","9443,30,19,2        ","9444,3513           ","9445,34,14,12       ","9446,12,5,3         ","9447,458            ","9448,23,21,20       ","9449,584            ","9450,1431           ",
"9451,13,12,3        ","9452,18,14,13       ","9453,32,29,23       ","9454,4189           ","9455,2807           ","9456,35,19,5        ","9457,4              ","9458,25,16,6        ","9459,36,18,13       ","9460,20,17,1        ",
"9461,32,28,6        ","9462,34,14,5        ","9463,327            ","9464,37,18,13       ","9465,197            ","9466,23,14,1        ","9467,27,14,7        ","9468,1695           ","9469,28,22,18       ","9470,2289           ",
"9471,1459           ","9472,45,40,15       ","9473,656            ","9474,23,20,7        ","9475,29,25,2        ","9476,2583           ","9477,26,11,7        ","9478,909            ","9479,200            ","9480,18,9,2         ",
"9481,4060           ","9482,19,12,4        ","9483,20,10,5        ","9484,853            ","9485,23,22,9        ","9486,945            ","9487,211            ","9488,25,12,7        ","9489,2089           ","9490,999            ",
"9491,19,6,5         ","9492,373            ","9493,38,22,3        ","9494,477            ","9495,23,20,18       ","9496,29,17,15       ","9497,2301           ","9498,41,17,10       ","9499,29,20,10       ","9500,1175           ",
"9501,29,26,4        ","9502,621            ","9503,99             ","9504,19,15,6        ","9505,15,10,1        ","9506,12,7,5         ","9507,29,28,14       ","9508,1141           ","9509,13,9,2         ","9510,2349           ",
"9511,399            ","9512,39,17,16       ","9513,686            ","9514,28,21,9        ","9515,18,9,2         ","9516,903            ","9517,32,18,11       ","9518,1797           ","9519,1573           ","9520,13,5,2         ",
"9521,116            ","9522,243            ","9523,8,4,2          ","9524,3207           ","9525,30,27,2        ","9526,16,10,1        ","9527,1650           ","9528,37,33,22       ","9529,43             ","9530,1623           ",
"9531,32,14,2        ","9532,2103           ","9533,36,31,5        ","9534,1193           ","9535,1119           ","9536,31,26,6        ","9537,565            ","9538,24,9,3         ","9539,38,27,13       ","9540,3059           ",
"9541,31,21,14       ","9542,1185           ","9543,533            ","9544,43,32,9        ","9545,539            ","9546,47             ","9547,12,8,2         ","9548,335            ","9549,37,34,32       ","9550,19,15,11       ",
"9551,126            ","9552,11,4,1         ","9553,1498           ","9554,29,28,15       ","9555,24,22,10       ","9556,21,9,1         ","9557,27,20,1        ","9558,2041           ","9559,702            ","9560,27,13,2        ",
"9561,3059           ","9562,687            ","9563,25,9,2         ","9564,387            ","9565,6,5,4          ","9566,1901           ","9567,1883           ","9568,49,26,14       ","9569,60             ","9570,487            ",
"9571,24,16,5        ","9572,31,19,9        ","9573,8,6,5          ","9574,38,37,8        ","9575,888            ","9576,29,25,7        ","9577,1668           ","9578,1503           ","9579,34,33,6        ","9580,1771           ",
"9581,12,7,4         ","9582,3177           ","9583,790            ","9584,36,29,27       ","9585,2524           ","9586,1867           ","9587,36,29,22       ","9588,525            ","9589,28,22,15       ","9590,2061           ",
"9591,841            ","9592,15,8,1         ","9593,284            ","9594,499            ","9595,28,18,15       ","9596,18,11,5        ","9597,28,25,22       ","9598,4309           ","9599,14             ","9600,19,6,4         ",
"9601,963            ","9602,21,5,2         ","9603,19,10,4        ","9604,13,11,9        ","9605,37,26,12       ","9606,15,12,1        ","9607,262            ","9608,14,13,1        ","9609,1526           ","9610,2883           ",
"9611,14,6,5         ","9612,93             ","9613,32,16,3        ","9614,4577           ","9615,361            ","9616,25,8,2         ","9617,1385           ","9618,16,3,1         ","9619,29,14,10       ","9620,557            ",
"9621,29,20,11       ","9622,2145           ","9623,2429           ","9624,31,17,7        ","9625,508            ","9626,7,6,1          ","9627,25,19,18       ","9628,31             ","9629,16,15,10       ","9630,37             ",
"9631,295            ","9632,30,23,5        ","9633,2333           ","9634,3075           ","9635,26,21,10       ","9636,515            ","9637,21,18,6        ","9638,21,19,13       ","9639,700            ","9640,33,7,3         ",
"9641,3287           ","9642,3591           ","9643,18,14,11       ","9644,1671           ","9645,9,7,6          ","9646,31,30,17       ","9647,1227           ","9648,31,24,21       ","9649,657            ","9650,32,18,11       ",
"9651,22,14,4        ","9652,2733           ","9653,22,15,2        ","9654,1969           ","9655,3558           ","9656,19,16,2        ","9657,1192           ","9658,3691           ","9659,15,14,8        ","9660,57             ",
"9661,22,14,6        ","9662,22,9,8         ","9663,446            ","9664,35,21,1        ","9665,2763           ","9666,435            ","9667,34,22,6        ","9668,225            ","9669,29,27,24       ","9670,35,34,3        ",
"9671,1086           ","9672,17,9,3         ","9673,3538           ","9674,759            ","9675,44,25,23       ","9676,3367           ","9677,30,27,12       ","9678,4277           ","9679,864            ","9680,25,6,2         ",
"9681,910            ","9682,3175           ","9683,46,37,21       ","9684,2405           ","9685,17,14,4        ","9686,2333           ","9687,2054           ","9688,20,9,2         ","9689,84             ","9690,1503           ",
"9691,17,14,1        ","9692,3381           ","9693,10,6,3         ","9694,50,18,17       ","9695,207            ","9696,36,27,21       ","9697,1201           ","9698,38,27,24       ","9699,30,6,1         ","9700,565            ",
"9701,23,12,3        ","9702,1533           ","9703,13,7,1         ","9704,7,3,2          ","9705,1802           ","9706,22,15,11       ","9707,26,15,1        ","9708,1753           ","9709,16,13,10       ","9710,30,15,9        ",
"9711,917            ","9712,27,19,17       ","9713,2933           ","9714,1227           ","9715,27,10,6        ","9716,263            ","9717,9,6,2          ","9718,46,29,11       ","9719,3492           ","9720,37,4,2         ",
"9721,171            ","9722,12,11,8        ","9723,32,29,25       ","9724,30,28,15       ","9725,14,8,5         ","9726,29,28,23       ","9727,760            ","9728,30,5,2         ","9729,938            ","9730,663            ",
"9731,16,12,10       ","9732,3747           ","9733,22,21,8        ","9734,4125           ","9735,2086           ","9736,15,7,6         ","9737,275            ","9738,3663           ","9739,15,14,2        ","9740,3015           ",
"9741,11,8,1         ","9742,30,18,15       ","9743,869            ","9744,36,9,2         ","9745,2361           ","9746,2559           ","9747,26,8,1         ","9748,889            ","9749,20,7,6         ","9750,833            ",
"9751,1093           ","9752,42,17,3        ","9753,1078           ","9754,3891           ","9755,6,5,1          ","9756,1701           ","9757,22,14,6        ","9758,1557           ","9759,706            ","9760,56,49,47       ",
"9761,2588           ","9762,4455           ","9763,30,18,1        ","9764,25,13,9        ","9765,28,17,11       ","9766,585            ","9767,1668           ","9768,41,23,22       ","9769,1390           ","9770,1091           ",
"9771,29,8,1         ","9772,741            ","9773,32,10,6        ","9774,401            ","9775,537            ","9776,24,19,1        ","9777,773            ","9778,24,18,15       ","9779,40,21,20       ","9780,711            ",
"9781,40,28,15       ","9782,161            ","9783,88             ","9784,38,37,9        ","9785,2036           ","9786,4147           ","9787,20,13,9        ","9788,2007           ","9789,17,8,2         ","9790,177            ",
"9791,390            ","9792,27,26,21       ","9793,339            ","9794,24,15,6        ","9795,26,5,4         ","9796,321            ","9797,35,32,2        ","9798,2677           ","9799,139            ","9800,42,41,10       ",
"9801,284            ","9802,12,10,3        ","9803,18,10,2        ","9804,1165           ","9805,22,21,18       ","9806,30,9,8         ","9807,337            ","9808,43,32,21       ","9809,19,15,10       ","9810,711            ",
"9811,41,28,27       ","9812,31,30,22       ","9813,26,17,12       ","9814,1545           ","9815,27,26,8        ","9816,46,33,22       ","9817,4420           ","9818,30,19,10       ","9819,18,4,3         ","9820,105            ",
"9821,34,23,18       ","9822,305            ","9823,144            ","9824,13,10,3        ","9825,2563           ","9826,22,10,7        ","9827,13,12,5        ","9828,207            ","9829,4,3,1          ","9830,1541           ",
"9831,1159           ","9832,39,37,25       ","9833,104            ","9834,32,25,7        ","9835,32,29,1        ","9836,18,13,10       ","9837,35,16,2        ","9838,25,19,12       ","9839,389            ","9840,49,47,13       ",
"9841,1788           ","9842,35,28,24       ","9843,18,12,2        ","9844,565            ","9845,38,18,11       ","9846,2349           ","9847,3537           ","9848,25,23,10       ","9849,329            ","9850,19,16,4        ",
"9851,11,6,5         ","9852,3379           ","9853,18,11,10       ","9854,317            ","9855,803            ","9856,36,15,1        ","9857,4386           ","9858,4235           ","9859,34,28,1        ","9860,2997           ",
"9861,33,18,16       ","9862,13,10,3        ","9863,1809           ","9864,35,32,21       ","9865,2604           ","9866,34,27,14       ","9867,26,8,2         ","9868,339            ","9869,23,8,6         ","9870,2681           ",
"9871,903            ","9872,13,11,3        ","9873,3842           ","9874,4279           ","9875,19,18,2        ","9876,183            ","9877,19,16,15       ","9878,573            ","9879,1181           ","9880,35,28,5        ",
"9881,27,7,5         ","9882,747            ","9883,35,34,11       ","9884,389            ","9885,38,15,3        ","9886,3673           ","9887,710            ","9888,33,6,4         ","9889,2019           ","9890,2583           ",
"9891,46,38,7        ","9892,31,4,1         ","9893,32,28,18       ","9894,27,7,1         ","9895,787            ","9896,39,38,26       ","9897,430            ","9898,23,13,5        ","9899,34,21,13       ","9900,11             ",
"9901,10,4,3         ","9902,27,19,10       ","9903,40             ","9904,21,10,2        ","9905,219            ","9906,2027           ","9907,10,7,1         ","9908,2699           ","9909,11,10,7        ","9910,27,16,15       ",
"9911,483            ","9912,42,35,15       ","9913,1899           ","9914,95             ","9915,29,17,8        ","9916,4483           ","9917,32,9,6         ","9918,381            ","9919,1185           ","9920,49,18,14       ",
"9921,901            ","9922,2691           ","9923,37,33,26       ","9924,30,29,26       ","9925,12,9,7         ","9926,1445           ","9927,1987           ","9928,39,38,31       ","9929,1382           ","9930,331            ",
"9931,34,10,3        ","9932,2397           ","9933,23,6,2         ","9934,34,7,3         ","9935,2216           ","9936,22,21,1        ","9937,451            ","9938,25,19,9        ","9939,32,26,17       ","9940,2059           ",
"9941,29,12,10       ","9942,133            ","9943,3069           ","9944,15,14,6        ","9945,1882           ","9946,2355           ","9947,23,17,8        ","9948,1535           ","9949,32,24,10       ","9950,2453           ",
"9951,1334           ","9952,31,30,11       ","9953,539            ","9954,343            ","9955,9,8,5          ","9956,851            ","9957,25,11,4        ","9958,17,14,4        ","9959,381            ","9960,30,15,10       ",
"9961,2707           ","9962,20,14,3        ","9963,34,29,20       ","9964,2691           ","9965,34,24,23       ","9966,1701           ","9967,4399           ","9968,36,3,2         ","9969,295            ","9970,2587           ",
"9971,11,8,5         ","9972,519            ","9973,27,24,12       ","9974,2045           ","9975,124            ","9976,21,19,5        ","9977,2954           ","9978,1483           ","9979,26,10,2        ","9980,707            ",
"9981,30,27,22       ","9982,993            ","9983,785            ","9984,27,10,7        ","9985,1974           ","9986,1143           ","9987,14,11,10       ","9988,3129           ","9989,21,20,6        ","9990,573            ",
"9991,495            ","9992,7,4,2          ","9993,121            ","9994,29,22,3        ","9995,41,40,31       ","9996,1447           ","9997,26,10,6        ","9998,4013           ","9999,2951           ","10000,19,13,9       "
);

end extension_pack_constants;

package body extension_pack_constants is
end extension_pack_constants;

------------------------------------------------------------------------------
-- 
--  author : Michael Bills (mb3072@xxxxxxxxxxx)
--
--  description : This package has functions and procedures
--                for testbenching and assisting in RTL design
--                creation.  It consists mostly of conversion functions.  
--                This is a two-part package.  The package testbench is
--                included at the bottom begining around line 4000.
--
--                
--
--          
--  Copyright (c) 2005 by Michael Bills
--
--  Permission to use, copy, modify, distribute, and sell this source code
--  for any purpose is hereby granted without fee, provided that 
--  the above copyright notices and this permission notice appear
--  in all copies of this source code. 
-- 
--  THIS SOURCE CODE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, 
--  EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, 
--  ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.  
--
--  THE USER OF THIS SOURCE CODE ASSUMES ALL LIABILITY FOR THEIR USE
--  OF THIS SOURCE CODE. 
--
--  IN NO EVENT SHALL MICHAEL BILLS BE LIABLE FOR ANY SPECIAL, INCIDENTAL, 
--  INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
--  RESULTING FROM LOSS OF USE, DATA, OR PROFITS, WHETHER OR NOT ADVISED OF
--  THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING 
--  OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOURCE CODE. 
--
------------------------------------------------------------------------------


-- LIBRARY STATEMENT
library extension_lib, ieee;
    
-- PACKAGE STATEMENT
use extension_lib.extension_pack_constants.all;
use ieee.std_logic_1164.all;
use ieee.std_logic_arith.all;
use ieee.std_logic_signed."abs";
use ieee.std_logic_unsigned.all;
use ieee.std_logic_textio.all;
use std.textio.all;


------------------------------------------------------------------------------
package extension_pack is
------------------------------------------------------------------------------


------------------------------------------------------------------------------
-- Type Declarations
------------------------------------------------------------------------------
type hexchar is ('0', '1', '2', '3', '4', '5', '6', '7',
                 '8', '9', 'A', 'B', 'C', 'D', 'E', 'F');

type hex is array (positive range <>) of hexchar;
                 
type LED_Char is (' ', '"', ''', '-', '.', '/', '0', '1',
                  '2', '3', '4', '5', '6', '7', '8', '9',
                  '=', '?', 'A', 'B', 'C', 'D', 'E', 'F',
                  'G', 'H', 'I', 'J', 'K', 'L', 'O', 'P',
                  'S', 'T', 'U', 'Y', 'Z', '\', ']', '^',
                  '_', 'b', 'c', 'd', 'h', 'g', 'j', 'l',
                  'n', 'o', 'r', 'u', '¬', '­', '¯', '°',
                  '·');
                 
type SevenSegLED is array (positive range <>) of LED_Char;
		 		  

type frequency is range -1 to 2_147_483_647
   units 
      Hz;
      daHz = 10 Hz;     -- dekahertz  10E+1
      hHz  = 10 daHz;   -- hectohertz 10E+2
      kHz  = 10 hHz;    -- kilohertz  10E+3
      MHz  = 1000 kHz;  -- megahertz  10E+6
      GHz  = 1000 MHz;  -- gigahertz  10E+9
   end units;
   
   
------------------------------------------------------------------------------
-- Subtype Declarations
------------------------------------------------------------------------------
--subtype bv       is bit_vector;
--subtype char     is character;
---- synopsys translate_off
--subtype fok      is file_open_kind;
--subtype fos      is file_open_status;
--subtype freq     is frequency;
---- synopsys translate_on
--subtype int      is integer;
--subtype nat      is natural;
--subtype pos      is positive;
--subtype sl       is std_logic;
--subtype slv      is std_logic_vector;
--subtype str      is string;
--subtype sul      is std_ulogic;
--subtype sulv     is std_ulogic_vector;
--subtype uns      is unsigned;


------------------------------------------------------------------------------
-- Constant Declarations
------------------------------------------------------------------------------

-- count_for_time base size (-60 means the timebase = 10E-60 seconds)
-- this value should be increased if round off error occurs
-- in a value computed by the function "count_for_time" or if 
-- array length errors similar to this occur:
-- # ** Fatal: (vsim-3420) Array lengths do not match. Left is (96 downto 0). Right is (97 downto 0).
--
-- This value must be smaller than MAX_VECT_SIZE by a factor of 4 for
-- logic vectors 2 bits long and it must be smaller by a factor of 3.5 for
-- logic vectors longer than 2 bits

--constant CFT_BASE_SIZE : integer := -30;  -- moved to extension_constants_pack


-- this value represents the largest size a logic vector may be for certain
-- functions and procedures in this package. It is used to set upper loop
-- limits for non-deterministic values thus avoiding the use of access
-- types and enabling the functions to be used for synthesizeable code.
--
-- This value may be increased (as high as natural'high will allow) 
-- if a larger value needs to be represented, or it may be decreased
-- if compile time is excessive by modifying the CFT_BASE_SIZE constant

--constant MAX_VECT_SIZE : natural := (-CFT_BASE_SIZE)*4; -- moved to extension_constants_pack


------------------------------------------------------------------------------
-- Function Declarations
------------------------------------------------------------------------------

function "*"(MultiplicandVal : integer; 
             MultiplierVal   : std_logic_vector) return std_logic_vector; 

function "*"(MultiplicandVal : std_logic_vector; 
             MultiplierVal   : integer) return std_logic_vector; 

function "/"(DividendVal : std_logic_vector; 
             DivisorVal  : std_logic_vector) return std_logic_vector;             

function "/"(DividendVal : std_logic_vector; 
             DivisorVal  : integer) return std_logic_vector; 
             
function "/"(DividendVal : string; 
             DivisorVal  : integer) return std_logic_vector; 
             
function bcd_to_led(slvVal : std_logic_vector ; 
                    CAVal  : boolean) return std_logic_vector;                  -- binary coded decimal to seven segment LED conversion
                    
function bcd_to_slv(vectorVal : std_logic_vector) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using enough BCD digits to represent the largest value possible in the range of the vector passed

function bcd_to_slv_pipe(BCD_RVal      : std_logic_vector;
                         BCD_DigitsVal : integer) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using the number of BCD digits specified. For pipelined operation. function must be called N times where N is the number of bits in the passed value

function bv_to_slv(bitVectVal : bit_vector) return std_logic_vector;            -- repackaging of "To_StdLogicVector" function

function cdft(timeStrVal : string;
              freqStrVal : string) return std_logic_vector;                     -- count for the time specified (minus a count of 2 for latency) using the frequency (or period) value passed as a reference
             
function cdft(timeStrVal : string;
              freqStrVal : string;
              natVal     : natural) return std_logic_vector;                    -- count for the time specified (minus a count of 2 for latency) using the frequency (or period) value passed as a reference and the natural value passed as a length for the vector (if it will fit in a vector that size)

function cdfth(timeStrVal : string;
               freqStrVal : string) return integer;                             -- returns the high value to be used in the range declaration of a vector used to represent the time specified (minus a count of 2) using the frequency (or period) value passed as a reference

function ceil(RealVal : in real ) return real;                                  -- rounds a real value up the the next highest real integer

function cfi(intVal : integer) return natural;                                  -- This function returns a natural representing the number of characters required to reprsent an integer value. It is essentially an integer'length function for the characters.

function cft(timeStrVal : string;
             freqStrVal : string) return std_logic_vector;                      -- count for the time specified using the frequency (or period) value passed as a reference

function cft(timeStrVal : string;
             freqStrVal : string;
             natVal     : natural) return std_logic_vector;                     -- count for the time specified using the frequency (or period) value passed as a reference and the integer value passed as a length for the vector (if it will fit in a vector that size)
             
function cfth(timeStrVal : string;
              freqStrVal : string) return integer;                              -- returns the high value to be used in the range declaration of a vector used to represent the time specified using the frequency (or period) value passed as a reference


function clkcnt(freq1StrVal : string;
                freq2StrVal : string) return std_logic_vector;                  -- create a 50% duty cycle count time  using the frequency (or period) value passed as a reference
 
function conv_to_hex(vectorVal : bit_vector) return string;                     -- bit_vector to hexadecimal conversion

function conv_to_hex(vectorVal : std_logic_vector) return string;               -- std_logic_vector to hexadecimal conversion

function conv_to_hex(vectorVal : std_ulogic_vector) return string;              -- std_ulogic_vector to hexadecimal conversion

function crc16(serialInVal : std_logic;
               vectorVal   : std_logic_vector) return std_logic_vector;         -- returns the input to a Cyclic Redundancy Check (CRC) using the polynomial x^16 + x^15 + x^2 + 1.

function cslv(int1Val : integer; 
              int2Val : integer) return std_logic_vector;                       -- repackaging of "conv_std_logic_vector"
function cslv(sigVal : signed;   
              intVal : integer) return std_logic_vector;                        -- repackaging of "conv_std_logic_vector"
function cslv(usgVal : unsigned; 
              intVal : integer) return std_logic_vector;                        -- repackaging of "conv_std_logic_vector"

function cuft(timeStrVal : string;
              freqStrVal : string) return std_logic_vector;                     -- count for the time specified (minus a count of 1 for latency) using the frequency (or period) value passed as a reference

function cuft(timeStrVal : string;
              freqStrVal : string;
              natVal     : natural) return std_logic_vector;                    -- count for the time specified (minus a count of 1 for latency) using the frequency (or period) value passed as a reference and the integer value passed as a length for the vector (if it will fit in a vector that size)
             
function cufth(timeStrVal : string;
               freqStrVal : string) return integer;                             -- returns the high value to be used in the range declaration of a vector used to represent the time specified using the frequency (or period) value passed as a reference

function dpfi(intVal : integer) return natural;                                 -- returns the number of decimal places for an integer value

function dpfi_syn(intVal : integer) return natural;                             -- returns the number of decimal places for an integer value

function dpfr(realVal : real) return natural;                                   -- returns the number of decimal places to the left of the decimal point for a real value

function dpfslvr(vectorVal : std_logic_vector) return natural;                  -- returns the number of decimal places needed to represent the full range of the std_logic_vector passed

function dpfslvv(vectorVal : std_logic_vector) return natural;                  -- returns the number of decimal places needed to represent the value of the std_logic_vector passed

function eq(vector1Val : std_logic_vector;
            vector2Val : std_logic_vector) return boolean;                      -- equality check function that is sensitive to vector length

function ext2(vectorVal : std_logic_vector;
              natVal    : natural) return std_logic_vector;                     -- returns a standard logic vector, padded with zeros, to the length specified by intVal unless the vector is already longer than that

function flip(vectorVal : bit_vector) return bit_vector;                        -- returns a bit_vector with all the bits in the reverse order

function flip(vectorVal : std_logic_vector) return std_logic_vector;            -- returns a std_logic_vector with all the bits in the reverse order

function flip(vectorVal : std_ulogic_vector) return std_ulogic_vector;          -- returns a std_ulogic_vector with all the bits in the reverse order

function hex_to_slv(stringVal : string) return std_logic_vector;                -- converts a Hexadeximal string to a standard logic vector

function int_to_slv(intVal : integer) return std_logic_vector;                  -- returns a std_logic_vector value just large enough to represent the integer value passed

function itoa(intVal : integer) return string;                                  -- common integer to string conversion function

function lfsr(vectorVal : std_logic_vector) return std_logic_vector;            -- returns the input to a Linear Feedback Shift Register (LFSR) using a primitive polynomial.  This function defaults to Type 2 XOR feedback.

function lfsr(vectorVal        : std_logic_vector;
              feedBackTypeVal  : string;
              xorTypeVal       : string) return std_logic_vector;               -- returns the input to a Linear Feedback Shift Register (LFSR) using a primitive polynomial

function lfsr(vectorVal        : std_logic_vector;
              polynomialStrVal : string;
              feedBackTypeVal  : string;
              xorTypeVal       : string) return std_logic_vector;               -- returns the input to a Linear Feedback Shift Register (LFSR) using the polynomial 

function lfsr_cft(timeStrVal : string;
                  freqStrVal : string) return std_logic_vector;                 -- returns the value that the LFSR will contain after the amount of time specified using the frequency (or period) value passed as a reference

function lfsr_cft(timeStrVal      : string;
                  freqStrVal      : string;
                  seedVal         : std_logic_vector;
                  feedBackTypeVal : string;
                  xorTypeVal      : string) return std_logic_vector;            -- returns the value that the LFSR will contain after the amount of time specified using the frequency (or period) value passed as a reference and the seed value passed as a starting point

function lfsr_cft_latency(timeStrVal : string;
                          freqStrVal : string) return integer;                  -- returns the latency value

function max(int1Val : integer;
             int2Val : integer) return integer;                                 -- returns the maximum of the two values passed

function mult_s(Multiplier    : std_logic_vector; 
                Multiplicand  : std_logic_vector) return std_logic_vector;      -- signed multiply
function mult_us(Multiplier    : std_logic_vector; 
                 Multiplicand  : std_logic_vector) return std_logic_vector;     -- unsigned multiply

function nat_to_slv(natVal : natural) return std_logic_vector;                  -- returns a std_logic_vector value just large enough to represent the natural value passed

function neg(VectorVal : std_logic_vector) return std_logic_vector;             -- returns the negated value

-- synopsys translate_off
impure function now return string;                                              -- returns a string representation of the current simulation time
-- synopsys translate_on

function reduce(vectorVal : std_logic_vector) return std_logic_vector;          -- returns a std_logic_vector value just large enough to represent the standard logic vector value passed (including a sign bit)

function reduce_high(vectorVal : std_logic_vector) return integer;              -- returns an integer value that represents the vector'high value of a vector just large enough to represent the standard logic vector value passed (including a sign bit)

function reduce_high_unsigned(vectorVal : std_logic_vector) return integer;     -- returns an integer value that represents the vector'high value of a vector just large enough to represent the standard logic vector value passed

function reduce_length(vectorVal : std_logic_vector) return integer;            -- returns an integer value that represents the vector'length value of a vector just large enough to represent the standard logic vector value passed (including a sign bit)

function reduce_length_unsigned(vectorVal : std_logic_vector) return integer;   -- returns an integer value that represents the vector'length value of a vector just large enough to represent the standard logic vector value passed

function reduce_unsigned(vectorVal : std_logic_vector) return std_logic_vector; -- returns a std_logic_vector value just large enough to represent the standard logic vector value passed

function seq(str1Val : string; 
             str2Val : string) return boolean; 

function shl(vectorVal : std_logic_vector;
             natVal    : natural) return std_logic_vector;

function slv_to_bcd(vectorVal : std_logic_vector) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using enough BCD digits to represent the largest value possible in the range of the vector passed

function slv_to_bcd(vectorVal     : std_logic_vector;
                    BCD_DigitsVal : integer) return std_logic_vector;           -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using the number of BCD digits specified

function slv_to_bcd_pipe(BCD_RVal      : std_logic_vector;
                         MSB_Val       : std_logic; 
                         BCD_DigitsVal : integer) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using the number of BCD digits specified. For pipelined operation. function must be called N times where N is the number of bits in the passed value

function str_to_int(stringVal : string) return integer;                         -- converts an Integer string to an integer

function str_to_line(strVal : string) return line;

function str_to_led(stringVal : string; 
                    CAVal     : boolean) return std_logic_vector;               -- converts a Hexadecimal string of any length to a std_logic_vector for seven segment LEDs

function str_to_slv(stringVal : string) return std_logic_vector;                -- converts an Integer, in string form, of any length to a std_logic_vector

function str_to_slv(stringVal : string; 
                    intVal    : integer) return std_logic_vector;               -- converts an Integer, in string form, of any length to a std_logic_vector using the time base passed

function str_to_slv_high(stringVal : string) return integer;                    -- returns an integer representing the length of a vector needed to represent the intever value (in string form) passed

function str_to_slv_var_base_high(stringVal : string;
                                  intVal : integer) return integer;             -- returns an integer representing the length of a vector needed to represent the intever value (in string form) passed using the timebase value

function strh(stringVal : string) return integer;

function sxt2(vectorVal : std_logic_vector;
              natVal    : natural) return std_logic_vector;                     -- returns a standard logic vector, padded with sign bits, to the length specified by intVal unless the vector is already longer than that

function to_int(vectorVal : std_logic_vector) return integer;                   -- repackaging of "conv_integer" function

-- synopsys translate_off
function to_period(freqVal : frequency) return time;                            -- returns a one cycle period value for a given frequency
--function to_period(freqVal : string) return time;                               -- returns a one cycle period value for a given frequency
-- synopsys translate_on

function to_string(boolVal : boolean) return string;                            -- returns the string representation of a boolean value passed

function to_string(intVal : integer) return string;                             -- returns the string representation of an integer value passed

function to_string(realVal : real) return string;                               -- returns the string representation of a real value passed

function to_string(timeVal : time) return string;                               -- returns the string representation of a time value passed

function to_string(vectorVal : std_logic_vector) return string;                 -- returns the string representation of a std_logic_vector value passed

function vhfi(intVal : integer) return natural;                                 -- returns the high value to be used in the range declaration of a vector used to represent the integer value passed. This assumes the rest of the range declaration of the vector will be "downto 0"

function vhfn(natVal : natural) return natural;                                 -- returns the high value to be used in the range declaration of a vector used to represent the natural value passed. This assumes the rest of the range declaration of the vector will be "downto 0"

function vlfi(intVal : integer) return natural;                                 -- returns an integer representing the length of a vector needed to represent the integer value passed

function vlfn(natVal : natural) return natural;                                 -- returns an integer representing the length of a vector needed to represent the natural value passed

function vrfi(intVal : integer) return std_logic_vector;                        -- returns a std_logic_vector with a range just large enough to represent the integer value passed

function vrfn(natVal : natural) return std_logic_vector;                        -- returns a std_logic_vector with a range just large enough to represent the natural value passed

function xnor_reduce(vectorVal : std_logic_vector) return std_logic;            -- multiple input xnor gate

function xor_reduce(vectorVal : std_logic_vector) return std_logic;             -- multiple input xor gate



------------------------------------------------------------------------------
-- Procedure Declarations
------------------------------------------------------------------------------
-- synopsys translate_off
procedure clkgen(
   constant clkFreqSig      : in    frequency;
   signal   clkSig          : out   std_logic);
  
procedure clkgen(
   signal   clkEnSig    : in  boolean;
   signal   clkFreqSig  : in  frequency;
   signal   clkSig      : out std_logic);

procedure clkgen(
   signal   clkEnSig        : in    boolean;
   signal   clkPeriodSig    : in    time;
   constant clkDutySig      : in    real;
   signal   clkResetSig     : in    boolean;
   signal   clkSig          : inout std_logic);
   
procedure clkgen(
   signal   clkEnSig        : in    boolean;
   signal   clkFreqSig      : in    frequency;
   constant clkDutySig      : in    real;
   signal   clkResetSig     : in    boolean;
   signal   clkSig          : inout std_logic);
-- synopsys translate_on
  
procedure FF(
   signal Clk : in  std_logic;
   signal Rst : in  std_logic;
   signal D   : in  std_logic_vector;
   signal Q   : out std_logic_vector);

procedure slv_to_bcd(
   signal   BCD_RIn           : in  std_logic_vector;
   signal   BinIn             : in  std_logic_vector;
   signal   BinFBIn           : in  std_logic_vector;
   signal   ClkIn             : in  std_logic;
   constant BCD_DigitsVal     : in  integer;
   signal   EnIn              : in  std_logic;
   signal   RstLowIn          : in  std_logic;
   signal   BCD_ROut          : out std_logic_vector;
   signal   Bin_ROut          : out std_logic_vector;
   signal   DoneOut           : out std_logic);


------------------------------------------------------------------------------
-- Aliases
------------------------------------------------------------------------------
alias bool     is boolean;
alias bv       is bit_vector;
alias char     is character;
-- synopsys translate_off
alias fok      is file_open_kind;
alias fos      is file_open_status;
alias freq     is frequency;
-- synopsys translate_on
alias int      is integer;
alias nat      is natural;
alias pos      is positive;
alias sl       is std_logic;
alias slv      is std_logic_vector;
alias str      is string;
alias sul      is std_ulogic;
alias sulv     is std_ulogic_vector;
alias uns      is unsigned;


------------------------------------------------------------------------------
end extension_pack;
------------------------------------------------------------------------------


------------------------------------------------------------------------------
package body extension_pack is
------------------------------------------------------------------------------


------------------------------------------------------------------------------
--
-- Functions
--
------------------------------------------------------------------------------


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : "*"
--
-- DESCRIPTION     : This function multiplies an integer by a 
--                   std_logic_vector and returns a std_logic_vector
--
-- NOTES           : 
--
------------------------------------------------------------------------------
function "*"(MultiplicandVal : integer; 
             MultiplierVal   : std_logic_vector) return std_logic_vector is
begin
   return int_to_slv(MultiplicandVal)*MultiplierVal;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : "*"
--
-- DESCRIPTION     : This function multiplies a std_logic_vector by an integer
--                   and returns a std_logic_vector
--
-- NOTES           : 
--
------------------------------------------------------------------------------
function "*"(MultiplicandVal : std_logic_vector; 
             MultiplierVal   : integer) return std_logic_vector is
begin
   return MultiplicandVal*int_to_slv(MultiplierVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : "/"
--
-- DESCRIPTION     : This function divides an unsigned std_logic vector value
--                   by another unsigned std_logic_vector value and returns
--                   a std_logic_vector that is the same length
--                   as the dividend
--
-- NOTES           : the algorithm used in this function 
--                   is the standard long division algorithm.
--                   it rounds to the nearest value
--
------------------------------------------------------------------------------
function "/"(DividendVal : std_logic_vector; 
             DivisorVal  : std_logic_vector) return std_logic_vector is
   variable DividendVar : std_logic_vector(DividendVal'length+DivisorVal'length downto 0);
   variable DivisorVar  : std_logic_vector(DivisorVal'length downto 0);
   variable InterimVar  : std_logic_vector(DivisorVal'length downto 0);
   variable ResultVar   : std_logic_vector(DividendVal'length downto 0);
begin
   DividendVar := ext(DividendVal & '0',DividendVar'length);
   DivisorVar  := '0' & DivisorVal;
   InterimVar  := '0' & DividendVar(DividendVar'high downto DividendVar'high-(DivisorVar'length-2));
   ResultVar   := (others => '0');
   for loopVar in ResultVar'range loop
      if (InterimVar >= DivisorVar) then
         InterimVar         := InterimVar - DivisorVar;
         InterimVar         := InterimVar(InterimVar'high-1 downto 0) & DividendVar(loopVar);
         ResultVar(loopVar) := '1';
      else
         InterimVar         := InterimVar(InterimVar'high-1 downto 0) & DividendVar(loopVar);
         ResultVar(loopVar) := '0';
      end if;
   end loop;
   -- round to the nearest digit 
   if (InterimVar >= DivisorVal) then  -- it the remainder is at least 1/2 of the Divisor (it was effectively multiplied by two during the final pass through the loop)
      ResultVar := ResultVar + '1';    -- then round up to the next value
   end if;
   return ResultVar(ResultVar'length-2 downto 0);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : "/"
--
-- DESCRIPTION     : This function divides an unsigned std_logic_vector value
--                   by an integer value
--
-- NOTES           : 
--
------------------------------------------------------------------------------
function "/"(DividendVal : std_logic_vector; 
             DivisorVal  : integer) return std_logic_vector is
begin
    return DividendVal/int_to_slv(DivisorVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : "/"
--
-- DESCRIPTION     : This function divides an integer string value
--                   by an integer value 
--
-- NOTES           : 
--
------------------------------------------------------------------------------
function "/"(DividendVal : string; 
             DivisorVal  : integer) return std_logic_vector is
begin
    return str_to_slv(DividendVal)/int_to_slv(DivisorVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : bcd_to_led
--
-- DESCRIPTION     : This function converts a packed BCD vector or a hex value
--                   into a seven segment LED output
--
-- NOTES             if the CAVal boolean input is true the output will
--                   be for a Common Anode (1=off) display, otherwise it will
--                   be for a Common Cathode (1=on)display.
--    _____
--   |  a  |
--  f|     |b
--   |_____|
--   |  g  |
--  e|     |c
--   |_____|
--      d
--
-- "width mismatch" errors are due to improper sizing of the vector
-- that this function is assigned to
--
------------------------------------------------------------------------------
function bcd_to_led(slvVal : std_logic_vector ; CAVal : boolean) return std_logic_vector is
   variable resultVar        : std_logic_vector(7*slvVal'length/4-1 downto 0);
   variable vectorParseVar   : std_logic_vector(3 downto 0);
   variable vectorVar        : std_logic_vector(slvVal'length-1 downto 0);
begin
   vectorVar := slvVal; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
   for loopVar in 0 to slvVal'length/4-1 loop
      vectorParseVar := vectorVar(4*loopVar+3 downto 4*loopVar);
      case vectorParseVar is
--                                                             Illuminated
--          vector                                             Segment
--          value                                              abcdefg
      when x"0" => resultVar(7*loopVar+6 downto 7*loopvar) := "1111110"; -- 0
      when x"1" => resultVar(7*loopVar+6 downto 7*loopvar) := "0110000"; -- 1
      when x"2" => resultVar(7*loopVar+6 downto 7*loopvar) := "1101101"; -- 2
      when x"3" => resultVar(7*loopVar+6 downto 7*loopvar) := "1111001"; -- 3
      when x"4" => resultVar(7*loopVar+6 downto 7*loopvar) := "0110011"; -- 4
      when x"5" => resultVar(7*loopVar+6 downto 7*loopvar) := "1011011"; -- 5
      when x"6" => resultVar(7*loopVar+6 downto 7*loopvar) := "1011111"; -- 6
      when x"7" => resultVar(7*loopVar+6 downto 7*loopvar) := "1110010"; -- 7
      when x"8" => resultVar(7*loopVar+6 downto 7*loopvar) := "1111111"; -- 8
      when x"9" => resultVar(7*loopVar+6 downto 7*loopvar) := "1110011"; -- 9
      when x"A" => resultVar(7*loopVar+6 downto 7*loopvar) := "0001000"; -- A
      when x"B" => resultVar(7*loopVar+6 downto 7*loopvar) := "1100000"; -- b
      when x"C" => resultVar(7*loopVar+6 downto 7*loopvar) := "0110001"; -- C
      when x"D" => resultVar(7*loopVar+6 downto 7*loopvar) := "1000010"; -- d
      when x"E" => resultVar(7*loopVar+6 downto 7*loopvar) := "0110000"; -- E
      when x"F" => resultVar(7*loopVar+6 downto 7*loopvar) := "0111000"; -- F
      when others =>
      end case;
   end loop;
   if (CAVal) then
      return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
   else
      return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : bcd_to_slv
--
-- DESCRIPTION     : This function converts a packed binary coded decimal (BCD)
--                   in standard logic vector for and returns an unsigned, 
--                   decending range, binary value
--
-- NOTES
-- 
-- "width mismatch" errors are due to improper sizing of the vector 
-- that this function is assigned to
------------------------------------------------------------------------------
function bcd_to_slv(vectorVal : std_logic_vector) return std_logic_vector is 
type BCDArrayType is array(vectorVal'length downto 0)                           -- array depth is 1 level more than the input vector
     of std_logic_vector(vectorVal'length-1 downto 0);                          -- 
variable CarryVar        : std_logic_vector(vectorVal'length/4 downto 0);       -- the # of carry bits is determined by the number of BCD digits
variable BCD_WoCarVar    : std_logic_vector(3 downto 0);                        -- BCD digit variable used by the inner loop if no carry to the next BCD Digit is needed
variable BCD_WiCarVar    : std_logic_vector(3 downto 0);                        -- BCD digit variable used by the inner loop if carry to the next BCD Digit is needed
variable BCDVar          : BCDArrayType;                                        -- BCD value array
variable ResultVar       : std_logic_vector(vectorVal'length-1 downto 0);
begin
   BCDVar(0) := vectorVal;                                                      -- set the initial entry in the array to the input vector
   for OutrLoopVar in  1 to vectorVal'length loop                               -- 
      CarryVar(CarryVar'high) := '0';
      for InnrLoopVar in CarryVar'high-1 downto 0 loop                          -- start at the MSB of the BCD vector
         BCD_WoCarVar := '0' & BCDVar(OutrLoopVar-1)                            -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
                                (4*InnrLoopVar+3 downto 4*InnrLoopVar+1);       -- read the results of the previous calculation
         BCD_WiCarVar := BCD_WoCarVar + "0101";                                 -- compute the result for the current BCD digit if carry is needed
         CarryVar(InnrLoopVar)  := BCDVar(OutrLoopVar-1)(4*InnrLoopVar);        -- read in the next bit of the LSB of the previous BCD digit input into the lowest carry bit
         if (CarryVar(InnrLoopVar+1) = '1') then                                -- if the the previous digit has a carry bit then then the result of the binary shift right is greater by 5
            BCDVar(OutrLoopVar)(4*InnrLoopVar+3 downto 4*InnrLoopVar) := BCD_WiCarVar;
         else                                                                   -- otherwise 
            BCDVar(OutrLoopVar)(4*InnrLoopVar+3 downto 4*InnrLoopVar) := BCD_WoCarVar;    -- we shift the bits right by 1 space
         end if;
      end loop;
      ResultVar(OutrLoopVar-1) := BCDVar(OutrLoopVar-1)(0);
   end loop;
   return ResultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : bcd_to_slv_pipe
--
-- DESCRIPTION     : This function converts a packed binary coded decimal (BCD)
--                   into an unsigned, decending range, 
--                   binary value into a standard logic vector
--                   and returns the result in
--                   the number BCD digits required to represent the maximum 
--                   unsigned value possible in the vector passed to it.
--                   it is for use in pipelined implementations where
--                   the binary coded decimal output is registered
--                   and passed back to the function along with the binary
--                   vector input to be shifted out of its MSB
--                   register and into the function as a new bit.
--                   
--
-- NOTES
-- BCD_DigitsVal -> dpfslvr(vectorVal)
------------------------------------------------------------------------------
function bcd_to_slv_pipe(
   BCD_RVal      : std_logic_vector;           -- registered output of this function fed back in
   BCD_DigitsVal : integer) return std_logic_vector is                          -- binary coded decimal arithmetic shift right
variable BCDVar          : std_logic_vector(BCD_RVal'length-1 downto 0);
variable CarryVar        : std_logic_vector(BCD_DigitsVal downto 0) := (others => '0');            -- the # of carry bits is determined by the number of BCD digits
variable BCD_WoCarVar    : std_logic_vector(3 downto 0);
variable BCD_WiCarVar    : std_logic_vector(3 downto 0);
variable ResultVar       : std_logic_vector(4*BCD_DigitsVal-1 downto 0);
begin
   BCDVar := BCD_RVal;
   CarryVar(CarryVar'high) := '0';
   for loopVar in BCD_DigitsVal-1 downto 0 loop
      BCD_WoCarVar := '0' & BCDVar(4*loopVar+3 downto 4*loopVar+1);
      BCD_WiCarVar := BCD_WoCarVar + "0101";
      CarryVar(loopVar) := BCDVar(4*loopVar);
      if (CarryVar(loopVar+1) = '1') then                     
         ResultVar(4*loopVar+3 downto 4*loopVar) := BCD_WiCarVar;
      else
         ResultVar(4*loopVar+3 downto 4*loopVar) := BCD_WoCarVar;
      end if;
   end loop;
   return ResultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : bv_to_slv (convert integer to std_logic_vector)
--
-- DESCRIPTION     : This function converts an bit vector 
--                   to a std logic vector.
--
-- NOTES
--
------------------------------------------------------------------------------
function bv_to_slv(bitVectVal : bit_vector) return std_logic_vector is
begin
   return To_StdLogicVector(bitVectVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cdft (count down for time)
--
-- DESCRIPTION     : This function takes a string based time value and 
--                   converts it to a std_logic_vector value (minus 2 for
--                   latency for counting down to an underflow for) using
--                   a string based frequency value, as a reference
-- NOTES
--
-- if the following error occurs it is due to an improperly sized vector
-- that the result of this function is assigned to.
--
--# ** Fatal: (vsim-3420) Array lengths do not match.
--
-- This function is best used to determine a variable
-- value (CountValIn) for use with a counter styled similarly
-- to this:
--
--  CounterProcess:process(CountRSig,CountValIn)
--  begin
--     if (CountRSig(CountRSig'high) = '1') then
--	       CountSig  <= CountValIn;
--	       PulseSig  <= '1';
--     else
--	       CountSig  <= CountRSig - 1;
--	       PulseSig  <= '0';
--     end if;
--  end process;
--  
------------------------------------------------------------------------------
function cdft(timeStrVal : string;
              freqStrVal : string) return std_logic_vector is
   variable freqStrVar   : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable timeVar      : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
begin
   freqStrVar  := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar     := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   return reduce((timeVar/freqStrVar) - 2);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cdft (count down for time)
--
-- DESCRIPTION     : This function takes a string based time value and 
--                   converts it to a std_logic_vector value (minus 2 for
--                   latency for counting down to an underflow for) using
--                   a string based frequency (or period) value as a time
--                   base reference and a natural value for
--                   the length of the vector to return
--                   (if it will fit in a vector that size)
-- NOTES
--
-- if the following error occurs it is due to an improperly sized vector
-- that the result of this function is assigned to.
--
--# ** Fatal: (vsim-3420) Array lengths do not match.
--
-- This function is best used to determine a variable
-- value (CountValIn) for use with a counter styled similarly
-- to this:
--
--  CounterProcess:process(CountRSig,CountValIn)
--  begin
--     if (CountRSig(CountRSig'high) = '1') then
--	       CountSig  <= CountValIn;
--	       PulseSig  <= '1';
--     else
--	       CountSig  <= CountRSig - 1;
--	       PulseSig  <= '0';
--     end if;
--  end process;
--  
------------------------------------------------------------------------------
function cdft(timeStrVal : string;
              freqStrVal : string;
              natVal     : natural) return std_logic_vector is
   variable freqStrVar   : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable lengthVar    : natural;
   variable timeVar      : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
   variable zeroVar      : std_logic_vector(natVal - cdfth(timeStrVal,freqStrVal) - 2 downto 0) := (others => '0');
begin
   freqStrVar  := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar     := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   lengthVar   := reduce_length((timeVar/freqStrVar) - 2);
   if (lengthVar >= natVal) then
      return reduce((timeVar/freqStrVar) - 2);
   else
      return zeroVar & reduce((timeVar/freqStrVar) - 2);
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cdfth (count down for time high)
--
-- DESCRIPTION     : This function computes the vector'high value
--                   from a string based time value (minus a count of 2
--                   for use in counting down to underflow) and 
--                   converts it to a std_logic_vector value using
--                   the a string based period value, as a reference
-- NOTES
--
------------------------------------------------------------------------------
function cdfth(timeStrVal : string;
               freqStrVal : string) return integer is
   variable freqStrVar   : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable timeVar      : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
begin
   freqStrVar := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar    := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   return reduce_high((timeVar/freqStrVar) - 2);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : ceil (convert integer to std_logic_vector)
--
-- DESCRIPTION     : This function rounds a real value up to the next
--                   real integer
--
-- NOTES
--
------------------------------------------------------------------------------
function ceil (RealVal : in real) return real is
   constant integerMaxVal  : real  := real(2_147_483_647);
   variable RoundVar       : real;
   variable ResultVar      : real;
begin
   RoundVar := real(integer(RealVal));
   if (abs(RealVal) >= integerMaxVal) then
      ResultVar := RealVal;
   elsif (RoundVar = RealVal) then
      ResultVar := RoundVar;
   elsif (RealVal > 0.0) then
      if (RoundVar >= RealVal) then
         ResultVar := RoundVar;
      else
         ResultVar := RoundVar + 1.0;
      end if;
   elsif (RealVal = 0.0)  then
      ResultVar := 0.0;
   else
      if (RoundVar <= RealVal) then
         ResultVar := RoundVar + 1.0;
      else
         ResultVar := RoundVar;
      end if;
   end if;
   return ResultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cfi (characters for integer)
--
-- DESCRIPTION     : This function returns a natural representing the
--                   number of characters required to reprsent an
--                   integer value. It is essentially
--                   an integer'length function for the characters.
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function cfi(intVal : integer) return natural is
   variable intVar        : integer;
   variable negVar        : boolean;
begin
   if (intVal < 0) then
      intVar := -intVal;
      negVar := true;      
   else
      intVar := intVal;
      negVar := false;
   end if;
   for LoopVar in 1 to MAX_VECT_SIZE loop
      if (intVar = 0) then
         return 1;
      elsif (intVar < 10 and intVar >= 1) then
         if (negVar) then
            return loopVar + 1; -- allow for the '-' character
         else 
            return loopVar;
         end if;
      else
         intVar := intVar/10; 
      end if;
   end loop;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cft (count for time)
--
-- DESCRIPTION     : This function takes a string based time value and 
--                   converts it to a std_logic_vector value using
--                   a string based frequency value, as a reference
-- NOTES
--
-- if the following error occurs it is due to an improperly sized vector
-- that the result of this function is assigned to.
--
--# ** Fatal: (vsim-3420) Array lengths do not match.
------------------------------------------------------------------------------
function cft(timeStrVal : string;
             freqStrVal : string) return std_logic_vector is
   variable freqStrVar : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable timeVar    : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
begin
   freqStrVar  := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar     := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   return reduce(timeVar/freqStrVar);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cft (count for time)
--
-- DESCRIPTION     : This function takes a string based time value and 
--                   converts it to a std_logic_vector value using
--                   a string based frequency (or period) value as a time
--                   base reference and a natural value for
--                   the length of the vector to return
--                   (if it will fit in a vector that size)
-- NOTES
--
-- if the following error occurs it is due to an improperly sized vector
-- that the result of this function is assigned to.
--
--# ** Fatal: (vsim-3420) Array lengths do not match.
------------------------------------------------------------------------------
function cft(timeStrVal : string;
             freqStrVal : string;
             natVal     : natural) return std_logic_vector is
   variable freqStrVar : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable lengthVar  : natural;
   variable timeVar    : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
   variable zeroVar    : std_logic_vector(natVal - cfth(timeStrVal,freqStrVal) - 2 downto 0) := (others => '0');
begin
   freqStrVar  := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar     := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   lengthVar   := reduce_length(timeVar/freqStrVar);
   if (lengthVar >= natVal) then
      return reduce(timeVar/freqStrVar);
   else
      return zeroVar & reduce(timeVar/freqStrVar);
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cfth (count for time high)
--
-- DESCRIPTION     : This function computes the vector'high value
--                   from a string based time value using
--                   the a string based frequency (or period)
--                   value, as a reference
-- NOTES
--
------------------------------------------------------------------------------
function cfth(timeStrVal : string;
              freqStrVal : string) return integer is
   variable freqStrVar : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable timeVar    : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
begin
   freqStrVar := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar    := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   return reduce_high(timeVar/freqStrVar);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : clkcnt (50% duty cycle clock count)
--
-- DESCRIPTION     : This function takes a string based frequency value and 
--                   converts it to a std_logic_vector value using
--                   a string based frequency value, as a reference
-- NOTES
--          this function is for use with a process which counts
--          up to a static value. This method tends to give the smallest and 
--          fastest circuit
--
--CounterProcess2:process(ClkRSig,Count2RSig)
-- variable CLKCNTVAL : slv := clkcnt("Freq1StrVal","Freq2StrVal")
--begin
--   if (Count2RSig = CLKCNTVAL) then
--	   Count2Sig  <= (others => '0');
--	   ClkSig     <= not ClkRSig;
--   else
--	   Count2Sig  <= Count2RSig + 1;
--	   ClkSig     <= ClkRSig;
--   end if;
--end process; 
--
-- if the following error occurs it is due to an improperly sized vector
-- that the result of this function is assigned to.
--
--# ** Fatal: (vsim-3420) Array lengths do not match.
------------------------------------------------------------------------------
function clkcnt(freq1StrVal : string;
                freq2StrVal : string) return std_logic_vector is
   variable freq1StrVar : std_logic_vector(str_to_slv_var_base_high(freq1StrVal,CFT_BASE_SIZE) downto 0);
   variable freq2StrVar : std_logic_vector(str_to_slv_var_base_high(freq2StrVal,CFT_BASE_SIZE) downto 0);
begin
   freq1StrVar  := str_to_slv(freq1StrVal,CFT_BASE_SIZE);
   freq2StrVar  := str_to_slv(freq2StrVal,CFT_BASE_SIZE);
   return reduce_unsigned((freq1StrVar/freq2StrVar)/2-1);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : conv_to_hex
--
-- DESCRIPTION     : This function converts a bit vector of any length to a
--                   string representing the Hexadecimal value of that vector
-- NOTES
--
------------------------------------------------------------------------------
function conv_to_hex(vectorVal : bit_vector) return string is
   variable resultVar        : string(integer(ceil(real(vectorVal'length)/4.0)) downto 1);
   variable vectorParseVar   : std_logic_vector(4 downto 1);
   variable vectorStretchVar : std_logic_vector((integer(ceil(real(vectorVal'length)/4.0)))*4 downto 1);
   variable VectorVar        : bit_vector(vectorVal'length-1 downto 0);
begin
   VectorVar := vectorVal;
   vectorStretchVar := ext(to_stdlogicvector(VectorVar),vectorStretchVar'length);
   for loopVar in resultVar'range loop
      vectorParseVar := vectorStretchVar(loopVar*4 downto loopVar*4-3);
      case vectorParseVar(4 downto 1) is
      when x"0" => resultVar(loopVar) := '0';
      when x"1" => resultVar(loopVar) := '1';
      when x"2" => resultVar(loopVar) := '2';
      when x"3" => resultVar(loopVar) := '3';
      when x"4" => resultVar(loopVar) := '4';
      when x"5" => resultVar(loopVar) := '5';
      when x"6" => resultVar(loopVar) := '6';
      when x"7" => resultVar(loopVar) := '7';
      when x"8" => resultVar(loopVar) := '8';
      when x"9" => resultVar(loopVar) := '9';
      when x"A" => resultVar(loopVar) := 'A';
      when x"B" => resultVar(loopVar) := 'B';
      when x"C" => resultVar(loopVar) := 'C';
      when x"D" => resultVar(loopVar) := 'D';
      when x"E" => resultVar(loopVar) := 'E';
      when x"F" => resultVar(loopVar) := 'F';
      when others =>
      end case;
   end loop;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : conv_to_hex
--
-- DESCRIPTION     : This function converts a logic vector of any length to a
--                   string representing the Hexadecimal value of that vector
-- NOTES
--
------------------------------------------------------------------------------
function conv_to_hex(vectorVal : std_logic_vector) return string is
   variable resultVar        : string(integer(ceil(real(vectorVal'length)/4.0)) downto 1);
   variable vectorParseVar   : std_logic_vector(4 downto 1);
   variable vectorStretchVar : std_logic_vector((integer(ceil(real(vectorVal'length)/4.0)))*4 downto 1);
   variable VectorVar        : std_logic_vector(vectorVal'length-1 downto 0);
begin
   VectorVar := vectorVal;
   vectorStretchVar := ext(VectorVar,vectorStretchVar'length);
   for loopVar in resultVar'range loop
      vectorParseVar := vectorStretchVar(loopVar*4 downto loopVar*4-3);
      case vectorParseVar(4 downto 1) is
      when x"0" => resultVar(loopVar) := '0';
      when x"1" => resultVar(loopVar) := '1';
      when x"2" => resultVar(loopVar) := '2';
      when x"3" => resultVar(loopVar) := '3';
      when x"4" => resultVar(loopVar) := '4';
      when x"5" => resultVar(loopVar) := '5';
      when x"6" => resultVar(loopVar) := '6';
      when x"7" => resultVar(loopVar) := '7';
      when x"8" => resultVar(loopVar) := '8';
      when x"9" => resultVar(loopVar) := '9';
      when x"A" => resultVar(loopVar) := 'A';
      when x"B" => resultVar(loopVar) := 'B';
      when x"C" => resultVar(loopVar) := 'C';
      when x"D" => resultVar(loopVar) := 'D';
      when x"E" => resultVar(loopVar) := 'E';
      when x"F" => resultVar(loopVar) := 'F';
      when others =>
      end case;
   end loop;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : conv_to_hex
--
-- DESCRIPTION     : This function converts a ulogic vector of any length to a
--                   string representing the Hexadecimal value of that vector
-- NOTES
--
------------------------------------------------------------------------------
function conv_to_hex(vectorVal : std_ulogic_vector) return string is
   variable resultVar        : string(integer(ceil(real(vectorVal'length)/4.0)) downto 1);
   variable vectorParseVar   : std_logic_vector(4 downto 1);
   variable vectorStretchVar : std_logic_vector((integer(ceil(real(vectorVal'length)/4.0)))*4 downto 1);
   variable VectorVar        : std_ulogic_vector(vectorVal'length-1 downto 0);
begin
   VectorVar := vectorVal;
   vectorStretchVar := ext(to_stdlogicvector(VectorVar),vectorStretchVar'length);
   for loopVar in resultVar'range loop
      vectorParseVar := vectorStretchVar(loopVar*4 downto loopVar*4-3);
      case vectorParseVar(4 downto 1) is
      when x"0" => resultVar(loopVar) := '0';
      when x"1" => resultVar(loopVar) := '1';
      when x"2" => resultVar(loopVar) := '2';
      when x"3" => resultVar(loopVar) := '3';
      when x"4" => resultVar(loopVar) := '4';
      when x"5" => resultVar(loopVar) := '5';
      when x"6" => resultVar(loopVar) := '6';
      when x"7" => resultVar(loopVar) := '7';
      when x"8" => resultVar(loopVar) := '8';
      when x"9" => resultVar(loopVar) := '9';
      when x"A" => resultVar(loopVar) := 'A';
      when x"B" => resultVar(loopVar) := 'B';
      when x"C" => resultVar(loopVar) := 'C';
      when x"D" => resultVar(loopVar) := 'D';
      when x"E" => resultVar(loopVar) := 'E';
      when x"F" => resultVar(loopVar) := 'F';
      when others =>
      end case;
   end loop;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : crc16
--
-- DESCRIPTION     : returns the input to a Cyclic Redundancy Check (CRC)
--                   using the polynomial x^16 + x^15 + x^2 + 1 
--                   (CRC-16-CCITT)
--
-- NOTES: the output from this function is clocked into the input
--        registers of the LFSR. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with a non zero seed value to function.
--
--        http://en.wikipedia.org/wiki/LFSR
------------------------------------------------------------------------------
function crc16(serialInVal : std_logic;
               vectorVal   : std_logic_vector) return std_logic_vector is

--   constant OUTPUT_FILE  : string := "../crc16_function_logfile.txt";
--   variable LogFileLine  : line;
--   file     LogFile      : text open write_mode is OUTPUT_FILE;

   variable vector1Var             : std_logic_vector(1 to 16);                   -- CRCs are usually depicted shifting left to right with the right being the MSB
   variable vector2Var             : std_logic_vector(1 to 16);                   -- CRCs are usually depicted shifting left to right with the right being the MSB
begin
   vector1Var          := vectorVal;
   vector2Var          := '0' & vector1Var(1 to 15);                              -- default to vector1Var shifted right
   
   vector2var(1)       := serialInVal xor vector1Var(15);                                     
   vector2Var(3)       := serialInVal xor vector1Var(2) xor vector1Var(16);
   vector2Var(16)      := serialInVal xor vector1Var(15) xor vector1Var(16);
   
   
   return vector2Var;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cslv (convert integer to std_logic_vector)
--
-- DESCRIPTION     : This function converts an integer (int1Val) 
--                   to a std logic vector of length int2Val.
--
-- NOTES
--
------------------------------------------------------------------------------
function cslv(int1Val : integer; 
              int2Val : integer) return std_logic_vector is
begin
   return conv_std_logic_vector(int1Val,int2Val);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cslv (convert signed  to std_logic_vector)
--
-- DESCRIPTION     : This function converts an signed value 
--                   to a std logic vector of length intVal.
--
-- NOTES
--
------------------------------------------------------------------------------
function cslv(sigVal : signed; 
              intVal : integer) return std_logic_vector is
begin
   return conv_std_logic_vector(sigVal,intVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cslv (convert integer to std_logic_vector)
--
-- DESCRIPTION     : This function converts an unsigned value 
--                   to a std logic vector of length intVal.
--
-- NOTES
--
------------------------------------------------------------------------------
function cslv(usgVal : unsigned; 
              intVal : integer) return std_logic_vector is
begin
   return conv_std_logic_vector(usgVal,intVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cuft (count up for time)
--
-- DESCRIPTION     : This function takes a string based time value and 
--                   converts it to a std_logic_vector (minus one for latency)
--                   value using a string based frequency (or period) value,
--                   as a reference
-- NOTES
--
-- if the following error occurs it is due to an improperly sized vector
-- that the result of this function is assigned to.
--
--# ** Fatal: (vsim-3420) Array lengths do not match.
--
-- This function is best used to determine a constant
-- value (COUNTVALUE) for use with a counter styled similarly
-- to this:
--
--  CounterProcess:process(CountRSig,CountValIn)
--  begin
--     if (CountRSig = COUNTVALUE) then
--	       CountSig  <= (others => '0');
--	       PulseSig  <= '1';
--     else
--	       CountSig  <= CountRSig + 1;
--	       PulseSig  <= '0';
--     end if;
--  end process;
--  
------------------------------------------------------------------------------
function cuft(timeStrVal : string;
              freqStrVal : string) return std_logic_vector is
   variable freqStrVar   : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable timeVar      : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
begin
   freqStrVar  := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar     := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   return reduce_unsigned((timeVar/freqStrVar) - 1);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cuft (count up for time)
--
-- DESCRIPTION     : This function takes a string based time value and 
--                   converts it to a std_logic_vector (minus one for latency)
--                   value using a string based frequency (or period) value
--                   as a time base reference and a natural value for
--                   the length of the vector to return
--                   (if it will fit in a vector that size)
-- NOTES
--
-- if the following error occurs it is due to an improperly sized vector
-- that the result of this function is assigned to:
--
--# ** Fatal: (vsim-3420) Array lengths do not match.
--
-- This function is best used to determine a constant
-- value (COUNTVALUE) for use with a counter styled similarly
-- to this:
--
--  CounterProcess:process(CountRSig,CountValIn)
--  begin
--     if (CountRSig = COUNTVALUE) then
--	       CountSig  <= (others => '0');
--	       PulseSig  <= '1';
--     else
--	       CountSig  <= CountRSig + 1;
--	       PulseSig  <= '0';
--     end if;
--  end process;
--  
------------------------------------------------------------------------------
function cuft(timeStrVal : string;
              freqStrVal : string;
              natVal     : natural) return std_logic_vector is
   variable freqStrVar : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable lengthVar  : natural;
   variable timeVar    : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
   variable zeroVar    : std_logic_vector(natVal - cufth(timeStrVal,freqStrVal) - 2 downto 0) := (others => '0');
begin
   freqStrVar  := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar     := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   lengthVar   := reduce_length_unsigned((timeVar/freqStrVar) - 1);
   if (lengthVar >= natVal) then
      return reduce_unsigned((timeVar/freqStrVar) - 1);
   else
      return zeroVar & reduce_unsigned((timeVar/freqStrVar) - 1);
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : cufth (count up for time high)
--
-- DESCRIPTION     : This function computes the vector'high value
--                   from a string based time value (minus a count of 1
--                   for use in counting up from zero to the proper value) using
--                   the a string based period value, as a reference
-- NOTES
--
------------------------------------------------------------------------------
function cufth(timeStrVal : string;
               freqStrVal : string) return integer is
   variable freqStrVar   : std_logic_vector(str_to_slv_var_base_high(freqStrVal,CFT_BASE_SIZE) downto 0);
   variable timeVar      : std_logic_vector(str_to_slv_var_base_high(timeStrVal,CFT_BASE_SIZE) downto 0);
begin
   freqStrVar := str_to_slv(freqStrVal,CFT_BASE_SIZE);
   timeVar    := str_to_slv(timeStrVal,CFT_BASE_SIZE);
   return reduce_high_unsigned((timeVar/freqStrVar) - 1);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : dpfi (decimal places for integer)
--
-- DESCRIPTION     : This function returns a natural representing the
--                   number of digits in an integer value. It is essentially
--                   an integer'length function (does not count
--                   a '-' character).
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function dpfi(intVal : integer) return natural is
   variable intVar        : integer;
   variable CountVar      : natural := 1;
   variable ResultVar     : natural;
begin
   if (intVal < 0) then
      intVar := -intVal;
   else 
      intVar := intVal;
   end if;
   for CountVar in 1 to MAX_VECT_SIZE loop
      if (intVal = 0) then
         return 1;
      elsif (intVar < 10 and intVar >= 1) then
         return CountVar;
      else
         intVar := intVar/10; 
      end if;
   end loop;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : dpfi_syn (decimal places for integer (synthesizeable))
--
-- DESCRIPTION     : This function returns a natural representing the
--                   number of digits in an integer value. It is essentially
--                   an integer'length function.
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function dpfi_syn(intVal : integer) return natural is
   variable resultVar  : natural;
begin
   if (intVal <= -1_000_000_000 or intVal >= 1_000_000_000) then
      resultVar := 10;
   elsif (intVal <= -100_000_000 or intVal >= 100_000_000) then
      resultVar := 9;
   elsif (intVal <= -10_000_000 or intVal >= 10_000_000) then
      resultVar := 8;
   elsif (intVal <= -1_000_000 or intVal >= 1_000_000) then
      resultVar := 7;
   elsif (intVal <= -100_000 or intVal >= 100_000) then
      resultVar := 6;
   elsif (intVal <= -10_000 or intVal >= 10_000) then
      resultVar := 5;
   elsif (intVal <= -1_000 or intVal >= 1_000) then
      resultVar := 4;
   elsif (intVal <= -100 or intVal >= 100) then
      resultVar := 3;
   elsif (intVal <= -10 or intVal >= 10) then
      resultVar := 2;
   else
      resultVar := 1;
   end if;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : dpfr (decimal places for real)
--
-- DESCRIPTION     : This function returns a natural value representing the
--                   number of digits to the left of the decimal
--                   in a real value. 
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function dpfr(realVal : real) return natural is
   variable realVar       : real;
   variable ResultVar     : natural;
begin
   if (realVal < 0.0) then
      realVar := -realVal;
   else 
      realVar := realVal;
   end if;
   for loopVar in 1 to MAX_VECT_SIZE loop
      if (realVal = 0.0) then
         return 1;
      elsif (realVar < 10.0 and realVar >= 1.0) then
         return loopVar;
      else
         realVar := realVar/10.0; 
      end if;
   end loop;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : dpfslvr (decimal places for slv range)
--
-- DESCRIPTION     : This function returns a natural representing the
--                   number of decimal places the largest integer value that
--                   can be represented by a vector will occupy.
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function dpfslvr(vectorVal : std_logic_vector) return natural is
variable returnVar : std_logic_vector(vectorVal'length-1 downto 0) := (others => '1');
begin
   return dpfi(conv_integer(returnVar));
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : dpfslvv (decimal places for slv value) 
--
-- DESCRIPTION     : This function returns a natural representing the
--                   number of decimal places the integer value represented
--                   by a vector will occupy.
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function dpfslvv(vectorVal : std_logic_vector) return natural is
begin
   return dpfi(conv_integer(vectorVal));
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : eq
--
-- DESCRIPTION     : This function is an equality check function 
--                   that is sensitive to vector length
-- NOTES
--
------------------------------------------------------------------------------
function eq(vector1Val : std_logic_vector;
            vector2Val : std_logic_vector) return boolean is
   variable sl1Var      : std_logic;
   variable sl2Var      : std_logic;
   variable resultVar   : boolean;
   variable vector1Var  : std_logic_vector(vector1Val'length-1 downto 0);
   variable vector2Var  : std_logic_vector(vector2Val'length-1 downto 0);
begin
   resultVar  := true;
   vector1Var := vector1Val;
   vector2Var := vector2Val;
   if (vector1Var'high /= vector2Var'high) then -- check for length mismatch
      return false;
   end if;
   for loopVar in vector1Var'range loop
      if (vector1Var(loopVar) /= vector2Var(loopVar)) then
	      resultVar := false;
	   end if;
   end loop;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : ext2 (zero extend) 
--
-- DESCRIPTION     : This function returns a standard logic vector,
--                   padded with zeros, to the length specified by natVal
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function ext2(vectorVal : std_logic_vector;
              natVal    : natural) return std_logic_vector is
   variable vectorVar : slv (vectorVal'length - 1 downto 0);
   variable zeroVar   : slv (natVal - vectorVal'length - 1 downto 0) := (others => '0');
begin
   vectorVar := vectorVal;
   if (vectorVar'length >= natVal) then
      return vectorVar;
   else
      return zeroVar & vectorVar;
   end if; 
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : flip
--
-- DESCRIPTION     : This function returns a vector with all the bits
--                   in the vector flipped.
--                   i.e. if vectorval = 00011001
--                   flip(vectorval) returns 10011000
-- NOTES
--
------------------------------------------------------------------------------
function flip(vectorVal : bit_vector) return bit_vector is
   variable resultVar : bit_vector(vectorVal'range);
begin
   for loopVar in vectorVal'range loop
      resultVar(resultVar'high-loopVar) := vectorVal(loopVar);
   end loop;
   return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : flip
--
-- DESCRIPTION     : This function returns a vector with all the bits
--                   in the vector flipped.
--                   i.e. if vectorval = 00011001
--                   flip(vectorval) returns 10011000
-- NOTES
--
------------------------------------------------------------------------------
function flip(vectorVal : std_logic_vector) return std_logic_vector is
   variable resultVar : std_logic_vector(vectorVal'range);
begin
   for loopVar in vectorVal'range loop
      resultVar(resultVar'high-loopVar) := vectorVal(loopVar);
   end loop;
   return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : flip
--
-- DESCRIPTION     : This function returns a vector with all the bits
--                   in the vector flipped.
--                   i.e. if vectorval = 00011001
--                   flip(vectorval) returns 10011000
-- NOTES
--
------------------------------------------------------------------------------
function flip(vectorVal : std_ulogic_vector) return std_ulogic_vector is
   variable resultVar : std_ulogic_vector(vectorVal'range);
begin
   for loopVar in vectorVal'range loop
      resultVar(resultVar'high-loopVar) := vectorVal(loopVar);
   end loop;
   return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : hex_to_slv
--
-- DESCRIPTION     : This function converts a Hexadecimal value string
--                   of any length to a std_logic_vector
--
-- NOTES
--
-- "width mismatch" errors are due to improper sizing of the vector
-- that this function is assigned to
------------------------------------------------------------------------------
function hex_to_slv(stringVal : string) return std_logic_vector is
   variable stringVar        : string(1 to stringVal'length);
   variable resultVar        : std_logic_vector(4*stringVal'length downto 1);
   variable vectorParseVar   : character;
begin
   stringVar := stringVal;
   for loopVar in stringVar'range loop
      vectorParseVar := stringVar(loopVar);
      case vectorParseVar is
      when '0'       => resultVar(4*loopVar downto 4*loopvar-3) := x"0";
      when '1'       => resultVar(4*loopVar downto 4*loopvar-3) := x"1";
      when '2'       => resultVar(4*loopVar downto 4*loopvar-3) := x"2";
      when '3'       => resultVar(4*loopVar downto 4*loopvar-3) := x"3";
      when '4'       => resultVar(4*loopVar downto 4*loopvar-3) := x"4";
      when '5'       => resultVar(4*loopVar downto 4*loopvar-3) := x"5";
      when '6'       => resultVar(4*loopVar downto 4*loopvar-3) := x"6";
      when '7'       => resultVar(4*loopVar downto 4*loopvar-3) := x"7";
      when '8'       => resultVar(4*loopVar downto 4*loopvar-3) := x"8";
      when '9'       => resultVar(4*loopVar downto 4*loopvar-3) := x"9";
      when 'a' | 'A' => resultVar(4*loopVar downto 4*loopvar-3) := x"A";
      when 'b' | 'B' => resultVar(4*loopVar downto 4*loopvar-3) := x"B";
      when 'c' | 'C' => resultVar(4*loopVar downto 4*loopvar-3) := x"C";
      when 'd' | 'D' => resultVar(4*loopVar downto 4*loopvar-3) := x"D";
      when 'e' | 'E' => resultVar(4*loopVar downto 4*loopvar-3) := x"E";
      when 'f' | 'F' => resultVar(4*loopVar downto 4*loopvar-3) := x"F";
      when others =>
      end case;
   end loop;
   return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : int_to_slv (convert integer to std_logic_vector)
--
-- DESCRIPTION     : This function converts an integer value to a 
--                   std_logic_vector with a range just large enough
--                   to represent it
--
-- NOTES
--
------------------------------------------------------------------------------
function int_to_slv(intVal : integer) return std_logic_vector is
begin
   return conv_std_logic_vector(intVal,vlfi(intVal)); -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : itoa
--
-- DESCRIPTION     : commonly used integer-to-string type converter
--
-- NOTES
--
------------------------------------------------------------------------------
--function itoa(intVal : integer) return string is
--   variable IntVar : integer := intVal; 
--begin
--   if (IntVar < 0) then 
--      return "-" & itoa(-IntVar);
--   elsif IntVar < 10 then 
--      return IntString(IntVar);
--   else 
--      return itoa(IntVar/10) & IntString(IntVar rem 10);
--   end if;
--end function itoa;


function itoa(intVal : integer) return string is
begin
   return to_string(intVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : lfsr
--
-- DESCRIPTION     : returns the input for the next cycle of a
--                   Linear Feedback Shift Register (LFSR) 
--                   using a primitive polynomial. This version uses
--                   a Type 2 XOR feedback structure
--
-- NOTES: the output from this function is clocked into the input
--        registers of the LFSR. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with a non zero seed value to function.
--
--        http://en.wikipedia.org/wiki/LFSR
------------------------------------------------------------------------------
function lfsr(vectorVal : std_logic_vector) return std_logic_vector is
   type termArrayType is array (1 to 20) of integer;                                        -- supports up to 20 terms in a polynomial
   constant polynomialConst        : string := LFSR_Polynomial_Exponents(vectorVal'length); -- holds the string containing the exponent values (from highest to lowest power, separated by commas or + signs)
   variable seperatorLocationVar   : integer;                                               -- marks the location of the last exponent seperator
   variable polynomialParseVar     : character;                                             -- character value used to index through the polynomialVar string to look for seperators
   variable termQtyVar             : integer;                                               -- used to determine the number of terms in the polynomial
   variable vector1Var             : std_logic_vector(1 to vectorVal'length);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable vector2Var             : std_logic_vector(1 to vectorVal'length);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable tapFoundVar            : boolean;
   variable termArray              : termArrayType;
begin
   seperatorLocationVar := 1;
   tapFoundVar          := FALSE;
   termQtyVar           := 1;
   for loopVar in termArray'range loop
      termArray(loopVar)  := 0; -- initialize to 0s
   end loop;
   vector1Var       := vectorVal;
   vector2Var       := vector1Var;
   for loopVar in polynomialConst'range loop   -- this loop parses the polynomial string value passed from the Polynomial array from left to right and puts each exponent in the termArray and counts the number of exponents found
      polynomialParseVar := polynomialConst(loopVar);
      if (polynomialParseVar = ',' or polynomialParseVar = '+') then
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
         termQtyVar            := termQtyVar + 1;
      elsif (loopVar = polynomialConst'high) then -- this is the last term
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
      end if;
   end loop;
   vector2var(vector2var'low) := vector1Var(vector1Var'high);                                     -- highest power term alway wraps around to the input
   for outrLoopVar in 2 to vector2Var'high loop                                                   -- this loop determines the next value for the LFSR
      tapFoundVar := FALSE;
      for innrLoopVar in 2 to termQtyVar loop                                                     -- highest power term (termArray(1)) isn't needed below
         if (termArray(innrLoopVar) = outrLoopVar-1) then
            tapFoundVar := TRUE;
            vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1) xor vector1Var(vector1Var'high); -- xor in where a tap should be
         elsif (not tapFoundVar) then
            vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1);                                 -- if there's no tap then get the previous registers value
         end if;
      end loop;
   end loop;
   return vector2Var;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : lfsr
--
-- DESCRIPTION     : returns the input for the next cycle of a
--                   Linear Feedback Shift Register (LFSR) 
--                   using a primitive polynomial
--
-- NOTES: the output from this function is clocked into the input
--        registers of the LFSR. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with a non zero seed value to function.
--
--        http://en.wikipedia.org/wiki/LFSR
------------------------------------------------------------------------------
function lfsr(vectorVal       : std_logic_vector;
              feedBackTypeVal : string;
              xorTypeVal      : string) return std_logic_vector is
   type termArrayType is array (1 to 20) of integer;                                        -- supports up to 20 terms in a polynomial
   constant polynomialConst        : string := LFSR_Polynomial_Exponents(vectorVal'length); -- holds the string containing the exponent values (from highest to lowest power, separated by commas or + signs)
   variable seperatorLocationVar   : integer;                                               -- marks the location of the last exponent seperator
   variable polynomialParseVar     : character;                                             -- character value used to index through the polynomialVar string to look for seperators
   variable tapFoundVar            : boolean;
   variable termQtyVar             : integer;                                               -- used to determine the number of terms in the polynomial
   variable vector1Var             : std_logic_vector(1 to vectorVal'length);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable vector2Var             : std_logic_vector(1 to vectorVal'length);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable termArray              : termArrayType;
begin
   seperatorLocationVar := 1;
   tapFoundVar          := FALSE;
   termQtyVar           := 1;
   for loopVar in termArray'range loop
      termArray(loopVar)  := 0; -- initialize to 0s
   end loop;
   vector1Var       := vectorVal;
   vector2Var       := vector1Var;
   for loopVar in polynomialConst'range loop   -- this loop parses the polynomial string value passed from the Polynomial array from left to right and puts each exponent in the termArray and counts the number of exponents found
      polynomialParseVar := polynomialConst(loopVar);
      if (polynomialParseVar = ',' or polynomialParseVar = '+') then
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
         termQtyVar            := termQtyVar + 1;
      elsif (loopVar = polynomialConst'high) then -- this is the last term
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
      end if;
   end loop;
   if (feedBackTypeVal = "Type 1" or feedBackTypeVal = "type 1") then -- Type 1 feedback (Fibonacci) (many output to one input)
      if (xorTypeVal = "XNOR" or xorTypeVal = "xnor") then -- determine the value that the LFSR will have
         vector2Var(vector2Var'low) := '1';
         for loopVar in 1 to termQtyVar loop  -- this loop determines the next input value for a Type 1 LFSR
            vector2Var(vector2Var'low) := not (vector1Var(termArray(loopVar)) xor vector2Var(vector2Var'low));
         end loop;
         vector2Var := vector2Var(vector2Var'low) & vector1Var(vector1Var'low to vector1Var'high-1);
      else
         vector2Var(vector2Var'low) := '0';
         for loopVar in 1 to termQtyVar loop  -- this loop determines the next input value for a Type 1 LFSR
            vector2Var(vector2Var'low) := vector1Var(termArray(loopVar)) xor vector2Var(vector2Var'low);
         end loop;
         vector2Var := vector2Var(vector2Var'low) & vector1Var(vector1Var'low to vector1Var'high-1);
      end if;
   else -- Type 2 feedback (Galois) (one output to many inputs)
      if (xorTypeVal = "XNOR" or xorTypeVal = "xnor") then
         vector2var(vector2var'low) := vector1Var(vector1Var'high);                                           -- highest power term alway wraps around to the input
         for outrLoopVar in 2 to vector2Var'high loop                                                         -- this loop determines the next value for the LFSR
            tapFoundVar := FALSE;
            for innrLoopVar in 2 to termQtyVar loop                                                           -- highest power term (termArray(1)) isn't needed below
               if (termArray(innrLoopVar) = outrLoopVar-1) then
                  tapFoundVar := TRUE;
                  vector2Var(outrLoopVar) := not (vector1Var(outrLoopVar-1) xor vector1Var(vector1Var'high)); -- xor in where a tap should be
               elsif (not tapFoundVar) then
                  vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1);                                       -- if there's no tap then get the previous registers value
               end if;
            end loop;
         end loop;
      else
         vector2var(vector2var'low) := vector1Var(vector1Var'high);                                           -- highest power term alway wraps around to the input
         for outrLoopVar in 2 to vector2Var'high loop                                                         -- this loop determines the next value for the LFSR
            tapFoundVar := FALSE;
            for innrLoopVar in 2 to termQtyVar loop                                                           -- highest power term (termArray(1)) isn't needed below
               if (termArray(innrLoopVar) = outrLoopVar-1) then
                  tapFoundVar := TRUE;
                  vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1) xor vector1Var(vector1Var'high);       -- xor in where a tap should be
               elsif (not tapFoundVar) then
                  vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1);                                       -- if there's no tap then get the previous registers value
               end if;
            end loop;
         end loop;
      end if;
   end if;
   return vector2Var;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : lfsr
--
-- DESCRIPTION     : returns the input for the next cycle of a
--                   Linear Feedback Shift Register (LFSR) 
--                   using a primitive polynomial
--
-- NOTES: the output from this function is clocked into the input
--        registers of the LFSR. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with a non zero seed value to function.
--
--        http://en.wikipedia.org/wiki/LFSR
------------------------------------------------------------------------------
function lfsr(vectorVal        : std_logic_vector;
              polynomialStrVal : string;
              feedBackTypeVal  : string;
              xorTypeVal       : string) return std_logic_vector is
   type termArrayType is array (1 to 20) of integer;                                        -- supports up to 20 terms in a polynomial
   constant polynomialConst        : string := polynomialStrVal;                            -- holds the string containing the exponent values (from highest to lowest power, separated by commas or + signs)
   variable seperatorLocationVar   : integer;                                               -- marks the location of the last exponent seperator
   variable polynomialParseVar     : character;                                             -- character value used to index through the polynomialVar string to look for seperators
   variable tapFoundVar            : boolean;
   variable termQtyVar             : integer;                                               -- used to determine the number of terms in the polynomial
   variable vector1Var             : std_logic_vector(1 to vectorVal'length);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable vector2Var             : std_logic_vector(1 to vectorVal'length);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable termArray              : termArrayType;
begin
   seperatorLocationVar := 1;
   tapFoundVar          := FALSE;
   termQtyVar           := 1;
   for loopVar in termArray'range loop
      termArray(loopVar)  := 0; -- initialize to 0s
   end loop;
   vector1Var       := vectorVal;
   vector2Var       := vector1Var;
   for loopVar in polynomialConst'range loop   -- this loop parses the polynomial string value passed from the Polynomial array from left to right and puts each exponent in the termArray and counts the number of exponents found
      polynomialParseVar := polynomialConst(loopVar);
      if (polynomialParseVar = ',' or polynomialParseVar = '+') then
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
         termQtyVar            := termQtyVar + 1;
      elsif (loopVar = polynomialConst'high) then -- this is the last term
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
      end if;
   end loop;
   if (feedBackTypeVal = "Type 1" or feedBackTypeVal = "type 1") then -- Type 1 feedback (Fibonacci) (many output to one input)
      if (xorTypeVal = "XNOR" or xorTypeVal = "xnor") then -- determine the value that the LFSR will have
         vector2Var(vector2Var'low) := '1';
         for loopVar in 1 to termQtyVar loop  -- this loop determines the next input value for a Type 1 LFSR
            vector2Var(vector2Var'low) := not (vector1Var(termArray(loopVar)) xor vector2Var(vector2Var'low));
         end loop;
         vector2Var := vector2Var(vector2Var'low) & vector1Var(vector1Var'low to vector1Var'high-1);
      else
         vector2Var(vector2Var'low) := '0';
         for loopVar in 1 to termQtyVar loop  -- this loop determines the next input value for a Type 1 LFSR
            vector2Var(vector2Var'low) := vector1Var(termArray(loopVar)) xor vector2Var(vector2Var'low);
         end loop;
         vector2Var := vector2Var(vector2Var'low) & vector1Var(vector1Var'low to vector1Var'high-1);
      end if;
   else -- Type 2 feedback (Galois) (one output to many inputs)
      if (xorTypeVal = "XNOR" or xorTypeVal = "xnor") then
         vector2var(vector2var'low) := vector1Var(vector1Var'high);                                           -- highest power term alway wraps around to the input
         for outrLoopVar in 2 to vector2Var'high loop                                                         -- this loop determines the next value for the LFSR
            tapFoundVar := FALSE;
            for innrLoopVar in 2 to termQtyVar loop                                                           -- highest power term (termArray(1)) isn't needed below
               if (termArray(innrLoopVar) = outrLoopVar-1) then
                  tapFoundVar := TRUE;
                  vector2Var(outrLoopVar) := not (vector1Var(outrLoopVar-1) xor vector1Var(vector1Var'high)); -- xor in where a tap should be
               elsif (not tapFoundVar) then
                  vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1);                                       -- if there's no tap then get the previous registers value
               end if;
            end loop;
         end loop;
      else
         vector2var(vector2var'low) := vector1Var(vector1Var'high);                                           -- highest power term alway wraps around to the input
         for outrLoopVar in 2 to vector2Var'high loop                                                         -- this loop determines the next value for the LFSR
            tapFoundVar := FALSE;
            for innrLoopVar in 2 to termQtyVar loop                                                           -- highest power term (termArray(1)) isn't needed below
               if (termArray(innrLoopVar) = outrLoopVar-1) then
                  tapFoundVar := TRUE;
                  vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1) xor vector1Var(vector1Var'high);       -- xor in where a tap should be
               elsif (not tapFoundVar) then
                  vector2Var(outrLoopVar) := vector1Var(outrLoopVar-1);                                       -- if there's no tap then get the previous registers value
               end if;
            end loop;
         end loop;
      end if;
   end if;
   return vector2Var;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : lfsr_cft
--
-- DESCRIPTION     : returns the value of a Type 2
--                   Linear Feedback Shift Register (LFSR) 
--                   after the amount
--                   of time specified using the frequency (or period)
--                   value passed as a reference
--
-- NOTES: the output from this function is shifted into the input
--        of the LFSR which is the MSB. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with ones to function.  
--
-- TIP:   Avoid calling functions inside of loops.
--
--        http://en.wikipedia.org/wiki/LFSR
--
--   2**(2*latency -1) = Maximum LFSR width for a given pipeline
--   comparator latency value
--
------------------------------------------------------------------------------
function lfsr_cft(timeStrVal : string;
                  freqStrVal : string) return std_logic_vector is
   -- synopsys translate_off
   constant OUTPUT_FILE  : string := "../lfsr_cft_function_logfile.txt";
   variable LogFileLine  : line;
   file     LogFile      : text open write_mode is OUTPUT_FILE;
   -- synopsys translate_on
   type termArrayType is array (1 to 20) of integer;                                                      -- supports up to 20 terms in a polynomial
   constant polynomialConst        : string := LFSR_Polynomial_Exponents(cufth(timeStrVal,freqStrVal)+1); -- holds the string containing the exponent values (from highest to lowest power, separated by commas or + signs)
   variable countDoneVar           : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);             -- stop value for counter used to determine when the loop which computes the lfsr stop value should stop looping
   variable countVar               : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);             -- counter counter used to determine when the loop which computes the lfsr stop value should stop looping
   variable latencyVar             : integer;                                                             -- subtract out the latency of the pipelined comparison
   variable loopEnableVar          : boolean;
   variable polynomialParseVar     : character;                                                           -- character value used to index through the polynomialVar string to look for seperators
   variable seedVar                : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);
   variable seperatorLocationVar   : integer;                                                             -- marks the location of the last exponent seperator
   variable stopVar                : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);
   variable tapFoundVar            : boolean;
   variable termArray              : termArrayType;
   variable termQtyVar             : integer;                                                             -- used to determine the number of terms in the polynomial
   variable vector1Var             : std_logic_vector(1 to cufth(timeStrVal,freqStrVal)+1);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable vector2Var             : std_logic_vector(1 to cufth(timeStrVal,freqStrVal)+1);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable xorMaskVar             : std_logic_vector(1 to cufth(timeStrVal,freqStrVal)+1);               -- holds the xor feedback variable
begin
   -- initialize all variables
   countDoneVar         := cuft(timeStrVal,freqStrVal);
   countVar             := (others => '0');
   latencyVar           := 1;
   loopEnableVar        := TRUE;
   seedVar              := (others => '1');
   seperatorLocationVar := 1;
   stopVar              := (others => '1');
   tapFoundVar          := FALSE;
   for loopVar in termArray'range loop
      termArray(loopVar)  := 0; -- initialize to 0s
   end loop;
   termQtyVar           := 1;
   vector1Var           := seedVar;
   vector2Var           := seedVar;
   xorMaskVar           := (others => '0');
   polynomial_string_parser : for loopVar in polynomialConst'range loop   -- this loop parses the polynomial string value passed from the Polynomial array from left to right and puts each exponent in the termArray and counts the number of exponents found
      polynomialParseVar := polynomialConst(loopVar);
      if (polynomialParseVar = ',' or polynomialParseVar = '+') then      -- commas or '+' signs can be used as seperators for the exponents
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
         termQtyVar            := termQtyVar + 1;
      elsif (loopVar = polynomialConst'high) then                         -- this is the last term
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
      end if;
   end loop polynomial_string_parser;
   xor_vector_computer : for outrLoopVar in xorMaskVar'range loop         -- compute the value that the xor vector should have to make an LFSR with a given polynomial
      for innrLoopVar in 1 to termQtyVar loop
         if (termArray(innrLoopVar) = outrLoopVar) then
            xorMaskVar(outrLoopVar) := '1';
         end if;
      end loop;
   end loop xor_vector_computer;
   xorMaskVar := '0' & xorMaskVar(1 to xorMaskVar'high-1);                -- shift taps for Type 2 (Galois) feedback, no XOR off of the top
   stop_value_comparator_latency_computer : while loopEnableVar loop      -- compute the expected latency for a pipelined stop value comparator
      if (2**(2*latencyVar - 1) > seedVar'length) then   
         countDoneVar  := countDoneVar - int_to_slv(latencyVar);          -- compute the new stop value with the pipelined comparator latency taken into account
         loopEnableVar := FALSE;
      end if;
      latencyVar := latencyVar + 1;
   end loop stop_value_comparator_latency_computer;   
   loopEnableVar := TRUE;
   stop_value_computer : while loopEnableVar loop
      if (vector1Var(vector1Var'high) = '1' and loopEnableVar) then
         countVar   := countVar + 1;
         vector2Var := (vector1Var(vector1Var'high) & vector1Var(1 to vector1Var'high-1)) xor xorMaskVar;
         vector1Var := vector2Var;
      elsif (loopEnableVar) then
         countVar   := countVar + 1;
         vector2Var := vector1Var(vector1Var'high) & vector1Var(1 to vector1Var'high-1);
         vector1Var := vector2Var;
      end if;
      if (countVar = countDoneVar) then
         loopEnableVar := FALSE;
      end if;
   end loop stop_value_computer;
   stopVar := vector2Var;

   -- synopsys translate_off
   write(LogFileLine,
          "polynomialConst       : " & to_string(cufth(timeStrVal,freqStrVal)+1) & LF &
          "exponent values       : " & polynomialConst & LF & 
          "xorMaskVar value      : " & to_string(xorMaskVar) & LF & 
          "LFSR count time       : " & timeStrVal & LF &
          "reference time/period : " & freqStrVal & LF &
          "comparator latency    : " & to_string(latencyVar) & LF &
          "# of clock cycles     : " & to_string(to_int(countDoneVar)) & LF &
          "LFSR length           : " & to_string(stopVar'length) & LF &
          "LFSR stop value       : " & to_string(stopVar)
          );
   writeLine(LogFile,LogFileLine);
   assert FALSE
   report "polynomialConst       : " & to_string(cufth(timeStrVal,freqStrVal)+1) & LF &
          "exponent values       : " & polynomialConst & LF &
          "xorMaskVar value      : " & to_string(xorMaskVar) & LF &
          "LFSR count time       : " & timeStrVal & LF &
          "reference time/period : " & freqStrVal & LF &
          "comparator latency    : " & to_string(latencyVar) & LF &
          "# of clock cycles     : " & to_string(to_int(countDoneVar)) & LF &
          "LFSR length           : " & to_string(stopVar'length) & LF &
          "LFSR stop value       : " & to_string(stopVar)
   severity note;
   -- synopsys translate_on

   return stopVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : lfsr_cft
--
-- DESCRIPTION     : returns the value of a Type 2
--                   Linear Feedback Shift Register (LFSR) 
--                   after the amount
--                   of time specified using the frequency (or period)
--                   value passed as a reference and the seed value
--                   passed as a starting point
--
-- NOTES: the output from this function is shifted into the input
--        of the LFSR which is the MSB. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with a non zero seed value to function.
--
--        http://en.wikipedia.org/wiki/LFSR
--
--   2**(2*latency -1) = Maximum LFSR width for a given pipeline
--   comparator latency value
--
------------------------------------------------------------------------------
function lfsr_cft(timeStrVal      : string;
                  freqStrVal      : string;
                  seedVal         : std_logic_vector;
                  feedBackTypeVal : string;
                  xorTypeVal      : string) return std_logic_vector is
   -- synopsys translate_off
   constant OUTPUT_FILE  : string := "../lfsr_cft_parameterized_function_logfile.txt";
   variable LogFileLine  : line;
   file     LogFile      : text open write_mode is OUTPUT_FILE;
   -- synopsys translate_on
   type termArrayType is array (1 to 20) of integer;                                                      -- supports up to 20 terms in a polynomial
   constant polynomialConst        : string := LFSR_Polynomial_Exponents(cufth(timeStrVal,freqStrVal)+1); -- holds the string containing the exponent values (from highest to lowest power, separated by commas or + signs)
   variable countDoneVar           : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);             -- stop value for counter used to determine when the loop which computes the lfsr stop value should stop looping
   variable countVar               : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);             -- counter counter used to determine when the loop which computes the lfsr stop value should stop looping
   variable latencyVar             : integer;                                                             -- subtract out the latency of the pipelined comparison
   variable loopEnableVar          : boolean;
   variable polynomialParseVar     : character;                                                           -- character value used to index through the polynomialVar string to look for seperators
   variable seedVar                : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);
   variable seperatorLocationVar   : integer;                                                             -- marks the location of the last exponent seperator
   variable stopVar                : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);
   variable tapFoundVar            : boolean;
   variable termArray              : termArrayType;
   variable termQtyVar             : integer;                                                             -- used to determine the number of terms in the polynomial
   variable vector1Var             : std_logic_vector(1 to cufth(timeStrVal,freqStrVal)+1);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable vector2Var             : std_logic_vector(1 to cufth(timeStrVal,freqStrVal)+1);               -- LFSRs are usually depicted shifting left to right with the right being the MSB
   variable xorMaskVar             : std_logic_vector(1 to cufth(timeStrVal,freqStrVal)+1);               -- holds the xor feedback variable
begin
   -- initialize all variables
   countDoneVar         := cuft(timeStrVal,freqStrVal);
   countVar             := (others => '0');
   latencyVar           := 1;
   loopEnableVar        := TRUE;
   seedVar              := ext(seedVal,seedVar'length);
   seperatorLocationVar := 1;
   stopVar              := (others => '1');
   tapFoundVar          := FALSE;
   for loopVar in termArray'range loop
      termArray(loopVar)  := 0; -- initialize to 0s
   end loop;
   termQtyVar           := 1;
   vector1Var           := seedVar;
   vector2Var           := seedVar;
   xorMaskVar           := (others => '0');
   polynomial_string_parser : for loopVar in polynomialConst'range loop   -- this loop parses the polynomial string value passed from the Polynomial array from left to right and puts each exponent in the termArray and counts the number of exponents found
      polynomialParseVar := polynomialConst(loopVar);
      if (polynomialParseVar = ',' or polynomialParseVar = '+') then      -- commas or '+' signs can be used as seperators for the exponents
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
         termQtyVar            := termQtyVar + 1;
      elsif (loopVar = polynomialConst'high) then                         -- this is the last term
         termArray(termQtyVar) := str_to_int(polynomialConst(seperatorLocationVar to loopVar));
         seperatorLocationVar  := loopVar;
      end if;
   end loop polynomial_string_parser;
   xor_vector_computer : for outrLoopVar in xorMaskVar'range loop         -- compute the value that the xor vector should have to make an LFSR with a given polynomial
      for innrLoopVar in 1 to termQtyVar loop
         if (termArray(innrLoopVar) = outrLoopVar) then
            xorMaskVar(outrLoopVar) := '1';
         end if;
      end loop;
   end loop xor_vector_computer;
   stop_value_comparator_latency_computer : while loopEnableVar loop      -- compute the expected latency for a pipelined stop value comparator
      if (2**(2*latencyVar - 1) > seedVar'length) then   
         countDoneVar  := countDoneVar - int_to_slv(latencyVar);          -- compute the new stop value with the pipelined comparator latency taken into account
         loopEnableVar := FALSE;
      end if;
      latencyVar := latencyVar + 1;
   end loop stop_value_comparator_latency_computer;
   loopEnableVar := TRUE;
   
   if (feedBackTypeVal = "Type 1" or feedBackTypeVal = "type 1") then     -- Type 1 feedback (Fibonacci) (many output to one input)
      if (xorTypeVal = "XNOR" or xorTypeVal = "Xnor" or xorTypeVal = "xnor") then
         type1_xnor_stop_value_computer : while loopEnableVar loop
            if loopEnableVar then
               countVar   := countVar + 1;
               vector2Var := xnor_reduce(vector1Var and xorMaskvar) & vector1Var(1 to vector1Var'high-1);  -- shift right and apply xnor
               vector1Var := vector2Var;
            end if;
            if (countVar = countDoneVar) then
               loopEnableVar := FALSE;
            end if;
         end loop type1_xnor_stop_value_computer;
      else                                                                
         type1_xor_stop_value_computer : while loopEnableVar loop
            if loopEnableVar then
               countVar   := countVar + 1;
               vector2Var := xor_reduce(vector1Var and xorMaskvar) & vector1Var(1 to vector1Var'high-1);  -- shift right and apply xnor
               vector1Var := vector2Var;
            end if;
            if (countVar = countDoneVar) then
               loopEnableVar := FALSE;
            end if;
         end loop type1_xor_stop_value_computer;
      end if;
   else                                                                   -- Type 2 feedback (Galois) (one output to many inputs)
      if (xorTypeVal = "XNOR" or xorTypeVal = "Xnor" or xorTypeVal = "xnor") then
         type2_xnor_stop_value_computer : while loopEnableVar loop
            if (vector1Var(vector1Var'high) = '1' and loopEnableVar) then
               countVar   := countVar + 1;
               vector2Var := not ((vector1Var(vector1Var'high) & vector1Var(1 to vector1Var'high-1)) xor not(xorMaskVar));  -- shift right and apply xnor 
               vector1Var := vector2Var;
            elsif (loopEnableVar) then
               countVar   := countVar + 1;
               vector2Var := vector1Var(vector1Var'high) & vector1Var(1 to vector1Var'high-1);
               vector1Var := vector2Var;
            end if;
            if (countVar = countDoneVar) then
               loopEnableVar := FALSE;
            end if;
         end loop type2_xnor_stop_value_computer;
      else
         type2_xor_stop_value_computer : while loopEnableVar loop
            if (vector1Var(vector1Var'high) = '1' and loopEnableVar) then
               countVar   := countVar + 1;
               vector2Var := (vector1Var(vector1Var'high) & vector1Var(1 to vector1Var'high-1)) xor xorMaskVar;  -- shift right and apply xor
               vector1Var := vector2Var;
            elsif (loopEnableVar) then
               countVar   := countVar + 1;
               vector2Var := vector1Var(vector1Var'high) & vector1Var(1 to vector1Var'high-1);
               vector1Var := vector2Var;
            end if;
            if (countVar = countDoneVar) then
               loopEnableVar := FALSE;
            end if;
         end loop type2_xor_stop_value_computer;
      end if;
   end if;
   
   stopVar := vector2Var;
   
   -- synopsys translate_off
   write(LogFileLine,
          "polynomialConst       : " & to_string(cufth(timeStrVal,freqStrVal)+1) & LF &
          "exponent values       : " & polynomialConst & LF & 
          "xorMaskVar value      : " & to_string(xorMaskVar) & LF & 
          "LFSR count time       : " & timeStrVal & LF &
          "reference time/period : " & freqStrVal & LF &
          "comparator latency    : " & to_string(latencyVar) & LF &
          "# of clock cycles     : " & to_string(to_int(countDoneVar)) & LF &
          "LFSR length           : " & to_string(stopVar'length) & LF &
          "LFSR stop value       : " & to_string(stopVar)
          );
   writeLine(LogFile,LogFileLine);
   assert FALSE
   report "polynomialConst       : " & to_string(cufth(timeStrVal,freqStrVal)+1) & LF &
          "exponent values       : " & polynomialConst & LF &
          "xorMaskVar value      : " & to_string(xorMaskVar) & LF &
          "LFSR count time       : " & timeStrVal & LF &
          "reference time/period : " & freqStrVal & LF &
          "comparator latency    : " & to_string(latencyVar) & LF &
          "# of clock cycles     : " & to_string(to_int(countDoneVar)) & LF &
          "LFSR length           : " & to_string(stopVar'length) & LF &
          "LFSR stop value       : " & to_string(stopVar)
   severity note;
   -- synopsys translate_on
   
   return stopVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : lfsr_cfth
--
-- DESCRIPTION     : repackaging of cufth for lfsr use
--
-- NOTES: the output from this function is shifted into the input
--        of the LFSR which is the MSB. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with ones to function.
--
--        http://en.wikipedia.org/wiki/LFSR
--
--   2**(2*latency -1) = Maximum LFSR width for a given pipeline
--   comparator latency value
--
------------------------------------------------------------------------------
function lfsr_cfth(timeStrVal : string;
                   freqStrVal : string) return integer is
begin
   return cufth(timeStrVal,freqStrVal);
end function;     


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : lfsr_cft_latency
--
-- DESCRIPTION     : returns the register compare latency neede for 
--                   a Type 2
--                   Linear Feedback Shift Register (LFSR) 
--                   after the amount
--                   of time specified using the frequency (or period)
--                   value passed as a reference
--
-- NOTES: the output from this function is shifted into the input
--        of the LFSR which is the MSB. The LFSR is shifted
--        to the right, MSB to LSB, with each clock.  The LFSR
--        must be pre-loaded with a non zero seed value to function.
--
--        http://en.wikipedia.org/wiki/LFSR
--
--   2**(2*latency -1) = Maximum LFSR width for a given pipeline
--   comparator latency value
--
------------------------------------------------------------------------------
function lfsr_cft_latency(timeStrVal : string;
                          freqStrVal : string) return integer is
   variable latencyVar    : integer; -- subtract out the latency of the pipelined comparison
   variable loopVar       : boolean;
   variable seedVar       : std_logic_vector(cufth(timeStrVal,freqStrVal) downto 0);
begin
   latencyVar    := 1;
   loopVar       := TRUE;
   seedVar       := (others => '1');
   while loopVar loop
      if (2**(2*latencyVar - 1) > seedVar'length) then
         loopVar := FALSE;
      end if;
      latencyVar := latencyVar + 1;
   end loop;   
   return latencyVar;
end function;  


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : max
--
-- DESCRIPTION     : This function returns the greater of the two values
--                   passed.
--
-- NOTES           : 
------------------------------------------------------------------------------
function max(int1Val : integer;
             int2Val : integer) return integer is
begin
   if (int1Val > int2Val) then
      return int1Val;
   else
      return int2Val;
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : mult_s
--
-- DESCRIPTION     : This function multiplies a signed std_logic vector
--                   value by another signed std_logic_vector value
--
-- NOTES           : This function is provided for in std_logic_arith
------------------------------------------------------------------------------
function mult_s(Multiplier    : std_logic_vector; 
                Multiplicand  : std_logic_vector) return std_logic_vector is
   variable negVar          : std_logic;
   variable multiplicandVar : std_logic_vector(Multiplicand'length-1 downto 0);
   variable multiplierVar   : std_logic_vector(Multiplier'length+Multiplicand'length-1 downto 0);
   variable resultVar       : std_logic_vector(Multiplier'length+Multiplicand'length-1 downto 0);
begin
   multiplicandVar := abs(multiplicand);
   multiplierVar   := ext(abs(Multiplier),multiplierVar'length);
   negVar          := multiplier(multiplier'left) xor multiplicand(multiplicand'left);
   resultVar       := (others => '0');
   for loopVar in multiplicandVar'reverse_range loop
      if (multiplicandVar(loopVar) = '1') then
         resultVar := resultVar + multiplierVar;
      end if;
      multiplierVar := multiplierVar(multiplierVar'high-1 downto 0) & '0';
   end loop;
   if (negVar = '1') then
      return neg(resultVar);
   else
      return resultVar;
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : mult_us
--
-- DESCRIPTION     : This function multiplies an unsigned std_logic vector
--                   value by another unsigned std_logic_vector value
--
-- NOTES           : This function is provided for in std_logic_arith
------------------------------------------------------------------------------
function mult_us(Multiplier    : std_logic_vector; 
                 Multiplicand  : std_logic_vector) return std_logic_vector is
   variable multiplicandVar : std_logic_vector(Multiplicand'length-1 downto 0);
   variable multiplierVar   : std_logic_vector(Multiplier'length+Multiplicand'length-1 downto 0);
   variable resultVar       : std_logic_vector(Multiplier'length+Multiplicand'length-1 downto 0);
begin
   multiplicandVar := multiplicand;
   multiplierVar   := ext(Multiplier,multiplierVar'length);
   resultVar       := (others => '0');
   for loopVar in multiplicandVar'reverse_range loop
      if (multiplicandVar(loopVar) = '1') then
         resultVar := resultVar + multiplierVar;
      end if;
      multiplierVar := multiplierVar(multiplierVar'high-1 downto 0) & '0';
   end loop;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : nat_to_slv (convert natural to std_logic_vector)
--
-- DESCRIPTION     : This function converts a natural value to a 
--                   std_logic_vector with a range just large enough
--                   to represent it
--
-- NOTES
--
------------------------------------------------------------------------------
function nat_to_slv(natVal : natural) return std_logic_vector is
begin
   return conv_std_logic_vector(natVal,vlfn(natVal));
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : neg
--
-- DESCRIPTION     : This function toggles the sign of the value passed
--
-- NOTES           : 
--
------------------------------------------------------------------------------
function neg(VectorVal : std_logic_vector) return std_logic_vector is
   variable oneFndVar : boolean;
   variable resultVar : std_logic_vector(VectorVal'length-1 downto 0);
begin
   oneFndVar := false;
   resultVar := VectorVal;
   resultVar := not resultVar;    -- invert all bits
   resultVar := resultVar + '1';  -- then add one
   return ResultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : now
--
-- DESCRIPTION     : This function returns a string representation
--                   of the current simulation time
--
-- NOTES           : 
--
------------------------------------------------------------------------------
-- synopsys translate_off
impure function now return string is
   variable lineVar    : line;
   variable resultVar  : string(1 to time'image(now)'length);
begin
   --Std.TextIO.Write(lineVar, vectorVal);
   Write(lineVar, time'image(now));
   resultVar(lineVar.all'range) := lineVar.all;
   deallocate(lineVar);
   return resultVar;
end function;
-- synopsys translate_on


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : reduce
--
-- DESCRIPTION     : This function returns a vector with the extra sign
--                   bits removed
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function reduce(vectorVal : std_logic_vector) return std_logic_vector is
   variable lengthVar  : integer;
   variable MSBFound   : boolean;
   variable resultVar  : std_logic_vector(vectorVal'length-1 downto 0);
begin
   resultVar  := vectorVal;
   lengthVar  := 0;
   MSBFound   := False;
   for loopVar in resultVar'range loop                                             -- start at the MSB of the vector and index down
      if (((resultVar(resultVar'high) = '0' and resultVar(loopVar) = '1') or       -- if it's a positive value then look for a bit to be '1'
          (resultVar(resultVar'high) = '1' and resultVar(loopVar) = '0')) and      -- or if it's a negative value look for a bit to be '0'
          (MSBFound = False))                                                      -- and the MSB hasn't been found yet
      then                                                                         -- and if a bit is asserted then
         lengthVar := loopVar;                                                     -- this is the minimum number of bits needed to represent the absolute value. 
         MSBFound  := True;
      end if;
   end loop;
   lengthVar := lengthVar + 1;                                                     -- And add one for the sign bit
   return resultVar(lengthVar downto 0); -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : reduce_high
--
-- DESCRIPTION     : This function returns an integer value representing
--                   the vector'high value of a sign bit reduced vector
-- 
-- NOTES           : This function assumes that vectorVal'low = '0'
--                   
--
------------------------------------------------------------------------------
function reduce_high(vectorVal : std_logic_vector) return integer is
   variable interimVar : std_logic_vector(vectorVal'length-1 downto 0);
   variable lengthVar  : integer;
   variable MSBFound   : boolean;
   variable resultVar  : std_logic_vector(MAX_VECT_SIZE downto 0);
begin
   interimVar := vectorVal;
   lengthVar  := 0;
   MSBFound   := False;
   resultVar  := sxt(interimVar,resultVar'length);                                 -- sign extend the value passed to the size of the slv variable
   for loopVar in resultVar'range loop                                             -- start at the MSB of the vector and index down
      if (((resultVar(resultVar'high) = '0' and resultVar(loopVar) = '1') or       -- if it's a positive value then look for a bit to be '1'
          (resultVar(resultVar'high) = '1' and resultVar(loopVar) = '0')) and      -- or if it's a negative value look for a bit to be '0'
          (MSBFound = False))                                                      -- and the MSB hasn't been found yet
      then                                                                         -- and if a bit is asserted then
         lengthVar := loopVar + 1;                                                 -- this is the minimum number of bits needed to represent the absolute value.  And then add one for the sign bit
 	      MSBFound  := True;
      end if;
   end loop;
   return lengthVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : reduce_high_unsigned
--
-- DESCRIPTION     : This function returns an integer value representing
--                   the vector'high value of a sign bit reduced vector
-- 
-- NOTES           : This function assumes that vectorVal'low = '0'
--                   
--
------------------------------------------------------------------------------
function reduce_high_unsigned(vectorVal : std_logic_vector) return integer is
   variable interimVar : std_logic_vector(vectorVal'length-1 downto 0);
   variable lengthVar  : integer;
   variable MSBFound   : boolean;
   variable resultVar  : std_logic_vector(MAX_VECT_SIZE downto 0);
begin
   interimVar := vectorVal;
   lengthVar  := 0;
   MSBFound   := False;
   resultVar  := sxt(interimVar,resultVar'length);                                 -- sign extend the value passed to the size of the slv variable
   for loopVar in resultVar'range loop                                             -- start at the MSB of the vector and index down
      if (((resultVar(resultVar'high) = '0' and resultVar(loopVar) = '1') or       -- if it's a positive value then look for a bit to be '1'
          (resultVar(resultVar'high) = '1' and resultVar(loopVar) = '0')) and      -- or if it's a negative value look for a bit to be '0'
          (MSBFound = False))                                                      -- and the MSB hasn't been found yet
      then                                                                         -- and if a bit is asserted then
         lengthVar := loopVar;                                                     -- this is the minimum number of bits needed to represent the absolute value.
 	      MSBFound  := True;
      end if;
   end loop;
   return lengthVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : reduce_length
--
-- DESCRIPTION     : This function returns an integer value representing
--                   the length of a sign bit reduced vector
-- 
-- NOTES           : This function assumes that vectorVal'low = '0'
--
------------------------------------------------------------------------------
function reduce_length(vectorVal : std_logic_vector) return integer is
begin
   return reduce_high(vectorVal) + 1;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : reduce_length_unsigned
--
-- DESCRIPTION     : This function returns an integer value representing
--                   the length of a sign bit reduced vector
-- 
-- NOTES           : This function assumes that vectorVal'low = '0'
--
------------------------------------------------------------------------------
function reduce_length_unsigned(vectorVal : std_logic_vector) return integer is
begin
   return reduce_high_unsigned(vectorVal) + 1;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : reduce_unsigned
--
-- DESCRIPTION     : This function returns a vector with all sign
--                   bits removed
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function reduce_unsigned(vectorVal : std_logic_vector) return std_logic_vector is
   variable lengthVar  : integer;
   variable MSBFound   : boolean;
   variable resultVar  : std_logic_vector(vectorVal'length-1 downto 0);
begin
   resultVar  := vectorVal;
   lengthVar  := 0;
   MSBFound   := False;
   for loopVar in resultVar'range loop                                             -- start at the MSB of the vector and index down
      if (((resultVar(resultVar'high) = '0' and resultVar(loopVar) = '1') or       -- if it's a positive value then look for a bit to be '1'
          (resultVar(resultVar'high) = '1' and resultVar(loopVar) = '0')) and      -- or if it's a negative value look for a bit to be '0'
          (MSBFound = False))                                                      -- and the MSB hasn't been found yet
      then                                                                         -- and if a bit is asserted then
         lengthVar := loopVar;                                                     -- this is the minimum number of bits needed to represent the absolute value.
         MSBFound  := True;
      end if;
   end loop;
   return resultVar(lengthVar downto 0); -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : seq (string equality function)
--
-- DESCRIPTION     : This function returns true if both string values passed
--                   are identical
--
-- NOTES           : This function was added because the the synthesis tool
--                   didn't support a boolean string equality operation test.
--                   Also, adding a new overloaded operator "=" caused problems
--                   with the simulator 
--
------------------------------------------------------------------------------
function seq(str1Val : string; 
             str2Val : string) return boolean is
   variable char1Var    : character;
   variable char2Var    : character;
   variable resultVar   : boolean;
   variable str1Var     : string(1 to str1Val'length);
   variable str2Var     : string(1 to str2Val'length);
begin
   resultVar := true;
   str1Var := str1Val;
   str2Var := str2Val;
   for loopVar in str1Var'range loop
      if (str1Var(loopVar) /= str2Var(loopVar)) then
	     resultVar := false;
	  end if;
   end loop;
   return resultVar;
end function;


--------------------------------------------------------------------------------
----
---- FUNCTION NAME   : shift
----
---- DESCRIPTION     : This function returns a std_logic_vector shifted 
----                   by the number of integer places specified.  This provides
----                   an easy way to multiply or divide by 2^(natVal)
----                   
----
---- NOTES
----
--------------------------------------------------------------------------------
--function shift(vectorVal : std_logic_vector;
--               intVal    : integer) return std_logic_vector is
--   variable resultVar : std_logic_vector(vectorVal'length-1 downto 0);
--begin
--   resultVar := vectorVal;
--   resultVar := (others => '0');
--   resultVar(resultVar'high downto resultVar'high-vectorVal'length+1) := resultVar;
--   return resultVar;
--end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : shl (shift left)
--
-- DESCRIPTION     : This function returns a std_logic_vector shifted left
--                   by the number of binary places specified.  This provides
--                   an easy way to multiply by 2^(natVal)
--                   
--
-- NOTES
--
------------------------------------------------------------------------------
function shl(vectorVal : std_logic_vector;
             natVal    : natural) return std_logic_vector is
   variable interimVar : std_logic_vector(vectorVal'length-1 downto 0);
   variable resultVar  : std_logic_vector(vectorVal'length+natVal-1 downto 0);
begin
   interimVar := vectorVal;
   resultVar  := (others => '0');
   resultVar(resultVar'high downto resultVar'high-vectorVal'length+1) := interimVar;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : slv_to_bcd
--
-- DESCRIPTION     : This function converts an unsigned, decending range, 
--                   std logic vector value into a 
--                   packed binary coded decimal (BCD)
--                   standard logic vector and returns the result in
--                   the number of BCD digits passed to the function.
-- 
-- NOTES
--
-- "width mismatch" errors are due to improper sizing of the vector 
-- that this function is assigned to
--
------------------------------------------------------------------------------
function slv_to_bcd(vectorVal     : std_logic_vector; 
                    BCD_DigitsVal : integer)
   return std_logic_vector is 
type resultArrayType is array(vectorVal'length downto 0)                        -- array depth is 1 level more than the input vector
     of std_logic_vector(4*BCD_DigitsVal-1 downto 0);                           -- array width is determined by the number of BCD digits to output
variable CarryVar        : std_logic_vector(BCD_DigitsVal downto 0);            -- the # of carry bits is determined by the number of BCD digits
variable BCD_WoCarVar    : std_logic_vector(3 downto 0);                        -- BCD digit variable used by the inner loop if the next BCD Digit is computed without carry from the current BCD value
variable BCD_WiCarVar    : std_logic_vector(3 downto 0);                        -- BCD digit variable used by the inner loop if the next BCD Digit is computed with carry from the current BCD value
variable InnrLoopVar     : integer := 0;                                        -- inner loop index variable
variable OutrLoopVar     : integer := 0;                                        -- outer loop index variable
variable ResultVar       : resultArrayType;                                     -- BCD value result variable
variable VectorVar       : std_logic_vector(vectorVal'length-1 downto 0);
begin
   VectorVar := vectorVal;
   ResultVar(0) := (others => '0');                                             -- set the initial entry in the results array to zero
   for OutrLoopVar in VectorVar'high downto 0 loop                              -- start at the MSB of the std logic vector input and work down
      CarryVar(0) := VectorVar(OutrLoopVar);                                    -- read in the next bit of the slv input into the lowest carry bit
      for InnrLoopVar in 0 to BCD_DigitsVal-1 loop                              -- start at the LSB of the BCD output
         BCD_WoCarVar := ResultVar(VectorVar'length - OutrLoopVar -1)           -- read the results of the previous calculation
                                (4*InnrLoopVar+3 downto 4*InnrLoopVar);
         BCD_WiCarVar := BCD_WoCarVar - "0101";                                 -- compute the result for the current BCD digit if a carry to the next digit will be needed
         if (BCD_WoCarVar > "0100") then                                        -- if the digit is 5 or greater ("0101") then the result of the binary shift left "10100" = decimal 16, which is to great to represent in one BCD digit so then
            CarryVar(InnrLoopVar+1) := '1';                                     -- we carry a digit to the next BCD digit
            ResultVar(VectorVar'length - OutrLoopVar)
                     (4*InnrLoopVar+3 downto 4*InnrLoopVar) 
                        := BCD_WiCarVar(2 downto 0) & CarryVar(InnrLoopVar);    -- and we use the lesser value for the current digit along with the carry value from the previous BCD digit
         else                                                                   -- otherwise the digit is small enough to be represented in one BCD digit when a binary shift in is performed
            CarryVar(InnrLoopVar+1) := '0';
            ResultVar(VectorVar'length - OutrLoopVar)
                     (4*InnrLoopVar+3 downto 4*InnrLoopVar)
                        := BCD_WoCarVar(2 downto 0) & CarryVar(InnrLoopVar);    -- so we write the value to the result variable along with any carry value from a previous BCD digit
         end if;
      end loop;
   end loop;
   return ResultVar(VectorVar'high+1); -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : slv_to_bcd
--
-- DESCRIPTION     : This function converts an unsigned, decending range, 
--                   binary value into a packed binary coded decimal (BCD)
--                   standard logic vector and returns the result in
--                   the number BCD digits required to represent the maximum 
--                   unsigned value possible in the vector passed to it
--
-- NOTES
-- BCD_DigitsVal -> dpfslvr(vectorVal)
--
-- "width mismatch" errors are due to improper sizing of the vector
-- that this function is assigned to
------------------------------------------------------------------------------
function slv_to_bcd(vectorVal : std_logic_vector) return std_logic_vector is 
type resultArrayType is array(vectorVal'length downto 0)                        -- array depth is 1 level more than the input vector
     of std_logic_vector(4*dpfslvr(vectorVal)-1 downto 0);                       -- array width is determined by the number of BCD digits to output
variable CarryVar        : std_logic_vector
                           (dpfslvr(vectorVal) downto 0);                        -- the # of carry bits is determined by the number of BCD digits
variable BCD_WoCarVar    : std_logic_vector(3 downto 0);                        -- BCD digit variable used by the inner loop if no carry to the next BCD Digit is needed
variable BCD_WiCarVar    : std_logic_vector(3 downto 0);                        -- BCD digit variable used by the inner loop if carry to the next BCD Digit is needed
variable InnrLoopVar     : integer := 0;                                        -- inner loop index variable
variable OutrLoopVar     : integer := 0;                                        -- outer loop index variable
variable ResultVar       : resultArrayType;                                     -- BCD value result variable
variable VectorVar       : std_logic_vector(vectorVal'length-1 downto 0);
begin
   VectorVar := vectorVal;
   ResultVar(0) := (others => '0');                                             -- set the initial entry in the results array to zero
   for OutrLoopVar in VectorVar'high downto 0 loop                              -- start at the MSB of the std logic vector input and work down
      CarryVar(0) := VectorVar(OutrLoopVar);                                    -- read in the next bit of the slv input into the lowest carry bit
      for InnrLoopVar in 0 to CarryVar'high-1 loop                              -- start at the LSB of the BCD output
         BCD_WoCarVar := ResultVar(VectorVar'length - OutrLoopVar -1)           -- read the results of the previous calculation
                                (4*InnrLoopVar+3 downto 4*InnrLoopVar);
         BCD_WiCarVar := BCD_WoCarVar - "0101";                                 -- compute the result for the current BCD digit if a carry to the next digit will be needed
         if (BCD_WoCarVar > "0100") then                                        -- if the digit is 5 or greater ("0101") then the result of the binary shift left "10100" = decimal 16, which is to great to represent in one BCD digit so then
            CarryVar(InnrLoopVar+1) := '1';                                     -- we carry a digit to the next BCD digit
            ResultVar(VectorVar'length - OutrLoopVar)
                     (4*InnrLoopVar+3 downto 4*InnrLoopVar) 
                        := BCD_WiCarVar(2 downto 0) & CarryVar(InnrLoopVar);    -- and we use the lesser value for the current digit along with the carry value from the previous BCD digit
         else                                                                   -- otherwise the digit is small enough to be represented in one BCD digit when a binary shift in is performed
            CarryVar(InnrLoopVar+1) := '0';
            ResultVar(VectorVar'length - OutrLoopVar)
                     (4*InnrLoopVar+3 downto 4*InnrLoopVar)
                        := BCD_WoCarVar(2 downto 0) & CarryVar(InnrLoopVar);    -- so we write the value to the result variable along with any carry value from a previous BCD digit
         end if;
      end loop;
   end loop;
   return ResultVar(VectorVar'high+1); -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : slv_to_bcd_pipe
--
-- DESCRIPTION     : This function converts an unsigned, decending range, 
--                   binary value into a packed binary coded decimal (BCD)
--                   standard logic vector and returns the result in
--                   the number BCD digits required to represent the maximum 
--                   unsigned value possible in the vector passed to it.
--                   it is for use in pipelined implementations where
--                   the binary coded decimal output is registered
--                   and passed back to the function along with the binary
--                   vector input to be shifted out of its MSB
--                   register and into the function as a new bit.
--                   
--
-- NOTES
-- BCD_DigitsVal -> dpfslvr(vectorVal)
--
-- "width mismatch" errors here are due to improper sizing of the vector
-- that this function is assigned to
------------------------------------------------------------------------------
function slv_to_bcd_pipe(
   BCD_RVal      : std_logic_vector;           -- registered output of this function fed back in
   MSB_Val       : std_logic;                  -- msb of binary value being shifted in
   BCD_DigitsVal : integer) return std_logic_vector is                          -- binary coded decimal arithmetic shift left
variable BCDVar          : std_logic_vector(BCD_RVal'length-1  downto 0);
variable CarryVar        : std_logic_vector(BCD_DigitsVal downto 0);            -- the # of carry bits is determined by the number of BCD digits
variable BCD_WoCarVar    : std_logic_vector(3 downto 0);
variable BCD_WiCarVar    : std_logic_vector(3 downto 0);
variable ResultVar       : std_logic_vector(4*BCD_DigitsVal-1 downto 0);
begin
   BCDVar := BCD_RVal;
   for loopVar in 0 to BCD_DigitsVal-1 loop
      CarryVar(0) := MSB_Val;
      BCD_WoCarVar := BCDVar(4*loopVar+3 downto 4*loopVar);
      BCD_WiCarVar := BCD_WoCarVar - "0101";
      if (BCD_WoCarVar > "0100") then                     
         CarryVar(loopVar+1) := '1';
         ResultVar(4*loopVar+3 downto 4*loopVar) 
            := BCD_WiCarVar(2 downto 0) & CarryVar(loopVar);
      else
         CarryVar(loopVar+1) := '0';
         ResultVar(4*loopVar+3 downto 4*loopVar) 
            := BCD_WoCarVar(2 downto 0) & CarryVar(loopVar);
      end if;
   end loop;
   return ResultVar;  -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : str_to_int
--
-- DESCRIPTION     : This function converts a string to an integer
--
-- NOTES           : 
--
------------------------------------------------------------------------------
function str_to_int(stringVal : string) return integer is
   variable decPlace         : integer := 1;
   variable stringVar        : string(1 to stringVal'length);
   variable negVar           : boolean; -- used to indicate whether or not the string represents a negative number
   variable resultVar        : integer;
   variable vectorParseVar   : character;
begin
   negVar    := false;
   resultVar := 0;
   stringVar := stringVal;
   for loopVar in stringVar'range loop
      vectorParseVar := stringVar(loopVar);
      case vectorParseVar is
      when '-'       => negVar    := true;
      when '0'       => resultVar := (resultVar * 10) + 0;
      when '1'       => resultVar := (resultVar * 10) + 1;
      when '2'       => resultVar := (resultVar * 10) + 2;
      when '3'       => resultVar := (resultVar * 10) + 3;
      when '4'       => resultVar := (resultVar * 10) + 4;
      when '5'       => resultVar := (resultVar * 10) + 5;
      when '6'       => resultVar := (resultVar * 10) + 6;
      when '7'       => resultVar := (resultVar * 10) + 7;
      when '8'       => resultVar := (resultVar * 10) + 8;
      when '9'       => resultVar := (resultVar * 10) + 9;
      when '.'       =>    
         if (negVar) then   -- ignore everything after a decimal point
            return -resultVar;
         else
            return resultVar;
         end if;
      when others    =>
      end case;
   end loop;
   if (negVar) then   -- ignore everything after a decimal point
      return -resultVar;
   else
      return resultVar;
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : str_to_line
--
-- DESCRIPTION     : This function converts a string to a line
--
-- NOTES           : 
--
------------------------------------------------------------------------------
-- synopsys translate_off
function str_to_line(strVal : string) return line is
   variable lineVar    : line;
begin
   --Std.TextIO.Write(lineVar, vectorVal);
   Write(lineVar, strVal);
   return lineVar;
end function;
-- synopsys translate_on


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : str_to_led
--
-- DESCRIPTION     : This function converts a Seven Segment LED
--                   string of any length to a std_logic_vector
--
-- NOTES           : if the CAVal boolean input is true the output will
--                   be for a Common Anode (1=off) display, otherwise it will
--                   be for a Common Cathode (1=on)display.
--
--    _____
--   |  a  |
--  f|     |b
--   |_____|
--   |  g  |
--  e|     |c
--   |_____|
--      d
--
-- "width mismatch" errors here are due to improper sizing of the vector
-- that this function is assigned to
------------------------------------------------------------------------------
function str_to_led(stringVal : string; 
                    CAVal     : boolean) return std_logic_vector is
   variable stringVar        : string(stringVal'length downto 1);
   variable resultVar        : std_logic_vector(7*StringVal'length downto 1);
   variable vectorParseVar   : character;
begin
   stringVar := stringVal;
   for loopVar in StringVar'range loop
      vectorParseVar := StringVar(loopVar);
      case vectorParseVar is
      --                                                            Illuminated
      --   character                                                Segment
      --   shown                                                    abcdefg
      when ' '       => resultVar(7*loopVar downto 7*loopVar-6) := "0000000";
      when '"'       => resultVar(7*loopVar downto 7*loopVar-6) := "0100010";
      when '''       => resultVar(7*loopVar downto 7*loopVar-6) := "0100000";
      when '-'       => resultVar(7*loopVar downto 7*loopVar-6) := "0000001";
      when '/'       => resultVar(7*loopVar downto 7*loopVar-6) := "0100101";
      when '0' | 'D' => resultVar(7*loopVar downto 7*loopVar-6) := "1111110";
      when '1'       => resultVar(7*loopVar downto 7*loopVar-6) := "0110000";
      when '2'       => resultVar(7*loopVar downto 7*loopVar-6) := "1101101";
      when '3'       => resultVar(7*loopVar downto 7*loopVar-6) := "1111001";
      when '4'       => resultVar(7*loopVar downto 7*loopVar-6) := "0110011";
      when '5' | 'S' => resultVar(7*loopVar downto 7*loopVar-6) := "1011011";
      when '6'       => resultVar(7*loopVar downto 7*loopVar-6) := "1011111";
      when '7'       => resultVar(7*loopVar downto 7*loopVar-6) := "1110010";
      when '8' | 'B' => resultVar(7*loopVar downto 7*loopVar-6) := "1111111";
      when '9'       => resultVar(7*loopVar downto 7*loopVar-6) := "1110011";
      when '='       => resultVar(7*loopVar downto 7*loopVar-6) := "0001001";
      when '?'       => resultVar(7*loopVar downto 7*loopVar-6) := "1100101";
      when 'A'       => resultVar(7*loopVar downto 7*loopVar-6) := "1110111";
      when 'C'       => resultVar(7*loopVar downto 7*loopVar-6) := "1001110";
      when 'E'       => resultVar(7*loopVar downto 7*loopVar-6) := "1001111";
      when 'F'       => resultVar(7*loopVar downto 7*loopVar-6) := "1000111";
      when 'G'       => resultVar(7*loopVar downto 7*loopVar-6) := "1011110";
      when 'H'       => resultVar(7*loopVar downto 7*loopVar-6) := "0110111";
      when 'I'       => resultVar(7*loopVar downto 7*loopVar-6) := "0000110";
      when 'J'       => resultVar(7*loopVar downto 7*loopVar-6) := "1111100";
      when 'L'       => resultVar(7*loopVar downto 7*loopVar-6) := "0001110";
      when 'O'       => resultVar(7*loopVar downto 7*loopVar-6) := "1111110";
      when 'P'       => resultVar(7*loopVar downto 7*loopVar-6) := "1100111";
      when 'T'       => resultVar(7*loopVar downto 7*loopVar-6) := "1000110";
      when 'U'       => resultVar(7*loopVar downto 7*loopVar-6) := "0111110";
      when 'Y'       => resultVar(7*loopVar downto 7*loopVar-6) := "0100111";
      when 'Z'       => resultVar(7*loopVar downto 7*loopVar-6) := "1101101";
      when '\'       => resultVar(7*loopVar downto 7*loopVar-6) := "0010011";
      when ']'       => resultVar(7*loopVar downto 7*loopVar-6) := "1111000";
      when '^'       => resultVar(7*loopVar downto 7*loopVar-6) := "1100010";
      when '_'       => resultVar(7*loopVar downto 7*loopVar-6) := "0001000";
      when 'b'       => resultVar(7*loopVar downto 7*loopVar-6) := "0011111";
      when 'c'       => resultVar(7*loopVar downto 7*loopVar-6) := "0001101";
      when 'd'       => resultVar(7*loopVar downto 7*loopVar-6) := "0111101";
      when 'g'       => resultVar(7*loopVar downto 7*loopVar-6) := "1111011";
      when 'h'       => resultVar(7*loopVar downto 7*loopVar-6) := "0010111";
      when 'j'       => resultVar(7*loopVar downto 7*loopVar-6) := "0111100";
      when 'l'       => resultVar(7*loopVar downto 7*loopVar-6) := "0111000";
      when 'n'       => resultVar(7*loopVar downto 7*loopVar-6) := "0010101";
      when 'o'       => resultVar(7*loopVar downto 7*loopVar-6) := "0011101";
      when 'r'       => resultVar(7*loopVar downto 7*loopVar-6) := "0000101";
      when 'u'       => resultVar(7*loopVar downto 7*loopVar-6) := "0011100";
      when '¬'       => resultVar(7*loopVar downto 7*loopVar-6) := "0010001";
      when '¯'       => resultVar(7*loopVar downto 7*loopVar-6) := "1000000";
      when '°'       => resultVar(7*loopVar downto 7*loopVar-6) := "1100011";
      when others    =>
      end case;
   end loop;
   if (CAVal) then
      return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
   else
      return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : str_to_slv
--
-- DESCRIPTION     : This function converts an integer value string
--                   of any length to a std_logic_vector
--
-- NOTES           : 
--
-- 
------------------------------------------------------------------------------
function str_to_slv(stringVal : string) return std_logic_vector is
begin
return str_to_slv(stringVal,-15);  -- default to 1fs time base
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : str_to_slv
--
-- DESCRIPTION     : This function converts an integer value string
--                   of any length to a std_logic_vector
--
-- NOTES           : This function supports both positive and negative numbers
--                   as well as positive and negative exponents.  It supports
--                   multiple time unit per string as long as there are no
--                   exponents used. No other units may start with the
--                   character 's' unless the "ec" detection portion
--                   of the "seconds" unit portion is uncommented
--                   and 's' is no longer used as a unit for "seconds"
--
--          Time units supported
--
--          0.000 000 000 000 000 000 000 001  	 yoctosecond [ ys ]       10^(-24)
--          0.000 000 000 000 000 000 001 	      zeptosecond [ zs ]       10^(-21)
--          0.000 000 000 000 000 001 	          attosecond  [ as ]       10^(-18)
--          0.000 000 000 000 001 	              femtosecond [ fs ]       10^(-15)
--          0.000 000 000 001    [ trillionth ] 	picosecond  [ ps ]       10^(-12)
--          0.000 000 001        [ billionth ] 	 nanosecond  [ ns ]       10^(-9)
--          0.000 001            [ millionth ] 	 microsecond [ µs ]       10^(-6)
--          0.001                [ thousandth ] 	millisecond [ ms ]       10^(-3)
--          0.01                 [ hundredth ]  	centisecond [ cs ]       10^(-2)
--          1.0 	                                second      [ s or sec ] 10^(0)
--          60.0 	                               minute      [ min ]      10^(0)
--          3600.0 	                             hour        [ hr ]       10^(0)
--          86,400.0 	                           day         [ day ]      10^(0)
--
--
--          Frequency units supported
--          
--          1                                    hertz       [ hz ]  10^(0)
--          1,000                                kilohertz   [ khz ] 10^(3)
--          1,000,000                            megahertz   [ mhz ] 10^(6)
--          1,000,000,000                        gigahertz   [ ghz ] 10^(9)
--          1,000,000,000,000                    terahertz   [ thz ] 10^(12)
--          1,000,000,000,000,000                petahertz   [ phz ] 10^(15)
--          1,000,000,000,000,000,000            exahertz    [ ehz ] 10^(18)
--          1,000,000,000,000,000,000,000        zetahertz   [ zhz ] 10^(21)
--          1,000,000,000,000,000,000,000,000    yottahertz  [ yhz ] 10^(24)
--
-- EXAMPLE           "1 day, 3 hrs, 15.298 seconds"
--                   "66,000,000 Hz" "66,000,000.000 Hz" "66 MHz" "66E6 Hz" "66E+6 Hz" "66.000E+6 Hz" 
--                   "66,000,000 us" "66,000,000.000 us" "66 us" "66E6 us" "66E+6 us" "66.000E+6 us" 
--
-- 
------------------------------------------------------------------------------
function str_to_slv(stringVal : string;
                    intVal    : integer) return std_logic_vector is
   constant \10\             : std_logic_vector(3 downto 0)  := "1010";               -- 10
   constant \60\             : std_logic_vector(5 downto 0)  := "111100";             -- 60
   constant \3600\           : std_logic_vector(11 downto 0) := "111000010000";       -- 3600
   constant \86400\          : std_logic_vector(16 downto 0) := "10101000110000000";  -- 86,400 (solar day)
   variable baseVar          : integer;                                               -- exponent of the timebase i.e. 1fs = 1E-15 seconds so the timebase = 15
   variable decPlacesVar     : integer;                                               -- used to count how many numbers are after the decimal point
   variable decPntFndVar     : boolean;                                               -- used to flag whether or not a decimal point was found in the string
   variable expFndVar        : boolean;                                               -- used to flag that the exponent has been reached so that the rest of the string value will not be interpreted as part of the base value
   variable expVar           : integer;                                               -- used to indicated the exponent value
   variable freqUnitFndVar   : boolean;                                               -- used to flag whether or not the string represents a frequency
   variable negVar           : boolean;                                               -- used to flag whether or not the string represents a negative number
   variable resultVar        : std_logic_vector(MAX_VECT_SIZE+16 downto 0);
   variable result2Var       : std_logic_vector(MAX_VECT_SIZE+16 downto 0);           -- used to store a result from a secondary value such as would be encounter when a value such as "1 hr 10 mins" is passed to the function
   variable scndTimeFndVar   : boolean;                                               -- used to indicate a second time value was found
   variable stringVar        : string(1 to stringVal'length+4);                       -- slightly larger because string is addessed beyond the current loop to test for units
   variable timeBaseVar      : std_logic_vector(MAX_VECT_SIZE+16 downto 0);
   variable timeUnitFndVar   : boolean;                                               -- used to flag that a time unit was found (days, hrs, mins, secs)
   variable vectorParseVar   : character;                                             -- character currently under test 
begin
   baseVar         := -intVal;
   decPntFndVar    := false;     -- initialize to decimal point not found yet
   decPlacesVar    := 0;
   expFndVar       := false;     -- initialize to exponent point not found yet
   expVar          := 0;
   freqUnitFndVar  := false;     -- initialize to frequency units not found yet
   negVar          := false;     -- initialize to negative sign not found yet
   resultVar       := (others => '0');
   result2Var      := (others => '0');
   scndTimeFndVar  := false;     -- initialize to secont time value not found yet
   stringVar       := stringVal & "    "; -- tack on few extra spaces for padding so that it is possible to address beyond the current loop variable
   timeUnitFndVar  := false;
   timeBaseVar     := ext("01",timeBaseVar'length);
   for loopVar in 1 to baseVar loop
      timeBaseVar := mult_us(timeBaseVar(MAX_VECT_SIZE+12 downto 0), \10\);  -- this value will contain the time base (in binary) when this loop completes (10^30 for a baseVar of 30)
   end loop;
   for loopVar in stringVar'range loop   -- this loop parses the string value passed to this function from left to right
      vectorParseVar := stringVar(loopVar);
      if (scndTimeFndVar) then
         resultVar := resultVar;  -- if a second value has been found then just wait here for the loop to complete
      else
         case vectorParseVar is
            when '-'       =>
               if (not decPntFndvar and not expFndVar and not freqUnitFndVar and not timeUnitFndVar) then  -- expect the sign to be near the front of the string
                  negVar := true;
               end if;
            when '0'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then -- if the decimal point was found and we're not reading an exponent then 
                     decPlacesVar := decPlacesVar + 1;     -- consider this to be a number after the decimal point
                  end if;
                  if (not expFndVar) then                  -- if we are not reading the exponent then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 0; -- factor in the next digit
                  end if;
               end if;
            when '1'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 1;
                  end if;
               end if;
            when '2'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 2;
                  end if;
               end if;
            when '3'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 3;
                  end if;
               end if;
            when '4'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 4;
                  end if;
               end if;
            when '5'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 5;
                  end if;
               end if;
            when '6'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 6;
                  end if;
               end if;
            when '7'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 7;
                  end if;
               end if;
            when '8'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 8;
                  end if;
               end if;
            when '9'       => 
               if (freqUnitFndVar) then
                  resultVar := resultVar;  -- do nothing
               elsif (timeUnitFndVar) then -- if we've already found a time unit then this must be a second time value
                  result2Var := ext(str_to_slv(stringVar(loopVar to stringVar'length),intVal),result2Var'length); -- pass the rest of the string to the next instance of the function
                  scndTimeFndVar := true;
               else
                  if (decPntFndVar and not expFndVar) then
                     decPlacesVar := decPlacesVar + 1;
                  end if;
                  if (not expFndVar) then
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\) + 9;
                  end if;
               end if;
            when 'e' | 'E' => -- exponent
               if (not freqUnitFndVar and not timeUnitFndVar and
                     ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                      (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- exahertz unit found
                  for loopVar in 1 to 18 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               elsif (not expFndVar and not freqUnitFndVar and not timeUnitFndVar)   -- if we haven't already found an exponent, frequency unit, or time unit
               then
                  expFndVar := true; -- mark that we've found it 
                  expVar    := str_to_int(stringVar(loopVar to stringVal'length)); -- and capture its value
               end if;
            when '.'       => decPntFndVar := true; -- mark the position of the decimal point
            when 'y' | 'Y' =>  -- yoctosecond 10^-24
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- yoctosecond unit found
                  for loopVar in 1 to baseVar-24 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               elsif (not freqUnitFndVar and not timeUnitFndVar and
                     ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                      (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- yottahertz unit found
                  for loopVar in 1 to 24 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'z' | 'Z' =>  -- zeptosecond 10^-21
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- zeptosecond unit found
                  for loopVar in 1 to baseVar-21 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               elsif (not freqUnitFndVar and not timeUnitFndVar and
                     ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                      (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- zettahertz unit found
                  for loopVar in 1 to 21 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'a' | 'A' =>  -- attosecond 10^-18
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- attosecond unit found
                  for loopVar in 1 to baseVar-18 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'f' | 'F' =>  -- femtosecond 10^-15
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- femtosecond unit found
                  for loopVar in 1 to baseVar-15 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'p' | 'P' =>  -- picosecond 10^-12
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- picosecond unit found
                  for loopVar in 1 to baseVar-12 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               elsif (not freqUnitFndVar and not timeUnitFndVar and
                     ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                      (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- petahertz unit found
                  for loopVar in 1 to 15 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'n' | 'N' =>  -- nanosecond 10^-9
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- nanosecond unit found
                  for loopVar in 1 to baseVar-9 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'u' | 'U' =>  -- microsecond 10^-6
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- microsecond unit found
                  for loopVar in 1 to baseVar-6 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'm' | 'M' =>  -- millisecond 10^-3
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 's') or 
                   (stringVar(loopVar+1) = 'S'))) 
               then
                  timeUnitFndVar := true; -- millisecond unit found
                  for loopVar in 1 to baseVar-3 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               elsif (not freqUnitFndVar and not timeUnitFndVar and
                     ((seq(stringVar(loopVar+1 to loopVar+2), "in")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "iN")) or
                      (seq(stringVar(loopVar+1 to loopVar+2), "In")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "IN")))) 
               then
                  timeUnitFndVar := true; -- minute unit found
                  for loopVar in 1 to baseVar loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
                  resultVar := mult_us(resultVar(MAX_VECT_SIZE+10 downto 0), \60\);
               elsif (not freqUnitFndVar and not timeUnitFndVar and
                     ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                      (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                      (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- megahertz unit found
                  for loopVar in 1 to 6 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 's' | 'S' =>
               if (not freqUnitFndVar and not timeUnitFndVar) -- and
                  --((seq(stringVar(loopVar+1 to loopVar+2), "ec")) or 
                  -- (seq(stringVar(loopVar+1 to loopVar+2), "eC")) or
                  -- (seq(stringVar(loopVar+1 to loopVar+2), "Ec")) or 
                  -- (seq(stringVar(loopVar+1 to loopVar+2), "EC")))) 
               then
                  timeUnitFndVar := true; -- second unit found
                  for loopVar in 1 to baseVar loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'h' | 'H' =>
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((stringVar(loopVar+1) = 'r') or 
                   (stringVar(loopVar+1) = 'R'))) 
               then
                  timeUnitFndVar := true; -- hour unit found
                  for loopVar in 1 to baseVar loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
                  resultVar := mult_us(resultVar(MAX_VECT_SIZE+4 downto 0), \3600\);
               elsif (not freqUnitFndVar and not timeUnitFndVar and
                     ((stringVar(loopVar+1) = 'z') or 
                      (stringVar(loopVar+1) = 'Z'))) 
               then
                  freqUnitFndVar := true;
               end if;
            when 'd' | 'D' =>
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((seq(stringVar(loopVar+1 to loopVar+2), "ay")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "aY")) or
                   (seq(stringVar(loopVar+1 to loopVar+2), "Ay")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "AY")))) 
               then
                  timeUnitFndVar := true; -- day unit found
                  for loopVar in 1 to baseVar loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
                  resultVar := mult_us(resultVar(MAX_VECT_SIZE-1 downto 0), \86400\);
               end if;
            when 'g' | 'G' =>
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                   (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- gigahertz unit found
                  for loopVar in 1 to 9 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 'k' | 'K' =>
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                   (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- kilohertz unit found
                  for loopVar in 1 to 3 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when 't' | 'T' =>
               if (not freqUnitFndVar and not timeUnitFndVar and
                  ((seq(stringVar(loopVar+1 to loopVar+2), "hz")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "hZ")) or
                   (seq(stringVar(loopVar+1 to loopVar+2), "Hz")) or 
                   (seq(stringVar(loopVar+1 to loopVar+2), "HZ")))) 
               then
                  freqUnitFndVar := true; -- terahertz unit found
                  for loopVar in 1 to 12 loop
                     resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
                  end loop;
               end if;
            when others =>
            end case;
         end if;
   end loop;
   if (expVar >= 0) then                       -- if it's a positive exponent then perform a multiplication loop
      for loopVar in 1 to expVar loop
         resultVar := mult_us(resultVar(MAX_VECT_SIZE+12 downto 0), \10\);
      end loop;
   else                                        -- if it's a negative exponent then perform a division loop
      for loopVar in 1 to (-expVar) loop
         resultVar := resultVar / \10\;
      end loop;
   end if;
   if (decPntFndVar) then                      -- if a decimal point was present in the value then
      for loopVar in 1 to decPlacesVar loop   -- scale the output accordingly
         resultVar := resultVar / \10\;        
      end loop;
   end if;
   resultVar := resultVar + result2Var;        -- add on any secondary value
   if (freqUnitFndVar) then                        -- the the string is a frequency value then
      resultVar := timeBaseVar / resultVar;    -- invert it to convert it to a period value before returning
   end if;
   if (negVar and not timeUnitFndVar) then     -- the the string is a negative value and its not a time value then
      resultVar := neg(resultVar);             -- negate the result
   end if;
   return reduce(resultVar);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : str_to_slv_high
--
-- DESCRIPTION     : This function converts an integer value string
--                   of any length to a std_logic_vector
--
-- NOTES
--
-- 
------------------------------------------------------------------------------
function str_to_slv_high(stringVal : string) return integer is
begin
   return reduce_high(str_to_slv(stringVal));
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : str_to_slv_var_base_high
--
-- DESCRIPTION     : This function converts an integer value string
--                   of any length to a std_logic_vector
--
-- NOTES
--
-- 
------------------------------------------------------------------------------
function str_to_slv_var_base_high(stringVal : string;
                                  intVal : integer) return integer is
begin
   return reduce_high(str_to_slv(stringVal,intVal));
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : strh
--
-- DESCRIPTION     : This function returns the high value of a sring vector
--                   
--
-- NOTES
--
-- 
------------------------------------------------------------------------------
function strh(stringVal : string) return integer is
begin
   return stringVal'high;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : sxt2 (sign extend) 
--
-- DESCRIPTION     : This function returns a standard logic vector,
--                   padded with zeros, to the length specified by intVal
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function sxt2(vectorVal : std_logic_vector;
              natVal    : natural) return std_logic_vector is
   variable zeroVar   : slv (natVal - vectorVal'length - 1 downto 0) := (others => '0');
   variable oneVar    : slv (natVal - vectorVal'length - 1 downto 0) := (others => '1');
   variable vectorVar : slv (vectorVal'length - 1 downto 0);
begin
   vectorVar := vectorVal;
   if (vectorVar(vectorVar'high) = '1') then
      if (vectorVar'length >= natVal) then
         return vectorVar;
      else
         return oneVar & vectorVar;
      end if;
   else
      if (vectorVar'length >= natVal) then
         return vectorVar;
      else
         return zeroVar & vectorVar;
      end if; 
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_int
--
-- DESCRIPTION     : conv_integer function repackaged
--
-- NOTES
-- 
------------------------------------------------------------------------------
function to_int(vectorVal : std_logic_vector) return integer is
begin
   return conv_integer(vectorVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_period
--
-- DESCRIPTION     : This function returns a one cycle period value for
--                   a given frequency
--
-- NOTES             timeVar must be larger than the simulator resolution
--                   and is limited by the integer that can be created from
--                   time'pos of it's value
--
--                   the funtion does not work with Synplify 7.7
------------------------------------------------------------------------------
--function to_period(freqVal : frequency) return time is
--   variable resultVar : time;
--begin
--   resultVar := 1E9/frequency'pos(freqVal) * 1 ns; -- max of 2147.483647 ns for Precision Synthesis
--   return resultVar;
--end function;


function to_period(freqVal : frequency) return time is
   variable resultVar : time;
   variable timeVar   : time := 1 ms;
   variable divVar    : real := real(1 sec/timeVar);
begin
   if (frequency'pos(freqVal) > 2_147_483_647) then
      assert FALSE
         report "Frequency value passed to function is greater than 2,147,483,647 when converted to base units."
         severity warning;
   end if;
   resultVar := divVar/real(frequency'pos(freqVal)) * timeVar; -- see "NOTES"
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_period
--
-- DESCRIPTION     : This function returns a one cycle period value for
--                   a given frequency
--
-- NOTES             timeVar must be larger than the simulator resolution
--                   and is limited by the integer that can be created from
--                   time'pos of it's value
--
--                   the funtion does not work with Synplify 7.7
------------------------------------------------------------------------------
--function to_period(freqVal : string) return time is
--   variable resultVar : time;
--begin
--   resultVar := 1E9/frequency'pos(freqVal) * 1 ns; -- max of 2147.483647 ns for Precision Synthesis
--   return resultVar;
--end function;


--function to_period(freqVal : string) return time is
--   constant timeVar   : time := 1 ms;
--   variable divVar    : real := real(1 sec/timeVar);
--   variable freqVar   : frequency;
--   variable resultVar : time;
--begin
--   freqVar := cft(freqVal);
--   if (frequency'pos(freqVal) > 2_147_483_647) then
--      assert FALSE
--         report "Frequency value passed to function is greater than 2,147,483,647 when converted to base units."
--         severity warning;
--   end if;
--   resultVar := divVar/real(frequency'pos(freqVal)) * timeVar; -- see "NOTES"
--   return resultVar;
--end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_string (boolean)
--
-- DESCRIPTION     : This function returns a string value representing the
--                   boolean value passed to it.
-- NOTES
--
------------------------------------------------------------------------------
function to_string(boolVal : boolean) return string is
begin
   if (boolVal) then
      return "TRUE";
   else
      return "FALSE";
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_string (integer)
--
-- DESCRIPTION     : This function returns a string value representing the
--                   integer value passed to it.
-- NOTES
--
------------------------------------------------------------------------------
------ synopsys translate_off
--function to_string(intVal : integer) return string is
--   variable lineVar    : line;
--   variable resultVar  : string(1 to cfi(intVal));
--begin
--   --Std.TextIO.Write(lineVar, intVal);
--   Write(lineVar, integer'Image(intVal));
--   resultVar(lineVar.all'range) := lineVar.all;
--   deallocate(lineVar);
--   return resultVar;
--end function;
------ synopsys translate_on


function to_string(intVal : integer) return string is
begin
   return integer'Image(intVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_string (real)
--
-- DESCRIPTION     : This function returns a string value representing the
--                   integer value passed to it.
-- NOTES
--
------------------------------------------------------------------------------
---- synopsys translate_off
--function to_string(realVal : real) return string is
--   variable lengthVar  : natural;
--   variable lineVar    : line;
--   variable resultVar  : string(1 to real'Image(realVal)'length);
--begin
--   --Std.TextIO.Write(lineVar, intVal);
--   Write(lineVar, real'Image(realVal));
--   lengthVar := lineVar.all'length;
--   resultVar(lineVar.all'range) := lineVar.all;
--   deallocate(lineVar);
--   return resultVar;
--end function;
---- synopsys translate_on


function to_string(realVal : real) return string is
begin
   return real'Image(realVal);
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_string (time)
--
-- DESCRIPTION     : This function returns a string value representing the
--                   time value passed to it.
--
-- NOTES           : 
--
------------------------------------------------------------------------------
---- synopsys translate_off
--function to_string(timeVal : time) return string is
--   variable lineVar    : line;
--   variable resultVar  : string(1 to time'image(timeVal)'length);
--begin
--   --Std.TextIO.Write(lineVar, vectorVal);
--   Write(lineVar, time'image(timeVal));
--   resultVar(lineVar.all'range) := lineVar.all;
--   deallocate(lineVar);
--   return resultVar;
--end function;
---- synopsys translate_on

function to_string(timeVal : time) return string is
begin
   return time'image(timeVal);
end function;



------------------------------------------------------------------------------
--
-- FUNCTION NAME   : to_string (vector)
--
-- DESCRIPTION     : This function returns a string value representing the
--                   vector value passed to it.
-- NOTES
--
--   'U',  -- Uninitialized
--   'X',  -- Forcing  Unknown
--   '0',  -- Forcing  0
--   '1',  -- Forcing  1
--   'Z',  -- High Impedance   
--   'W',  -- Weak     Unknown
--   'L',  -- Weak     0       
--   'H',  -- Weak     1       
--   '-'   -- Don't care
------------------------------------------------------------------------------
-- synthesis tool un-friendly version
---- synopsys translate_off
--function to_string(vectorVal : std_logic_vector) return string is
--   variable lineVar    : line;
--   variable resultVar  : string(1 to vectorVal'length);
--begin
--   --Std.TextIO.Write(lineVar, vectorVal);
--   Write(lineVar, vectorVal);
--   resultVar(lineVar.all'range) := lineVar.all;
--   deallocate(lineVar);
--   return resultVar;
--end function;
---- synopsys translate_on

-- synthesis tool friendly version
function to_string(vectorVal : std_logic_vector) return string is
   variable lineVar    : line;
   variable resultVar  : string(1 to vectorVal'length);
   variable vectorVar  : std_logic_vector(1 to vectorVal'length);
begin
   vectorVar := vectorVal;
   for loopVar in vectorVar'range loop 
      if (vectorVar(loopVar) = 'U') then    -- 'U',  -- Uninitialized
         resultVar(loopVar) := 'U';
      elsif (vectorVar(loopVar) = 'X') then -- 'X',  -- Forcing Unknown
         resultVar(loopVar) := 'X';
      elsif (vectorVar(loopVar) = '0') then -- '0',  -- Forcing 0
         resultVar(loopVar) := '0';
      elsif (vectorVar(loopVar) = '1') then -- '1',  -- Forcing 1
         resultVar(loopVar) := '1';
      elsif (vectorVar(loopVar) = 'Z') then -- 'Z',  -- High Impedance 
         resultVar(loopVar) := 'Z';
      elsif (vectorVar(loopVar) = 'W') then -- 'W',  -- Weak Unknown
         resultVar(loopVar) := 'W';
      elsif (vectorVar(loopVar) = 'L') then -- 'L',  -- Weak 0    
         resultVar(loopVar) := 'L';
      elsif (vectorVar(loopVar) = 'H') then -- 'H',  -- Weak 1  
         resultVar(loopVar) := 'H';
      elsif (vectorVar(loopVar) = '-') then -- '-'   -- Don't care
         resultVar(loopVar) := '-';
      end if;
   end loop;
   return resultVar;
end function;


--------------------------------------------------------------------------------
----
---- PROCEDURE NAME  : transpose
----
---- DESCRIPTION     : This procedure returns the transpose of an array
----
---- NOTES           : column 1 -> row 1
----                   column 2 -> row 2
----
--------------------------------------------------------------------------------
--procedure( transpose(arrayVal : array_type) return array_type is
--   variable resultVar : std_ulogic_vector(vectorVal'range);
--begin
--   for loopVar in vectorVal'low to vectorVal'high loop
--      resultVar(resultVar'high-loopVar) := vectorVal(loopVar);
--   end loop;
--   return resultVar;
--end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : vhfi (vector high for integer)
--
-- DESCRIPTION     : This function returns the 'high value to be used
--                   in the range declaration of a vector used to
--                   represent the integer value passed to it.
--
--                   WARNING: This function assumes the rest of the
--                            range declaration of the vector 
--                            will be "downto 0"
-- 
-- NOTES           : see vlfi for more information
--
-- EXAMPLE         : 
------------------------------------------------------------------------------
function vhfi(intVal : integer) return natural is
begin
   return vlfi(intVal) - 1;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : vhfn (vector high for natural)
--
-- DESCRIPTION     : This function returns the 'high value to be used
--                   in the range declaration of a vector used to
--                   represent the natural value passed to it.
--
--                   WARNING: This function assumes the rest of the
--                            range declaration of the vector 
--                            will be "downto 0"
-- 
-- NOTES           : see vlfn for more information
--
-- EXAMPLE         : 
------------------------------------------------------------------------------
function vhfn(natVal : natural) return natural is
begin
   return vlfn(natVal) - 1;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : vlfi (vector length for integer)
--
-- DESCRIPTION     : This function returns an integer representing the
--                   length of the vector required to represent
--                   the integer value passed to it.  This includes
--                   the sign bit; hence the "resultVar := loopVar + 1;"
-- 
-- NOTES           : type integer is range -2147483648 to 2147483647; 
--                   This function can be used in code intended for synthesis
--                   Using a 31 bit variable strips off the sign bit that
--                   the conversion function generates.  This allows us
--                   to place the sign bit in the new location at the top
--                   of the vector.
--
-- EXAMPLE         : -2147483648 passed, convertion to logic vector gives
--                   0000000000000000000000000000000. Bit 31 is '0' and
--                   a sign bit is needed so 31 + 1 = 32 bits are needed to
--                   represent this value
--                   
--                   given intVal = 32
--                   slvVar is assigned 0000000000000000000000000100000
--                   "if" condition becomes true for loopVar = 6
--                   result is 7 (6 bits to represent 32, plus the sign bit)
------------------------------------------------------------------------------
function vlfi(intVal : integer) return natural is
   variable resultVar  : natural;
   variable slvVar     : std_logic_vector(31 downto 1);                         -- range of 31 downto 1 used because the numbering is correct for the positional location of the bits
begin
   slvVar := conv_std_logic_vector(intVal,slvVar'length);                       -- convert the integer passed to the function to a 31 bit logic vector
   if (intVal > 0) then                                                         -- if the integer is positive then
      for loopVar in slvVar'range loop                                          -- start at the top of the vector and index down
         if (slvVar(loopVar) = '1') then                                        -- and if a bit is asserted then
            return loopVar + 1;                                                 -- this is the minimum number of bits needed to represent the absolute value.  And then add one for the sign bit
         end if;
      end loop;
   elsif (intVal = 0) then                                                      -- '0' has no value and, therefore, needs no sign bit
      return 1;
   elsif (intVal = -1) then                                                     -- '-1' is a special case which contains no zeros so the following algorithm would fail.
      return 2;
   elsif (intVal < -1) then                                                     -- if the integer is negative then
      for loopVar in slvVar'range loop                                          -- start at the top of the vector and index down
         if (slvVar(loopVar) = '0') then                                        -- and if a bit is asserted then
            return loopVar + 1;                                                 -- this is the minimum number of bits needed to represent the absolute value.  And then add one for the sign bit
         end if;
      end loop;
   end if;
   return resultVar;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : vlfn (vector length for natural)
--
-- DESCRIPTION     : This function returns an integer representing the
--                   length of the vector required to represent
--                   the natural value passed to it. There is no
--                   sign bit needed so "resultVar := loopVar;"
-- 
-- NOTES           : subtype natural is integer range 0 to 2_147_483_647;
--                   This function can be used in code intended for synthesis
--
-- EXAMPLE         : given natVal = 32
--                   slvVar is assigned 0000000000000000000000000100000
--                   "if" condition becomes true for loopVar = 6
--                   result is 6 (6 bits to represent 32, no sign bit needed)
------------------------------------------------------------------------------
function vlfn(natVal : natural) return natural is
   variable resultVar : natural;
   variable slvVar    : std_logic_vector(31 downto 1);
begin
   slvVar := conv_std_logic_vector(natVal,slvVar'length);
   if (natVal > 2_147_483_647) then
      assert false
      report "value exceeds 2,147,483,647"
      severity warning;
      return 0;
   elsif (natVal > 0) then
      for loopVar in slvVar'range loop
         if (slvVar(loopVar) = '1') then
            return loopVar;
         end if;
      end loop;
   else
      return 1;
   end if;
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : vrfi (vector range for integer)
--
-- DESCRIPTION     : This function returns a std_logic_vector of the same range
--                   required to represent the integer value passed to it. 
--                   This includes the sign bit; 
-- 
-- NOTES           : subtype natural is integer range 0 to 2_147_483_647;
--                   This function can be used in code intended for synthesis
--
------------------------------------------------------------------------------
function vrfi(intVal : integer) return std_logic_vector is
   variable slvVar : std_logic_vector(vhfi(intVal) downto 0);
   attribute slv_high   : natural;
   attribute slv_low    : natural;
   attribute slv_range  : natural;
   attribute slv_high  of slvVar : variable is slvVar'high;
   attribute slv_low   of slvVar : variable is slvVar'low;
   --attribute slv_range of slvVar : variable is slvVar'range;
begin
   return slvVar;
end function;


--------------------------------------------------------------------------------
----
---- FUNCTION NAME   : vrfi (vector range for integer)
----
---- DESCRIPTION     : This function returns a std_logic_vector of the same range
----                   required to represent the integer value passed to it. 
----                   This includes the sign bit; 
----                   hence the "resultVar := loopVar + 1;"
---- 
---- NOTES           : subtype natural is integer range 0 to 2_147_483_647;
----                   This function cannot be used in code intended for synthesis
----
--------------------------------------------------------------------------------
---- synopsys translate_off
--function vrfi(intVal : integer) return std_logic_vector is
--   type slv_ptr is access std_logic_vector;
--   variable size      : slv_ptr;
--   variable resultVar : natural;
--   variable slvVar    : std_logic_vector(31 downto 1);
--begin
--   slvVar := conv_std_logic_vector(intVal,slvVar'length);                       -- convert the integer passed to the function to a 31 bit logic vector
--   if (intVal > 0) then                                                         -- if the integer is positive then
--      for loopVar in slvVar'range loop                                          -- start at the top of the vector and index down
--         if (slvVar(loopVar) = '1') then                                        -- and if a bit is asserted then
--            resultVar := loopVar + 1;                                           -- this is the minimum number of bits needed to represent the absolute value.  And then add one for the sign bit
--            exit;
--         end if;
--      end loop;
--   elsif (intVal = 0) then                                                      -- '0' has no value and, therefore, needs no sign bit
--      resultVar := 1;
--   elsif (intVal = -1) then                                                     -- '-1' is a special case which contains no zeros so the following algorithm would fail.
--      resultVar := 2;
--   elsif (intVal < -1) then                                                     -- if the integer is negative then
--      for loopVar in slvVar'range loop                                          -- start at the top of the vector and index down
--         if (slvVar(loopVar) = '0') then                                        -- and if a bit is asserted then
--            resultVar := loopVar + 1;                                           -- this is the minimum number of bits needed to represent the absolute value.  And then add one for the sign bit
--            exit;
--         end if;
--      end loop;
--   end if;
--   size := new std_logic_vector(resultVar-1 downto 0);
----   return size.all'range;
--   return size.all;
--   deallocate(size);
--end function;
---- synopsys translate_on


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : vrfn (vector range for natural)
--
-- DESCRIPTION     : This function returns an std_logic_vector representing the
--                   length of the vector required to represent
--                   the natural value passed to it.
-- 
-- NOTES           : subtype natural is integer range 0 to 2_147_483_647;
--                   This function can be used in code intended for synthesis
--
------------------------------------------------------------------------------
function vrfn(natVal : natural) return std_logic_vector is
   variable slvVar : std_logic_vector(vhfn(natVal) downto 0);
   attribute slv_high   : natural;
   attribute slv_low    : natural;
   attribute slv_range  : natural;
   attribute slv_high  of slvVar : variable is slvVar'high;
   attribute slv_low   of slvVar : variable is slvVar'low;
   --attribute slv_range of slvVar : variable is slvVar'range;
begin
   return slvVar;
end function;


--------------------------------------------------------------------------------
----
---- FUNCTION NAME   : vrfn (vector range for natural)
----
---- DESCRIPTION     : This function returns an std_logic_vector representing the
----                   length of the vector required to represent
----                   the natural value passed to it.
---- 
---- NOTES           : subtype natural is integer range 0 to 2_147_483_647;
----                   This function cannot be used in code intended for synthesis
----
--------------------------------------------------------------------------------
---- synopsys translate_off
--function vrfn(natVal : natural) return std_logic_vector is
--   type slv_ptr is access std_logic_vector;
--   variable size      : slv_ptr;
--   variable resultVar : natural;
--   variable slvVar    : std_logic_vector(31 downto 1);
--begin
--   slvVar := conv_std_logic_vector(natVal,slvVar'length);
--   if (natVal > 0) then
--      for loopVar in slvVar'range loop
--         if (slvVar(loopVar) = '1') then
--            resultVar := loopVar;
--            exit;
--         end if;
--      end loop;
--   else
--      resultVar := 1;
--   end if;
--   size := new std_logic_vector(resultVar-1 downto 0);
--   return size.all;
--   deallocate(size);
--end function;
---- synopsys translate_on


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : xnor_reduce (multiple input xnor gate)
--
-- DESCRIPTION     : 
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function xnor_reduce (vectorVal : std_logic_vector) return std_logic is
begin
   return not(xor_reduce(vectorVal));
end function;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : xor_reduce (multiple input xor gate)
--
-- DESCRIPTION     : 
-- 
-- NOTES           : 
--
------------------------------------------------------------------------------
function xor_reduce (vectorVal : std_logic_vector) return std_logic is
   variable MSB, LSB      : std_logic;
   variable halfway       : integer;
   variable vectorVar     : std_logic_vector(vectorVal'length-1 downto 0);
   variable result        : std_logic := '0';
begin
   vectorVar := vectorVal;
   if (vectorVar'length >= 1) then
      if (vectorVar'length = 1) then
         result := vectorVar(vectorVar'high);
      elsif (vectorVar'length = 2) then
         result := "xor"(vectorVar(vectorVar'high),vectorVar(vectorVar'low));
      else
         halfway   := (vectorVar'length + 1) / 2; -- determine the halfway point
         MSB       := xor_reduce(vectorVar(vectorVar'high downto halfway));      -- call the function recursively
         LSB       := xor_reduce(vectorVar(halfway - 1 downto vectorVar'low));   -- call the function recursively
         result    := "xor"(MSB, LSB);
      end if;
   end if;
   return result;
end function;







------------------------------------------------------------------------------
--
-- Procedures
--
------------------------------------------------------------------------------


------------------------------------------------------------------------------
--
-- PROCEDURE NAME   : clock_gen
--
-- DESCRIPTION      : generate a 50% duty cycle clock with the specified
--
-- NOTES
--
------------------------------------------------------------------------------
-- synopsys translate_off
procedure clkgen(
   constant clkFreqSig : in    frequency;
   signal   clkSig     : out   std_logic) is
variable posPeriodVar : time := (to_period(clkFreqSig) * 50.0) / 100;
variable negPeriodVar : time := to_period(clkFreqSig) - posPeriodVar;
begin 
   while true loop
      clkSig <= '1';
      wait for posPeriodVar;
      clkSig <= '0';
      wait for negPeriodVar;
   end loop;
end procedure;
-- synopsys translate_on


------------------------------------------------------------------------------
--
-- PROCEDURE NAME   : clock_gen
--
-- DESCRIPTION      : generate a 50% duty cycle clock with the specified
--
-- NOTES
--
------------------------------------------------------------------------------
-- synopsys translate_off
procedure clkgen(
   signal   clkEnSig    : in  boolean;
   signal   clkFreqSig  : in  frequency;
   signal   clkSig      : out std_logic) is
variable posPeriodVar : time := (to_period(clkFreqSig) * 50.0) / 100;
variable negPeriodVar : time := to_period(clkFreqSig) - posPeriodVar;
begin 
   while clkEnSig loop
      clkSig <= '1';
      wait for posPeriodVar;
      clkSig <= '0';
      wait for negPeriodVar;
   end loop;
end procedure;
-- synopsys translate_on


------------------------------------------------------------------------------
--
-- PROCEDURE NAME   : clock_gen
--
-- DESCRIPTION      : generate a clock
--
-- NOTES
--
------------------------------------------------------------------------------
-- synopsys translate_off
procedure clkgen(
   signal   clkEnSig     : in    boolean;
   signal   clkPeriodSig : in    time;
   constant clkDutySig   : in    real;
   signal   clkResetSig  : in    boolean;
   signal   clkSig       : inout std_logic) is
variable posPeriodVar : time;
variable negPeriodVar : time;
begin 
  posPeriodVar    := (clkPeriodSig * clkDutySig) / 100;
  negPeriodVar    := clkPeriodSig - posPeriodVar;
  if (clkResetSig)
  then
    clkSig <= '1';
  elsif (clkEnSig)
  then
    if (clkSig = '1')
    then
      clkSig <= '0' after posPeriodVar;
    else
      clkSig <= '1' after negPeriodVar;
    end if;  
  end if;
end procedure;
-- synopsys translate_on


------------------------------------------------------------------------------
--
-- PROCEDURE NAME   : clock_gen
--
-- DESCRIPTION      : generate a clock
--
-- NOTES
--
------------------------------------------------------------------------------
-- synopsys translate_off
procedure clkgen(
   signal   clkEnSig     : in    boolean;
   signal   clkFreqSig   : in    frequency;
   constant clkDutySig   : in    real;
   signal   clkResetSig  : in    boolean;
   signal   clkSig       : inout std_logic) is
variable posPeriodVar : time;
variable negPeriodVar : time;
begin 
  posPeriodVar    := (to_period(clkFreqSig) * clkDutySig) / 100;
  negPeriodVar    := to_period(clkFreqSig) - posPeriodVar;
  if (clkResetSig)
  then
    clkSig <= '1';
  elsif (clkEnSig)
  then
    if (clkSig = '1')
    then
      clkSig <= '0' after posPeriodVar;
    else
      clkSig <= '1' after negPeriodVar;
    end if;  
  end if;
end procedure;
-- synopsys translate_on


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : FF
--
-- DESCRIPTION     : simple flip flop procedure
-- 
-- NOTES           : synthesizeable
--
------------------------------------------------------------------------------
procedure FF
(
   signal Clk : in  std_logic;
   signal Rst : in  std_logic;
   signal D   : in  std_logic_vector;
   signal Q   : out std_logic_vector) is
variable zeros : std_logic_vector(Q'range) := (others => '0');
begin
   if (Rst = '1') then
      Q <= zeros;
   elsif Rising_Edge(Clk) then
      Q <= D;
   end if;
end procedure;


------------------------------------------------------------------------------
--
-- FUNCTION NAME   : slv_to_bcd
--
-- DESCRIPTION     : This function converts an unsigned, decending range, 
--                   binary value into a packed binary coded decimal (BCD)
--                   standard logic vector and returns the result in
--                   the number BCD digits required to represent the maximum 
--                   unsigned value possible in the vector passed to it.
--                   it is for use in pipelined implementations where
--                   the binary coded decimal output is registered
--                   and passed back to the function along with the binary
--                   vector input to be shifted out of its MSB
--                   register and into the function as a new bit.
--                   
--
-- NOTES
-- BCD_DigitsVal -> dpfslvr(vectorVal)
------------------------------------------------------------------------------
procedure slv_to_bcd(
   signal   BCD_RIn           : in  std_logic_vector;
   signal   BinIn             : in  std_logic_vector;
   signal   BinFBIn           : in  std_logic_vector;
   signal   ClkIn             : in  std_logic;
   constant BCD_DigitsVal     : in  integer;
   signal   EnIn              : in  std_logic;
   signal   RstLowIn          : in  std_logic;
   signal   BCD_ROut          : out std_logic_vector;
   signal   Bin_ROut          : out std_logic_vector; -- registed, shifted version of BinIn
   signal   DoneOut           : out std_logic) is
constant BCD_ZEROS   : std_logic_vector(BCD_ROut'range) := (others => '0');
constant BIN_ZEROS   : std_logic_vector(BinIn'range)    := (others => '0');
variable BCD_Var     : std_logic_vector(BCD_ROut'range);
variable BCD_RVar    : std_logic_vector(BCD_ROut'range);
begin
   if (RstLowIn = '0' or EnIn = '0') then
      BCD_ROut <= BCD_ZEROS;
      BCD_RVar := BIN_ZEROS;
      Bin_ROut <= BinIn;
      DoneOut  <= '0';
   elsif rising_edge(ClkIn) then
      Bin_ROut <= BinFBIn(BinFBIn'high-1 downto BinFBIn'low) & '0';
      if (BinFBIn = BIN_ZEROS) then
         BCD_ROut <= BCD_RIn;
         DoneOut  <= '1';
      else
         BCD_ROut <= slv_to_bcd_pipe(BCD_RIn,BinFBIn(BinFBIn'high),BCD_DigitsVal);
         DoneOut  <= '0';
      end if;
   end if;
end procedure;


------------------------------------------------------------------------------
end extension_pack;
------------------------------------------------------------------------------



-- end of extension pack
-- test bench starts below










































-- synopsys translate_off

------------------------------------------------------------------------------
-- Extension Pack test bench           
------------------------------------------------------------------------------

library ieee, extension_lib;
use ieee.std_logic_1164.all;
use ieee.std_logic_unsigned.all;
use ieee.std_logic_arith.all;
use extension_lib.extension_pack.all;
use extension_lib.extension_pack_constants.all;
use ieee.std_logic_textio.all;
use std.textio.all;

entity extension_pack_tb is
end extension_pack_tb;


------------------------------------------------------------------------------
architecture behavioral of extension_pack_tb is
------------------------------------------------------------------------------


------------------------------------------------------------------------------
-- Signal declarations
------------------------------------------------------------------------------


begin


star_operator_test1 : process
variable slvVar : slv(2 downto 0) := "111";
begin
   
assert (eq(7*slvVar,"0110001")) -- 7*7 = 49
report "*1 error # 1 " & LF &
   to_string("0110001") & " : expected" & LF &
   to_string(7*slvVar) & " : actual" 
severity error; 

wait;
end process;


star_operator_test2 : process
variable slvVar : slv(2 downto 0) := "111";
begin
    
assert (eq(slvVar*7,"0110001")) -- 7*7 = 49
report "*2 error # 1 " & LF &
   to_string("0110001") & " : expected" & LF &
   to_string(slvVar*7) & " : actual" 
severity error; 

wait;
end process;




--function "/"(DividendVal : std_logic_vector; 
--             DivisorVal  : std_logic_vector) return std_logic_vector;             
slash1_operator_test : process
constant slvVar : slv(6 downto 0) := "0110001";
constant \7\    : slv(6 downto 0) := "0000111";
begin
    
assert (eq("0110001"/"111",\7\)) -- 49/7 = 7
report "slash1_operator_test error # 1 " & LF &
   to_string("0000111") & " : expected" & LF &
   to_string("0110001"/"111") & " : actual" 
severity error; 

wait;
end process;



--function "/"(DividendVal : std_logic_vector; 
--             DivisorVal  : integer) return std_logic_vector; 
slash2_operator_test : process
constant slvVar : slv(6 downto 0) := "0110001";
begin
    
assert (eq(slvVar/7,"0000111")) -- 49/7 = 7
report "slash2_operator_test error # 2 " & LF &
   to_string("0000111") & " : expected" & LF &
   to_string(slvVar/7) & " : actual" 
severity error; 

wait;
end process;


            
--function "/"(DividendVal : string; 
--             DivisorVal  : integer) return std_logic_vector; 
slash3_operator_test : process
constant var : string := "49";
begin
    
assert (eq(var/7,"0000111")) -- 49/7 = 7
report "slash3_operator_test error # 1 " & LF &
   to_string("0000111") & " : expected" & LF &
   to_string(var/7) & " : actual" 
severity error; 

wait;
end process;


--function bcd_to_led(slvVal : std_logic_vector ; 
--                    CAVal  : boolean) return std_logic_vector;                  -- binary coded decimal to seven segment LED conversion
bcd_to_led1_test : process
constant slv1Var : slv := x"0123456789ABCDEF";
variable slv2Var : slv(27 downto 0);
begin
    
assert (bcd_to_led(slv1Var,true) = "0000001100111100100100000110100110001001000100000000110100000000001100111011100111111001110011110110011111000111") -- 123456789ABCDEF = 
report "bcd_to_led_test error # 1 " & LF &
   to_string("0000001100111100100100000110100110001001000100000000110100000000001100111011100111111001110011110110011111000111") & " : expected" & LF &
   to_string(bcd_to_led(slv1Var,true)) & " : actual" 
severity error; 

assert (bcd_to_led(slv1Var,false) = "1111110011000011011011111001011001110110111011111111001011111111110011000100011000000110001100001001100000111000") -- 123456789ABCDEF = 
report "bcd_to_led_test error # 2 " & LF &
   to_string("1111110011000011011011111001011001110110111011111111001011111111110011000100011000000110001100001001100000111000") & " : expected" & LF &
   to_string(bcd_to_led(slv1Var,false)) & " : actual" 
severity error; 


   slv2Var := bcd_to_led(x"3210",False);  -- 3210
   assert (slv2Var = "1111001110110101100001111110") 
   report "bcd_to_led_test error # 1 "
   severity error;
   slv2Var := bcd_to_led(x"7654",False);  -- 7654
   assert (slv2Var = "1110010101111110110110110011") 
   report "bcd_to_led_test error # 2 "
   severity error;
   slv2Var := bcd_to_led(x"1098",False);  -- 1098
   assert (slv2Var = "0110000111111011100111111111") 
   report "bcd_to_led_test error # 3 "
   severity error;
   slv2Var := bcd_to_led(x"3210",True);  -- 3210
   assert (slv2Var = "0000110001001010011110000001") 
   report "bcd_to_led_test error # 4 "
   severity error;
   slv2Var := bcd_to_led(x"7654",True); -- 7654
   assert (slv2Var = "0001101010000001001001001100") 
   report "bcd_to_led_test error # 5 "
   severity error;
   slv2Var := bcd_to_led(x"1098",True); -- 1098
   assert (slv2Var = "1001111000000100011000000000") 
   report "bcd_to_led_test error # 6 "
   severity error;
   wait;
end process;




                   
--function bcd_to_slv(vectorVal : std_logic_vector) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using enough BCD digits to represent the largest value possible in the range of the vector passed
bcd_to_slv_test : process
constant slvVar : slv := x"0123456789ABCDEF";
begin
   
assert (bcd_to_slv(slvVar) = "011100000100100010000110000111101101001110111111") -- 123456789ABCDEF = 123456790123455
report "bcd_to_slv_test error # 1 " & LF &
   to_string("011100000100100010000110000111101101001110111111") & " : expected" & LF &
   to_string(bcd_to_slv(slvVar)) & " : actual" 
severity error; 

assert (bcd_to_slv(x"1234567890") = "01001001100101100000001011010010") -- 1234567890 = 
report "bcd_to_slv_test error # 2 " & LF &
   to_string("01001001100101100000001011010010") & " : expected" & LF &
   to_string(bcd_to_slv(slvVar)) & " : actual" 
severity error;

assert (bcd_to_slv(x"ABCDEF") = "100010010010001111111") -- ABCDEF  (1123455)
report "bcd_to_slv_test error # 3 " & LF &
   to_string("100010010010001111111") & " : expected" & LF &
   to_string(bcd_to_slv(x"ABCDEF")) & " : actual" 
severity error; 


wait;
end process;


--function bcd_to_slv_pipe(BCD_RVal      : std_logic_vector;
--                         BCD_DigitsVal : integer) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using the number of BCD digits specified. For pipelined operation. function must be called N times where N is the number of bits in the passed value


--function bv_to_slv(bitVectVal : bit_vector) return std_logic_vector;            -- repackaging of "To_StdLogicVector" function
bv_to_slv_test : process
constant bvVar : bv := x"0123456789ABCDEF";
begin
   
assert (bv_to_slv(bvVar) = x"0123456789ABCDEF") -- 123456789ABCDEF = 123456790123455
report "bv_to_slv_test error # 1 " & LF &
   to_string(x"0123456789ABCDEF") & " : expected" & LF &
   to_string(bv_to_slv(bvVar)) & " : actual" 
severity error; 

assert (bv_to_slv(x"123456789ABCDEF") = x"0123456789ABCDEF") -- 123456789ABCDEF = 123456790123455
report "bv_to_slv_test error # 2 " & LF &
   to_string(x"0123456789ABCDEF") & " : expected" & LF &
   to_string(bv_to_slv(x"123456789ABCDEF")) & " : actual" 
severity error;

wait;
end process;


--function cdft(timeStrVal : string;
--              freqStrVal : string) return std_logic_vector;                      -- count for the time specified using the frequency (or period) value passed as a reference
count_down_for_time2_test : process
variable CNTTIME    : string(1 to 6) := "10 sec";
variable SYSCLKFREQ : string(1 to 5) := "66MHz";
variable slvVar : slv(3 downto 0) := "0110"; -- 8 - 2 = 6
begin
   
assert (cdft("8 ms ","1 kHz") = slvVar)
report "count_down_for_time2_test error # 1 " & LF &
   to_string("0111") & " : expected" & LF &
   to_string(cdft("8 ms ","1 kHz")) & " : actual"
severity error;

assert (cdft("8 ms ","1 kHz",cdfth("8 ms ","1 kHz")) = "0110")
report "count_down_for_time2_test error # 2 " & LF &
   to_string("0110") & " : expected" & LF &
   to_string(cdft("8 ms ","1 kHz",cdfth("8 ms ","1 kHz"))) & " : actual"
severity error;

assert (cdft("8 ms ","1 kHz",cdfth("8 ms ","1 kHz"))'length = 4)
report "count_down_for_time2_test error # 3 " & LF &
   to_string(4) & " : expected" & LF &
   to_string(cdft("8 ms ","1 kHz",cdfth("8 ms ","1 kHz"))'length) & " : actual"
severity error;

wait;
end process;


--function cdft(timeStrVal : string;
--              freqStrVal : string;
--              natVal     : natural) return std_logic_vector;                    -- count for the time specified (minus a count of 2 for latency) using the frequency (or period) value passed as a reference and the natural value passed as a length for the vector (if it will fit in a vector that size)




--function cdfth(timeStrVal : string;
--              freqStrVal : string) return integer;                              -- returns the high value to be used in the range declaration of a vector used to represent the time specified using the frequency (or period) value passed as a reference
count_down_for_time_high_test : process
variable CNTTIME    : string(1 to 6) := "10 sec";
variable SYSCLKFREQ : string(1 to 5) := "66MHz";
variable slvVar : slv(3 downto 0) := "0110"; -- 8 - 2 = 6
begin
   
assert (cdfth("1 us ","1E-15 yHz") = 10)
report "count_down_for_time_high_test error # 1 " & LF &
   to_string(10) & " : expected" & LF &
   to_string(cdfth("1 us ","1E-15 yHz")) & " : actual"
severity error;

   
assert (cdfth("8 ms ","1 kHz") = 3)
report "count_down_for_time_high_test error # 2 " & LF &
   to_string(3) & " : expected" & LF &
   to_string(cdfth("8 ms ","1 kHz")) & " : actual"
severity error;

wait;
end process;





--function ceil(RealVal : in real ) return real;                                  -- rounds a real value up the the next highest real integer
ceil_test : process
begin
   
assert (ceil(-9.999999) = -9.0) 
report "ceil_test error # 1 " & LF &
   to_string(-9.0) & " : expected" & LF &
   to_string(ceil(-9.999999)) & " : actual" 
severity error; 

assert (ceil(9.999999) = 10.0) 
report "ceil_test error # 2 " & LF &
   to_string(10.0) & " : expected" & LF &
   to_string(ceil(9.999999)) & " : actual" 
severity error; 

wait;
end process;



--function cfi(intVal : integer) return natural;
cfi_test : process
begin
   
assert (cfi(-1000) = 5)
report "cfi_test error # 1 " & LF &
   "5 : expected" & LF &
   to_string(cfi(-1000)) & " : actual" 
severity error; 

assert (cfi(-10000) = 6)
report "cfi_test error # 2 " & LF &
   "6 : expected" & LF &
   to_string(cfi(-10000)) & " : actual" 
severity error; 

assert (cfi(1000) = 4)
report "cfi_test error # 3 " & LF &
   "4 : expected" & LF &
   to_string(cfi(1000)) & " : actual" 
severity error; 

assert (cfi(-100_000) = 7)
report "cfi_test error # 4 " & LF &
   "7 : expected" & LF &
   to_string(cfi(-100_000)) & " : actual" 
severity error; 

assert (cfi(100_000) = 6)
report "cfi_test error # 5 " & LF &
   "6 : expected" & LF &
   to_string(cfi(100_000)) & " : actual" 
severity error; 

assert (cfi(-9999999) = 8) 
report "cfi_test error # 6 " & LF &
   to_string(8) & " : expected" & LF &
   to_string(cfi(-9999999)) & " : actual" 
severity error; 

assert (cfi(9999999) = 7) 
report "cfi_test error # 7 " & LF &
   to_string(7) & " : expected" & LF &
   to_string(cfi(9999999)) & " : actual" 
severity error;

wait;
end process;


--function cft(timeStrVal : string;
--             freqStrVal : string) return std_logic_vector;                      -- count for the time specified using the frequency (or period) value passed as a reference
count_for_time_test : process
variable CNTTIME    : string(1 to 6) := "10 sec";
variable SYSCLKFREQ : string(1 to 5) := "66MHz";
variable slvVar : slv(20 downto 0);
begin

assert (cft(CNTTIME,SYSCLKFREQ) = "100111010101101100110100000000")
report "count_for_time_test error # 1 " & LF &
   to_string("100111010101101100110100000000") & " : expected" & LF &
   to_string(cft(CNTTIME,SYSCLKFREQ)) & " : actual"
severity error;

assert (cft("1 min","66MHz") = "11101100000010001100111000000000")
report "count_for_time_test error # 2 " & LF &
   to_string("11101100000010001100111000000000") & " : expected" & LF &
   to_string(cft("1 min","66MHz")) & " : actual"
severity error;

assert (cft("1 hr","66MHz") = "11011101010010000100000100100000000000")
report "count_for_time_test error # 3 " & LF &
   to_string("11011101010010000100000100100000000000") & " : expected" & LF &
   to_string(cft("1 hr","66MHz")) & " : actual"
severity error;

assert (cft("1 day","66MHz") = "01010010111110110001100001101100000000000000")
report "count_for_time_test error # 4 " & LF &
   to_string("01010010111110110001100001101100000000000000") & " : expected" & LF &
   to_string(cft("1 day","66MHz")) & " : actual"
severity error;

assert (cft("1 day","66MHz")+cft("1 hr","66MHz")+cft("1 min","66MHz")+cft("1 sec","66MHz")+cft("1 ms","66MHz")+cft("1 us","66MHz")+cft("1 ns","66MHz")+cft("1 ps","66MHz")+cft("1 fs","66MHz") = "01010110011111110011100011111110110010010010")
report "count_for_time_test error # 5 " & LF &
   to_string("01010110011111110011100011111110110010010010") & " : expected" & LF &
   to_string(cft("1 day","66MHz")+cft("1 hr","66MHz")+cft("1 min","66MHz")+cft("1 sec","66MHz")+cft("1 ms","66MHz")+cft("1 us","66MHz")+cft("1 ns","66MHz")+cft("1 ps","66MHz")+cft("1 fs","66MHz")) & " : actual" & LF &
   to_string(cft("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs","66MHz")) & " : actual"
severity error;

assert (cft("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs","66MHz") = "01010110011111110011100011111110110010010010")
report "count_for_time_test error # 6 " & LF &
   to_string("01010110011111110011100011111110110010010010") & " : expected" & LF &
   to_string(cft("1 day","66MHz")+cft("1 hr","66MHz")+cft("1 min","66MHz")+cft("1 sec","66MHz")+cft("1 ms","66MHz")+cft("1 us","66MHz")+cft("1 ns","66MHz")+cft("1 ps","66MHz")+cft("1 fs","66MHz")+cft("1 as","66MHz")+cft("1 zs","66MHz")+cft("1 ys","66MHz")) & " : actual" & LF &
   to_string(cft("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs 1as 1zs 1ys","66MHz")) & " : actual"
severity error;

assert (cft("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs  1as 1zs 1ys","66MHz") = "01010110011111110011100011111110110010010010")
report "count_for_time_test error # 7 " & LF &
   to_string("01010110011111110011100011111110110010010010") & " : expected" & LF &
   to_string(cft("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs 1as 1zs 1ys","66MHz")) & " : actual"
severity error;

assert (cft("1 ns 1 ps 1 fs 1as 1zs 1ys","1YHz") = "011100011100110011110110101000101011010000000101001")
report "count_for_time_test error # 8 " & LF &
   to_string("01010110011111110011100011111110110010010010") & " : expected" & LF &
   to_string(cft("1 ns 1 ps 1 fs 1as 1zs 1ys","1YHz")) & " : actual"
severity error;

assert (cft("1 sec","1E-3 kHz") = "01")
report "count_for_time_test error # 9 " & LF &
   to_string("01") & " : expected" & LF &
   to_string(cft("1 sec","1E-3 kHz")) & " : actual"
severity error;

assert (cft("1 sec","1E-18 eHz") = "01")
report "count_for_time_test error # 10 " & LF &
   to_string("01") & " : expected" & LF &
   to_string(cft("1 sec","1E-18 eHz")) & " : actual"
severity error;

assert (cft("1 ns ","1E-15 yHz") = "01")
report "count_for_time_test error # 11 " & LF &
   to_string("01010110011111110011100011111110110010010010") & " : expected" & LF &
   to_string(cft("1 ns ","1E-15 yHz")) & " : actual"
severity error;

assert (cft("1 us ","1E-15 yHz") = "01111101000")
report "count_for_time_test error # 12 " & LF &
   to_string("01111101000") & " : expected" & LF &
   to_string(cft("1 us ","1E-15 yHz")) & " : actual"
severity error;

slvVar := ext(cft("20 ms ","50 MHz"),21);

assert (ext(cft("20 ms ","50 MHz"),21) = "011110100001001000000")
report "count_for_time_test error # 13 " & LF &
   to_string("01111101000") & " : expected" & LF &
   to_string(ext(cft("20 ms ","50 MHz"),25)) & " : actual"
severity error;

wait;
end process;


--function cft(timeStrVal : string;
--             freqStrVal : string;
--             natVal     : natural) return std_logic_vector;                     -- count for the time specified using the frequency (or period) value passed as a reference and the integer value passed as a length for the vector (if it will fit in a vector that size)
             



--function cfth(timeStrVal : string;
--              freqStrVal : string) return integer;                              -- returns the high value to be used in the range declaration of a vector used to represent the time specified using the frequency (or period) value passed as a reference
count_for_time_high_test : process
begin
   
assert (cfth("1 us ","1E-15 yHz") = 10)
report "count_for_time_high_test error # 1 " & LF &
   to_string(10) & " : expected" & LF &
   to_string(cfth("1 us ","1E-15 yHz")) & " : actual"
severity error;

wait;
end process;


--function cfth(timeStrVal : string;
--              freqStrVal : string) return std_logic_vector;                      -- count for the time specified using the frequency (or period) value passed as a reference
count_for_time_high_test2 : process
variable CNTTIME    : string(1 to 6) := "10 sec";
variable SYSCLKFREQ : string(1 to 5) := "66MHz";
variable slvVar : slv(3 downto 0) := "0110"; -- 8 - 2 = 6
begin
   
assert (cfth("8 ms ","1 kHz") = 4)
report "count_for_time_high_test2 error # 1 " & LF &
   to_string(4) & " : expected" & LF &
   to_string(cfth("8 ms ","1 kHz")) & " : actual"
severity error;

wait;
end process;


--function clkcnt(freq1StrVal : string;
--                freq2StrVal : string) return std_logic_vector;                      -- count for the time specified using the frequency (or period) value passed as a reference
clock_count_test : process
begin
   
assert (clkcnt("1 kHz","50 MHz") = "110000110100111")
report "clock_count_test error # 1 " & LF &
   to_string("110000110100111") & " : expected" & LF &
   to_string(clkcnt("1 kHz","50 MHz")) & " : actual"
severity error;

wait;
end process;


--function conv_to_hex(vectorVal : bit_vector) return string;                     -- bit_vector to hexadecimal conversion
conv_to_hex_test1 : process
variable testVar : bv(63 downto 0) := x"0123456789ABCDEF";
begin
   
assert (conv_to_hex(testVar) = "0123456789ABCDEF")
report "conv_to_hex_test1 error # 1 " & LF &
   "0123456789ABCDEF" & " : expected" & LF &
   conv_to_hex(testVar) & " : actual"
severity error;

wait;
end process;


--function conv_to_hex(vectorVal : std_logic_vector) return string;               -- std_logic_vector to hexadecimal conversion
conv_to_hex_test2 : process
variable testVar : slv(63 downto 0) := x"0123456789ABCDEF";
begin
   
assert (conv_to_hex(testVar) = "0123456789ABCDEF")
report "conv_to_hex_test2 error # 1 " & LF &
   "0123456789ABCDEF" & " : expected" & LF &
   conv_to_hex(testVar) & " : actual"
severity error;

wait;
end process;


--function conv_to_hex(vectorVal : std_ulogic_vector) return string;              -- std_ulogic_vector to hexadecimal conversion
conv_to_hex_test3 : process
variable testVar : slv(63 downto 0) := x"0123456789ABCDEF";
begin
   
assert (conv_to_hex(testVar) = "0123456789ABCDEF")
report "conv_to_hex_test3 error # 1 " & LF &
   "0123456789ABCDEF" & " : expected" & LF &
   conv_to_hex(testVar) & " : actual"
severity error;

wait;
end process;



--function cslv(int1Val : integer; 
--              int2Val : integer) return std_logic_vector;                       -- repackaging of "conv_std_logic_vector"
-- repackaged functions not tested

--function cslv(sigVal : signed;   
--              intVal : integer) return std_logic_vector;                        -- repackaging of "conv_std_logic_vector"
-- repackaged functions not tested

--function cslv(usgVal : unsigned; 
--              intVal : integer) return std_logic_vector;                        -- repackaging of "conv_std_logic_vector"
-- repackaged functions not tested


--function cuft(timeStrVal : string;
--             freqStrVal : string) return std_logic_vector;                      -- count for the time specified using the frequency (or period) value passed as a reference
count_up_for_time_test : process
variable CNTTIME    : string(1 to 6) := "10 sec";
variable SYSCLKFREQ : string(1 to 5) := "66MHz";
variable slvVar : slv(20 downto 0);
begin


assert (cuft(CNTTIME,SYSCLKFREQ) = "100111010101101100110011111111")
report "count_up_for_time_test error # 1 " & LF &
   to_string("100111010101101100110011111111") & " : expected" & LF &
   to_string(cuft(CNTTIME,SYSCLKFREQ)) & " : actual"
severity error;


assert (cuft("1 min","66MHz") = "11101100000010001100110111111111")
report "count_for_time_test error # 2 " & LF &
   to_string("11101100000010001100110111111111") & " : expected" & LF &
   to_string(cuft("1 min","66MHz")) & " : actual"
severity error;


assert (cuft("1 hr","66MHz") = "11011101010010000100000100011111111111")
report "count_up_for_time_test error # 3 " & LF &
   to_string("11011101010010000100000100011111111111") & " : expected" & LF &
   to_string(cuft("1 hr","66MHz")) & " : actual"
severity error;


assert (cuft("1 day","66MHz") = "1010010111110110001100001101011111111111111")
report "count_up_for_time_test error # 4 " & LF &
   to_string("1010010111110110001100001101011111111111111") & " : expected" & LF &
   to_string(cuft("1 day","66MHz")) & " : actual"
severity error;




assert (cuft("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs","66MHz") = "1010110011111110011100011111110110010010001")
report "count_up_for_time_test error # 6 " & LF &
   to_string("1010110011111110011100011111110110010010001") & " : expected" & LF &
   to_string(cuft("1 day","66MHz")+cuft("1 hr","66MHz")+cuft("1 min","66MHz")+cuft("1 sec","66MHz")+cuft("1 ms","66MHz")+cuft("1 us","66MHz")+cuft("1 ns","66MHz")+cuft("1 ps","66MHz")+cuft("1 fs","66MHz")+cuft("1 as","66MHz")+cuft("1 zs","66MHz")+cuft("1 ys","66MHz")) & " : actual" & LF &
   to_string(cuft("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs 1as 1zs 1ys","66MHz")) & " : actual"
severity error;



assert (cuft("1 ns 1 ps 1 fs 1as 1zs 1ys","1YHz") = "11100011100110011110110101000101011010000000101000")
report "count_up_for_time_test error # 8 " & LF &
   to_string("11100011100110011110110101000101011010000000101000") & " : expected" & LF &
   to_string(cuft("1 ns 1 ps 1 fs 1as 1zs 1ys","1YHz")) & " : actual"
severity error;

assert (cuft("1 sec","1E-3 kHz") = "0")
report "count_up_for_time_test error # 9 " & LF &
   to_string("00") & " : expected" & LF &
   to_string(cuft("1 sec","1E-3 kHz")) & " : actual"
severity error;

assert (cuft("1 sec","1E-18 eHz") = "0")
report "count_up_for_time_test error # 10 " & LF &
   to_string("00") & " : expected" & LF &
   to_string(cuft("1 sec","1E-18 eHz")) & " : actual"
severity error;

assert (cuft("1 ns ","1E-15 yHz") = "0")
report "count_up_for_time_test error # 11 " & LF &
   to_string("0") & " : expected" & LF &
   to_string(cuft("1 ns ","1E-15 yHz")) & " : actual"
severity error;

assert (cuft("1 us ","1E-15 yHz") = "1111100111")
report "count_up_for_time_test error # 12 " & LF &
   to_string("1111100111") & " : expected" & LF &
   to_string(cuft("1 us ","1E-15 yHz")) & " : actual"
severity error;

slvVar := ext(cuft("20 ms ","50 MHz"),21);

assert (ext(cuft("20 ms ","50 MHz"),25) = "0000011110100001000111111")
report "count_up_for_time_test error # 13 " & LF &
   to_string("0000011110100001000111111") & " : expected" & LF &
   to_string(ext(cuft("20 ms ","50 MHz"),25)) & " : actual"
severity error;

wait;
end process;


--function cufth(timeStrVal : string;
--              freqStrVal : string) return integer;                              -- returns the high value to be used in the range declaration of a vector used to represent the time specified using the frequency (or period) value passed as a reference
count_up_for_time_high_test : process
variable CNTTIME    : string(1 to 6) := "10 sec";
variable SYSCLKFREQ : string(1 to 5) := "66MHz";
variable slvVar : slv(3 downto 0) := "0110"; -- 8 - 2 = 6
begin
   
assert (cufth("1 us ","1E-15 yHz") = 9)
report "count_up_for_time_high_test error # 1 " & LF &
   to_string(9) & " : expected" & LF &
   to_string(cufth("1 us ","1E-15 yHz")) & " : actual"
severity error;

assert (cufth("8 ms ","1 kHz") = 2)
report "count_up_for_time_high_test2 error # 1 " & LF &
   to_string(2) & " : expected" & LF &
   to_string(cufth("8 ms ","1 kHz")) & " : actual"
severity error;

wait;
end process;

--function dpfi(intVal : integer) return natural;                                 -- returns the number of decimal places for an integer value

--function dpfi_syn(intVal : integer) return natural;                             -- returns the number of decimal places for an integer value

--function dpfr(realVal : real) return natural;                                   -- returns the number of decimal places to the left of the decimal point for a real value



--function dpfslvr(vectorVal : std_logic_vector) return natural;                  -- returns the number of decimal places needed to represent the full range of the std_logic_vector passed


--function dpfslvv(vectorVal : std_logic_vector) return natural;                  -- returns the number of decimal places needed to represent the value of the std_logic_vector passed

--function eq(vector1Val : std_logic_vector;
--            vector2Val : std_logic_vector) return boolean;                      -- equality check function that is sensitive to vector length


--function ext2(vectorVal : std_logic_vector;
--              natVal    : natural) return std_logic_vector;                     -- returns a standard logic vector, padded with zeros, to the length specified by intVal unless the vector is already longer than that
ext_test : process
constant slvVar : slv := "0111";
variable slv1Var : slv(11 downto 0);
variable slv2Var : slv(11 downto 0);
variable slv3Var : slv(slv1Var'range);

begin
   
slv1Var := ext2(int_to_slv(1000),slv1Var'length);
slv2Var := ext2(int_to_slv(6),slv2Var'length);

assert (ext2(slvVar,7) = "0000111") -- 7 bits
report "ext_test error # 1 " & LF &
   to_string("0000111") & " : expected" & LF &
   to_string(ext2(slvVar,7)) & " : actual" 
severity error; 

assert (ext2(slvVar,4) = "0111") -- 4 bits
report "ext_test error # 2 " & LF &
   to_string("0000111") & " : expected" & LF &
   to_string(ext2(slvVar,4)) & " : actual" 
severity error;

assert (ext2(slvVar,4)'length = 4) -- 4 bits
report "ext_test error # 3 " & LF &
   to_string(4) & " : expected" & LF &
   to_string(ext2(slvVar,4)'length) & " : actual" 
severity error;

wait;
end process;

--function flip(vectorVal : bit_vector) return bit_vector;                        -- returns a bit_vector with all the bits in the reverse order

--function flip(vectorVal : std_logic_vector) return std_logic_vector;            -- returns a std_logic_vector with all the bits in the reverse order

--function flip(vectorVal : std_ulogic_vector) return std_ulogic_vector;          -- returns a std_ulogic_vector with all the bits in the reverse order

--function hex_to_slv(stringVal : string) return std_logic_vector;                -- converts a Hexadeximal string to a standard logic vector

--function int_to_slv(intVal : integer) return std_logic_vector;                  -- returns a std_logic_vector value just large enough to represent the integer value passed

--function itoa(intVal : integer) return string;                                  -- common integer to string conversion function

--function lfsr(vectorVal : std_ulogic_vector) return std_logic;                  -- returns the input to a Linear Feedback Shift Register (LFSR) using x^6 + x^5 + x^3 + x^2 + 1 as the primitive feedback polynomial
lfsr_test : process
constant OUTPUT_FILE  : string := "../lfsr_test_logfile.txt";
variable LogFileLine  : line;
file     LogFile      : text open write_mode is OUTPUT_FILE;
type LFSRAccessType is access std_logic_vector;
type SeedAccessType is access std_logic_vector;
variable LFSRVar : LFSRAccessType;
variable SeedVar : SeedAccessType;
variable LFSRTestVar : slv(7 downto 0);
begin
   write(logFileLine, string'("LFSR        Maximal     repeats"));
   writeLine(LogFile,logFileLine);
   write(logFileLine, string'("length      length?     after"));
   writeLine(LogFile,logFileLine);
   write(logFileLine, string'("__________________________________"));
   writeLine(LogFile,logFileLine);
   for outrLoopVar in 2 to 2 loop
      LFSRVar     := new std_logic_vector(outrLoopVar-1 downto 0);
      for loopVar in outrLoopVar-1 downto 0 loop
         LFSRVar.all(loopVar) := '1';
      end loop;
      SeedVar     := new std_logic_vector(outrLoopVar-1 downto 0);
      for loopVar in outrLoopVar-1 downto 0 loop
         SeedVar.all(loopVar) := '1';
      end loop;
      for loopVar in 1 to (2**LFSRVar'length)+2 loop
         --write(logFileLine, "LFSR Value : " & to_string(LFSRVar.all));
         --writeLine(LogFile,logFileLine);
         LFSRVar.all := lfsr(LFSRVar.all);
         if (LFSRVar.all = SeedVar.all and loopVar < (2**LFSRVar.all'length)-1 and loopVar /= 1) then
            write(logFileLine, to_string(LFSRVar.all'length) & "           " &  "No          " & to_string(loopVar));
            writeLine(LogFile,logFileLine);
            exit;
         elsif (LFSRVar.all = SeedVar.all) then
            write(logFileLine, to_string(LFSRVar.all'length) & "           " &  "Yes         " & to_string(loopVar));
            writeLine(LogFile,logFileLine);
            exit;
         end if;
      end loop;
      deallocate(LFSRVar);
      deallocate(SeedVar);
   end loop;
   LFSRTestVar := "11111111";
   LFSRTestVar := lfsr(LFSRTestVar);
   
   write(logFileLine, "LFSR stop value : " & to_string(lfsr_cft("100 us","50 MHz")));
   writeLine(LogFile,logFileLine);
   
   wait;
end process;



--function lfsr_cft(timeStrVal : string;
--                  freqStrVal : string;
--                  seedVal    : std_logic_vector) return std_logic_vector;       -- returns the value that the LFSR will contain after the amount of time specified using the frequency (or period) value passed as a reference and the seed value passed as a starting point
--lfsr_cft_test : process
--
--   constant OUTPUT_FILE  : string := "../lfsr_stop_val_test_logfile.txt";
--   variable LogFileLine  : line;
--   file     LogFile      : text open write_mode is OUTPUT_FILE;
--
--constant timeVar : string := "1 us";
--constant freqVar : string := "50 MHz";
--variable LFSRVar : std_logic_vector(cufth(timeVar,freqVar) downto 0);
--variable LFSRCompleteVar : std_logic_vector(LFSRVar'range);
--variable LFSRCountTime : time;
--variable LFSRCount : integer;
--
--begin
--   LFSRCompleteVar := lfsr_cft(timeVar,freqVar);
--   LFSRCountTime := 0 ns;
--   LFSRCount := 0;
--   LFSRVar := (others => '1');
--   while TRUE loop
--      LFSRVar := lfsr(LFSRVar);
--      wait for to_period(50 MHz);
--      LFSRCountTime := LFSRCountTime + to_period(50 MHz);
--      LFSRCount := LFSRCount + 1;
--      if (LFSRVar = LFSRCompleteVar) then
--         exit;
--      end if;
--   end loop;
--     
--wait;
--   
--end process;





--function mult_s(Multiplier    : std_logic_vector; 
--                Multiplicand  : std_logic_vector) return std_logic_vector;      -- signed multiply
signed_mult_test : process

begin

assert (mult_s("011","011") = "001001") -- 0
report "mult_s error # 1 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_s("011","011")) & " : actual" 
severity error; 

assert (mult_s("011","011") = "001001") -- 0
report "mult_s error # 2 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_s("011","011")) & " : actual" 
severity error; 

assert (mult_s("000","011") = "000000") -- 0
report "mult_s error # 3 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_s("000","011")) & " : actual" 
severity error; 

assert (mult_s("011","000") = "000000") -- 0
report "mult_s error # 4 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_s("011","000")) & " : actual" 
severity error; 

assert (mult_s("000","101") = "000000") -- 0
report "mult_s error # 5 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_s("000","101")) & " : actual" 
severity error; 

assert (mult_s("101","000") = "000000") -- 0
report "mult_s error # 6 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_s("101","000")) & " : actual" 
severity error; 

assert (mult_s("011","101") = "110111") -- 3 * (-3) = -9
report "mult_s error # 7 " & LF &
   to_string("110111") & " : expected" & LF &
   to_string(mult_s("011","101")) & " : actual" 
severity error; 

assert (mult_s("011","100") = "110100") -- 3 * (-4) = -12
report "mult_s error # 8 " & LF &
   to_string("110100") & " : expected" & LF &
   to_string(mult_s("011","100")) & " : actual" 
severity error; 

assert (mult_s("101","101") = "001001") -- (-3) * (-3) = 9
report "mult_s error # 9 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_s("101","101")) & " : actual" 
severity error; 

assert (mult_s("011","011") = "001001") -- 0
report "mult_s error # 10 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_s("011","011")) & " : actual" 
severity error; 

assert (mult_s("011","011") = "001001") -- 0
report "mult_s error # 11 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_s("011","011")) & " : actual" 
severity error; 


assert (mult_s("100","100") = "010000") -- -4 * -4 = 16
report "mult_s error # 11 " & LF &
   to_string("010000") & " : expected" & LF &
   to_string(mult_s("100","100")) & " : actual" 
severity error; 



wait;

end process;


--function mult_us(Multiplier    : std_logic_vector; 
--                 Multiplicand  : std_logic_vector) return std_logic_vector;     -- unsigned multiply
unsigned_mult_test : process

begin

assert (mult_us("011","011") = "001001") -- 0
report "mult error # 1 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_s("011","011")) & " : actual" 
severity error; 

assert (mult_us("011","011") = "001001") -- 0
report "mult error # 2 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_us("011","011")) & " : actual" 
severity error; 

assert (mult_us("000","011") = "000000") -- 0
report "mult error # 3 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_us("000","011")) & " : actual" 
severity error; 

assert (mult_us("011","000") = "000000") -- 0
report "mult error # 4 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_us("011","000")) & " : actual" 
severity error; 

assert (mult_us("000","101") = "000000") -- 0
report "mult error # 5 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_us("000","101")) & " : actual" 
severity error; 

assert (mult_us("101","000") = "000000") -- 0
report "mult error # 6 " & LF &
   to_string("000000") & " : expected" & LF &
   to_string(mult_us("101","000")) & " : actual" 
severity error; 

assert (mult_us("011","011") = "001001") -- 0
report "mult error # 7 " & LF &
   to_string("001001") & " : expected" & LF &
   to_string(mult_us("011","011")) & " : actual" 
severity error; 

wait;

end process;


--function nat_to_slv(natVal : natural) return std_logic_vector;                  -- returns a std_logic_vector value just large enough to represent the natural value passed



--function neg(VectorVal : std_logic_vector) return std_logic_vector;             -- returns the negated value


--function now return string;                                                     -- returns a string representation of the current simulation time
now_test : process

begin

wait for 3 sec;

assert (now = time'image(now))
report "now_test error # 1 " & LF &
   time'image(now) & " : expected" & LF &
   now & " : actual" 
severity error;

wait;
end process;


--function reduce(vectorVal : std_logic_vector) return std_logic_vector;          -- returns a std_logic_vector value just large enough to represent the standard logic vector value passed
reduce_test : process

begin

assert (reduce("00000") = "00") -- 0
report "reduce error # 1 " & LF &
   to_string("11") & " : expected" & LF &
   to_string(reduce("00000")) & " : actual" 
severity error; 

assert (reduce("00001") = "01") -- 1
report "reduce error # 2 " & LF &
   "expected : " & to_string("01") & LF &
   "actual   : " & to_string(reduce("00001"))
severity error; 

assert (reduce("11111") = "11") -- -1
report "reduce error # 3 " & LF &
   "expected : " & to_string("11") & LF &
   "actual   : " & to_string(reduce("11111"))
severity error; 
   
assert (reduce("10000") = "10000") -- -16
report "reduce error # 4 " & LF &
   "expected : " & to_string("10000") & LF &
   "actual   : " & to_string(reduce("10000"))
severity error; 

wait;

end process;


--function reduce_high(vectorVal : std_logic_vector) return integer;              -- returns a std_logic_vector value just large enough to represent the standard logic vector value passed

--function reduce_high_unsigned(vectorVal : std_logic_vector) return integer;     -- returns an integer value that represents the vector'high value of a vector just large enough to represent the standard logic vector value passed

--function reduce_length(vectorVal : std_logic_vector) return integer;            -- returns an integer value that represents the vector'length value of a vector just large enough to represent the standard logic vector value passed (including a sign bit)

--function reduce_length_unsigned(vectorVal : std_logic_vector) return integer;   -- returns an integer value that represents the vector'length value of a vector just large enough to represent the standard logic vector value passed

--function reduce_unsigned(vectorVal : std_logic_vector) return std_logic_vector; -- returns a std_logic_vector value just large enough to represent the standard logic vector value passed


--function seq(str1Val : string; 
--             str2Val : string) return boolean; 



--function shl(vectorVal : std_logic_vector;
--             natVal    : natural) return std_logic_vector;



--function slv_to_bcd(vectorVal     : std_logic_vector;
--                    BCD_DigitsVal : integer) return std_logic_vector;           -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using the number of BCD digits specified



--function slv_to_bcd(vectorVal : std_logic_vector) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using enough BCD digits to represent the largest value possible in the range of the vector passed



--function slv_to_bcd_pipe(BCD_RVal      : std_logic_vector;
--                         MSB_Val       : std_logic; 
--                         BCD_DigitsVal : integer) return std_logic_vector;      -- returns a packed BCD number in std_logic_vector form from the std_logic_vector passed to it using the number of BCD digits specified. For pipelined operation. function must be called N times where N is the number of bits in the passed value



--function str_to_int(stringVal : string) return integer;                         -- converts an Integer string to an integer
str_to_int_test : process
variable intVar  : integer;
begin
   intVar := str_to_int("10");  -- 3210
   assert (intVar = 10) 
   report "str_to_int_test error # 1 " & LF &
      "expected : 10" & LF &
      "actual   : " & to_string(intVar)
   severity error;
   
      intVar := str_to_int("E-10 sec");  -- 3210
   assert (intVar = -10) 
   report "str_to_int_test error # 2 " & LF &
      "expected : -10" & LF &
      "actual   : " & to_string(intVar)
   severity error;
   
      intVar := str_to_int("E-6 sec");  -- 3210
   assert (intVar = -6) 
   report "str_to_int_test error # 3 " & LF &
      "expected : -6" & LF &
      "actual   : " & to_string(intVar)
   severity error;
   
   wait;
end process;


--function str_to_led(stringVal : string; 
--                    CAVal     : boolean) return std_logic_vector;               -- converts a Hexadecimal string of any length to a std_logic_vector for seven segment LEDs



--function str_to_slv(stringVal : string) return std_logic_vector;                -- converts an Integer, in string form, of any length to a std_logic_vector
str_to_slv_test : process
begin

assert (str_to_slv("1") = "01") -- 0
report "bcd_to_led_test error # 1 " & LF &
to_string("01") & " : expected" & LF &
to_string(str_to_slv("1")) & " : actual" 
severity error;
 
assert (str_to_slv("0") = "0") -- 0
report "bcd_to_led_test error # 1 " & LF &
to_string("00") & " : expected" & LF &
to_string(str_to_slv("0")) & " : actual" 
severity error; 

assert (str_to_slv("-1") = "11") -- -1
report "bcd_to_led_test error # 1 " & LF &
to_string("11") & " : expected" & LF &
to_string(str_to_slv("-1")) & " : actual" 
severity error; 

assert (str_to_slv("10 us") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 1 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv("10 us"))
severity error;

assert (str_to_slv(" 10 us") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 2 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10 us"))
severity error;

assert (str_to_slv(" 10 us ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 3 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10 us "))
severity error;

assert (str_to_slv(" 10.0 us ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 4 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10.0 us "))
severity error;

assert (str_to_slv(" 0.0100 ms ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 5 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 0.0100 ms "))
severity error;   

assert (str_to_slv(" 0.0000100sec ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 6 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 0.0000100sec "))
severity error;  

assert (str_to_slv(" 10E-6 sec ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 6a " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10E-6 sec "))
severity error;  


assert (str_to_slv(" 10,000,000,000 ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 7 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10,000,000,000 "))
severity error;  

assert (str_to_slv(" 100,000Hz ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 8 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 100,000Hz "))
severity error;  


assert (str_to_slv(" 100kHz ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 9 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 100kHz "))
severity error;  

assert (str_to_slv(" 0.1MHz ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 9a " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 0.1MHz "))
severity error;  

assert (str_to_slv(" .1 MHz ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 9b " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" .1 MHz "))
severity error; 

assert (str_to_slv(" 0.0001GHz ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 10 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 0.0001GHz "))
severity error;  


assert (str_to_slv(" 10E 9 ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 11 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10E 9 "))
severity error; 


assert (str_to_slv(" 10E+9 ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 12 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10E+9 "))
severity error; 


assert (str_to_slv(" 10.0000000E+9 ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 13 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10.0000000E+9 "))
severity error; 


 assert (str_to_slv(" 10.0000000E+9.000 ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 13b " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 10.0000000E+9.000 "))
severity error; 

assert (str_to_slv(" 100E+3 HZ") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 14 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 100E+3 HZ"))
severity error; 


assert (str_to_slv(" 1") = "01") 
report "str_to_slv_test error # 15a " & LF &
"expected : " & to_string("01") & LF &
"actual   : " & to_string(str_to_slv(" 1"))
severity error;

assert (str_to_slv(" -1") = "11") 
report "str_to_slv_test error # 15b " & LF &
"expected : " & to_string("11") & LF &
"actual   : " & to_string(str_to_slv(" -1"))
severity error; 


assert (str_to_slv("1") = "01") 
report "str_to_slv_test error # 16 " & LF &
to_string("01") & " : expected"
& LF &
to_string(str_to_slv("1")) & " : actual"
severity error; 

assert (str_to_slv("10") = "01010") 
report "str_to_slv_test error # 17 " & LF &
to_string("01010") & " : expected"
& LF &
to_string(str_to_slv("10")) & " : actual"
severity error; 

assert (str_to_slv(" 100E+3 HZ ps ns MHz") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 18 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 100E+3 HZ"))
severity error; 

assert (str_to_slv(" 100E+3 HZ Hz") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 19 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 100E+3 HZ"))
severity error; 

assert (str_to_slv(" 100,000 HZ 234sec") = "01001010100000010111110010000000000") 
report "str_to_slv_test error # 20 " & LF &
"expected : " & to_string("01001010100000010111110010000000000") & LF &
"actual   : " & to_string(str_to_slv(" 100E+3 HZ 234sec"))
severity error; 

assert (str_to_slv("1 day") = "01001010111100001010011101100011101110110001110000000000000000000000") -- 0
report "str_to_slv_test error # 21 " & LF &
to_string("01001010111100001010011101100011101110110001110000000000000000000000") & " : expected" & LF &
to_string(str_to_slv("1 day")) & " : actual" 
severity error;

assert (str_to_slv("1 hr") = "011000111110101110001001110110100100111011010000000000000000000") -- 0
report "str_to_slv_test error # 22 " & LF &
to_string("011000111110101110001001110110100100111011010000000000000000000") & " : expected" & LF &
to_string(str_to_slv("1 hr")) & " : actual" 
severity error;

assert (str_to_slv("1 min") = "011010101001010011010111010011110100001100000000000000000") -- 0
report "str_to_slv_test error # 23 " & LF &
to_string("011010101001010011010111010011110100001100000000000000000") & " : expected" & LF &
to_string(str_to_slv("1 min")) & " : actual" 
severity error;

assert (str_to_slv("1 sec") = "011100011010111111010100100110001101000000000000000") -- 0
report "str_to_slv_test error # 24 " & LF &
to_string("011100011010111111010100100110001101000000000000000") & " : expected" & LF &
to_string(str_to_slv("1 sec")) & " : actual" 
severity error;

assert (str_to_slv("1 ms") = "01110100011010100101001010001000000000000") -- 0
report "str_to_slv_test error # 25 " & LF &
to_string("01110100011010100101001010001000000000000") & " : expected" & LF &
to_string(str_to_slv("1 ms")) & " : actual" 
severity error;

assert (str_to_slv("1 us") = "0111011100110101100101000000000") -- 0
report "str_to_slv_test error # 26 " & LF &
to_string("0111011100110101100101000000000") & " : expected" & LF &
to_string(str_to_slv("1 us")) & " : actual" 
severity error;

assert (str_to_slv("1 ns") = "011110100001001000000") -- 0
report "str_to_slv_test error # 27 " & LF &
to_string("011110100001001000000") & " : expected" & LF &
to_string(str_to_slv("1 ns")) & " : actual" 
severity error;

assert (str_to_slv("1 ps") = "01111101000") -- 0
report "str_to_slv_test error # 28 " & LF &
to_string("01111101000") & " : expected" & LF &
to_string(str_to_slv("1 ps")) & " : actual" 
severity error;

assert   (str_to_slv("1 fs") = "01") -- 0
report "str_to_slv_test error # 29 " & LF &
to_string("01") & " : expected" & LF &
to_string(str_to_slv("1 fs")) & " : actual" 
severity error;

assert   (str_to_slv("1 as",-24) = "011110100001001000000") -- 0
report "str_to_slv_test error # 30 " & LF &
to_string("011110100001001000000") & " : expected" & LF &
to_string(str_to_slv("1 as",-24)) & " : actual" 
severity error;

assert   (str_to_slv("1 zs",-24) = "01111101000") -- 0
report "str_to_slv_test error # 31 " & LF &
to_string("01111101000") & " : expected" & LF &
to_string(str_to_slv("1 zs",-24)) & " : actual" 
severity error;

assert   (str_to_slv("1 ys",-24) = "01") -- 0
report "str_to_slv_test error # 32 " & LF &
to_string("01") & " : expected" & LF &
to_string(str_to_slv("1 ys",-24)) & " : actual" 
severity error;


assert   (str_to_slv("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs") = "01001110000111011000111100110011111100101100110000111010000000101001") -- 0
report "str_to_slv_test error # 33 " & LF &
to_string("01001110000111011000111100110011111100101100110000111010000000101001") & " : expected" & LF &
to_string(str_to_slv("1 day 1 hr 1 min 1 sec 1 ms 1 us 1 ns 1 ps 1 fs")) & " : actual" 
severity error;


wait;
end process;


--function str_to_slv_high(stringVal : string) return integer;                    -- returns an integer representing the length of a vector needed to represent the intever value (in string form) passed



--function str_to_slv_var_base(stringVal : string;
--                             intVal    : integer) return std_logic_vector;      -- converts an Integer, in string form, of any length to a std_logic_vector using the time base passed



--function str_to_slv_var_base_high(stringVal : string;
--                                  intVal : integer) return integer;             -- returns an integer representing the length of a vector needed to represent the intever value (in string form) passed using the timebase value



--function strh(stringVal : string) return integer;

sxt_test : process
constant slvVar : slv := "0111";
variable slv1Var : slv(11 downto 0);
variable slv2Var : slv(11 downto 0);
variable slv3Var : slv(slv1Var'range);

begin
   
slv1Var := sxt2(int_to_slv(-1000),slv1Var'length);
slv2Var := sxt2(int_to_slv(-6),slv2Var'length);

assert (sxt2(slvVar,7) = "0000111") -- 7 bits
report "sxt2_test error # 1 " & LF &
   to_string("0000111") & " : expected" & LF &
   to_string(sxt2(slvVar,7)) & " : actual" 
severity error; 

assert (sxt2(slvVar,4) = "0111") -- 4 bits
report "sxt2_test error # 2 " & LF &
   to_string("0000111") & " : expected" & LF &
   to_string(sxt2(slvVar,4)) & " : actual" 
severity error;

assert (sxt2("1001",7) = "1111001") -- 7 bits
report "sxt2_test error # 3 " & LF &
   to_string("1111001") & " : expected" & LF &
   to_string(sxt2("1001",7)) & " : actual" 
severity error; 

assert (sxt2("00",7) = "0000000") -- 4 bits
report "sxt2_test error # 4 " & LF &
   to_string("0000000") & " : expected" & LF &
   to_string(sxt2("00",7)) & " : actual" 
severity error;

assert (sxt2("1001",4) = "1001") -- 7 bits
report "sxt2_test error # 5 " & LF &
   to_string("1001") & " : expected" & LF &
   to_string(sxt2("1001",7)) & " : actual" 
severity error; 


wait;
end process; 

--function to_int(vectorVal : std_logic_vector) return integer;                   -- repackaging of "conv_integer" function

--function to_period(freqVal : frequency) return time;                            -- returns a one cycle period value for a given frequency

--function to_string(intVal : integer) return string;                             -- returns a string value for an integer value passed
to_string_test1 : process
begin

assert (to_string(2147000000) = "2147000000")
report "to_string_test1 error # 1 " & LF &
   "2147000000" & " : expected" & LF &
   to_string(2147000000) & " : actual" 
severity error;

assert (to_string(-2147000000) = "-2147000000")
report "to_string_test1 error # 2 " & LF &
   "-2147000000" & " : expected" & LF &
   to_string(-2147000000) & " : actual" 
severity error;

wait;
end process;


--function to_string(realVal : real) return string;                               -- returns a string value for an real value passed
to_string_test2 : process
begin

assert (to_string(1.000000e+308) = "1.000000e+308")
report "to_string_test2 error # 1 " & LF &
   "1.000000e+308" & " : expected" & LF &
   to_string(1.000000e+308) & " : actual" 
severity error;

assert (to_string(1.000000e-308) = "1.000000e-308")
report "to_string_test2 error # 2 " & LF &
   "1.000000e-308" & " : expected" & LF &
   to_string(1.000000e-308) & " : actual" 
severity error;

assert (to_string(-1.000000e-308) = "-1.000000e-308")
report "to_string_test2 error # 3 " & LF &
   "-1.000000e-308" & " : expected" & LF &
   to_string(-1.000000e-308) & " : actual" 
severity error;

wait;
end process;


--function to_string(timeVal : time) return string;
to_string_test3 : process
begin

assert (to_string(3 ns) = "3 ns")
report "to_string_test3 error # 1 " & LF &
   "3 ns" & " : expected" & LF &
   to_string(3 ns) & " : actual" 
severity error;


assert (to_string(2040 ns) = "2040 ns")
report "to_string_test3 error # 2 " & LF &
   "2040 ns" & " : expected" & LF &
   to_string(2040 ns) & " : actual" 
severity error;

wait;
end process;


--function to_string(vectorVal : std_logic_vector) return string;

--function vhfi(intVal : integer) return natural;                                 -- returns the high value to be used in the range declaration of a vector used to represent the integer value passed. This assumes the rest of the range declaration of the vector will be "downto 0"

--function vhfn(natVal : natural) return natural;                                 -- returns the high value to be used in the range declaration of a vector used to represent the natural value passed. This assumes the rest of the range declaration of the vector will be "downto 0"

--function vlfi(intVal : integer) return natural;                                 -- returns an integer representing the length of a vector needed to represent the integer value passed

--function vlfn(natVal : natural) return natural;                                 -- returns an integer representing the length of a vector needed to represent the natural value passed

--function vrfi(intVal : integer) return std_logic_vector;                        -- returns a std_logic_vector with a range just large enough to represent the integer value passed

--function vrfn(natVal : natural) return std_logic_vector;                        -- returns a std_logic_vector with a range just large enough to represent the natural value passed

--------------------------------------------------------------------------------
---- Procedure Declarations
--------------------------------------------------------------------------------
---- synopsys translate_off
--procedure clkgen(
--   constant clkFreqSig      : in    frequency;
--   signal   clkSig          : out   std_logic);
--  
--procedure clkgen(
--   signal   clkEnSig    : in  boolean;
--   signal   clkFreqSig  : in  frequency;
--   signal   clkSig      : out std_logic);
--
--procedure clkgen(
--   signal   clkEnSig        : in    boolean;
--   signal   clkPeriodSig    : in    time;
--   constant clkDutySig      : in    real;
--   signal   clkResetSig     : in    boolean;
--   signal   clkSig          : inout std_logic);
--   
--procedure clkgen(
--   signal   clkEnSig        : in    boolean;
--   signal   clkFreqSig      : in    frequency;
--   constant clkDutySig      : in    real;
--   signal   clkResetSig     : in    boolean;
--   signal   clkSig          : inout std_logic);
---- synopsys translate_on
--  
--procedure FF(
--   signal Clk : in  std_logic;
--   signal Rst : in  std_logic;
--   signal D   : in  std_logic_vector;
--   signal Q   : out std_logic_vector);
--
--procedure slv_to_bcd(
--   signal   BCD_RIn           : in  std_logic_vector;
--   signal   BinIn             : in  std_logic_vector;
--   signal   BinFBIn           : in  std_logic_vector;
--   signal   ClkIn             : in  std_logic;
--   constant BCD_DigitsVal     : in  integer;
--   signal   EnIn              : in  std_logic;
--   signal   RstLowIn          : in  std_logic;
--   signal   BCD_ROut          : out std_logic_vector;
--   signal   Bin_ROut          : out std_logic_vector;
--   signal   DoneOut           : out std_logic);


--exp_test : process
--variable timeBaseVar : slv(500 downto 0);
--variable lineVar : line;
--begin
--   timeBaseVar := ext("01",timeBaseVar'length);
--   for loopVar in 1 to 50 loop
--      timeBaseVar := timeBaseVar(timeBaseVar'high-4 downto 0) * "1010";
--      
----      write(lineVar,to_string(real(reduce_high(timeBaseVar))/real(loopVar)));
----      write(lineVar,LF);
--      assert FALSE
--      report 
--         to_string(real(reduce_high(timeBaseVar))/real(loopVar)) & LF
--      severity note;
--   end loop;
--   
--   wait;
--end process;


--assert FALSE
--report "THIS IS THE END OF SIMULATION" & LF
--severity failure;

------------------------------------------------------------------------------
end behavioral;
------------------------------------------------------------------------------

-- end of extension_pack testbench
-- synopsys translate_on


Relevant Pages

  • extension_pack
    ... It is used to set upper loop -- limits for non-deterministic values thus avoiding the use of access -- types and enabling the functions to be used for synthesizeable code. ... DivisorVal: integer) return std_logic_vector; function "/"(DividendVal: string; DivisorVal: integer) return std_logic_vector; ... for loopVar in 0 to slvVal'length/4-1 loop ... end loop; if then return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to else return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to end if; ...
    (comp.lang.vhdl)
  • extension_pack
    ... It is used to set upper loop -- limits for non-deterministic values thus avoiding the use of access -- types and enabling the functions to be used for synthesizeable code. ... DivisorVal: integer) return std_logic_vector; function "/"(DividendVal: string; DivisorVal: integer) return std_logic_vector; ... for loopVar in 0 to slvVal'length/4-1 loop ... end loop; if then return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to else return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to end if; ...
    (comp.lang.vhdl)
  • extension_pack
    ... It is used to set upper loop -- limits for non-deterministic values thus avoiding the use of access -- types and enabling the functions to be used for synthesizeable code. ... DivisorVal: integer) return std_logic_vector; function "/"(DividendVal: string; DivisorVal: integer) return std_logic_vector; ... for loopVar in 0 to slvVal'length/4-1 loop ... end loop; if then return not resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to else return resultVar; -- "width mismatch" errors here are due to improper sizing of the vector that this function is assigned to end if; ...
    (comp.lang.vhdl)
  • Re: Letter to US Sen. Byron Dorgan re unpaid overtime
    ... The MAXIMUM size of a working string, accessed in its entirety, is ... compiler would generate a loop), ... > natural incompetence in the field of programming. ...
    (comp.programming)

Loading