OpenCores
URL https://opencores.org/ocsvn/ratpack/ratpack/trunk

Subversion Repositories ratpack

Compare Revisions

  • This comparison shows the changes necessary to convert path
    /ratpack/trunk
    from Rev 1 to Rev 2
    Reverse comparison

Rev 1 → Rev 2

/BUGS
0,0 → 1,11
ratpack BUGS -- known bugs. Last updated: 2010-05-14
 
Known bugs in ratpack-0.1
----------------------------
 
** <dummy>
- <dummy>
- <another one>
 
 
BUGS ends here.
BUGS Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: AUTHORS =================================================================== --- AUTHORS (nonexistent) +++ AUTHORS (revision 2) @@ -0,0 +1,5 @@ +Authors of ratpack. + +ratpack Nikolaos Kavvadias + +AUTHORS ends here
AUTHORS Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: TODO =================================================================== --- TODO (nonexistent) +++ TODO (revision 2) @@ -0,0 +1,8 @@ +ratpack --- TODO + +Todo: + + * . + + +end of file TODO
TODO Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: VERSION =================================================================== --- VERSION (nonexistent) +++ VERSION (revision 2) @@ -0,0 +1 @@ +0.1.1
VERSION Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: ratpack.vhd =================================================================== --- ratpack.vhd (nonexistent) +++ ratpack.vhd (revision 2) @@ -0,0 +1,239 @@ +-------------------------------------------------------------------------------- +-- Filename: ratpack.vhd +-- Purpose : Rational arithmetic package +-- Author : Nikolaos Kavvadias +-- Date : 14-May-2010 +-- Version : 0.1 +-- Revision: 0.0.0 (2009/07/25) +-- Initial version. Added the definition of a rational number, and the +-- implementation of the "+", "-", "*", "/" operators on reduced +-- rational numbers (i.e. relative primes), the gcd(x,y) and the +-- mediant operator. +-- 0.0.1 (2009/07/28) +-- Added: numerator, denominator, abs, relational operators (>, <, >=, +-- <=, =, /=, changed the int2rat to to_rational, new version of +-- int2rat (casting an integer to a rational). +-- License : Copyright (C) 2009, 2010 by Nikolaos Kavvadias +-- This program is free software. You can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License, +-- either version 3 of the License, or (at your option) any later +-- version. See COPYING. +-- +-------------------------------------------------------------------------------- + +package ratpack is + + -- A rational number is defined by the pair (numerator, denominator) where + -- both numbers. -- are in the range [-16384, 16383]. + constant numer : INTEGER := 0; -- numerator + constant denom : INTEGER := 1; -- denominator + type rational is array (natural range numer to denom) of + integer; -- range -16384 to 16383; + constant RAT_ZERO : rational := (0, 1); + constant RAT_ONE : rational := (1, 1); + + function to_rational (a, b : integer) return rational; + function int2rat (a : integer) return rational; + function numerator (a : rational) return integer; + function denominator (a : rational) return integer; + function "+" (a, b : rational) return rational; + function "-" (a, b : rational) return rational; + function "*" (a, b : rational) return rational; + function "/" (a, b : rational) return rational; + function "abs" (a : rational) return rational; + function ">" (a, b : rational) return boolean; + function "<" (a, b : rational) return boolean; + function ">=" (a, b : rational) return boolean; + function "<=" (a, b : rational) return boolean; + function "=" (a, b : rational) return boolean; + function "/=" (a, b : rational) return boolean; + function gcd (a, b : integer) return integer; + function mediant (a, b : rational) return rational; + +end ratpack; + + +package body ratpack is + + function to_rational (a, b : integer) return rational is + variable r : rational; + begin + r(numer) := a; + r(denom) := b; + return r; + end to_rational; + + function int2rat (a : integer) return rational is + variable r : rational; + begin + r(numer) := a; + r(denom) := 1; + return r; + end int2rat; + + function numerator (a : rational) return integer is + variable n : integer; + begin + n := a(numer); + return n; + end numerator; + + function denominator (a : rational) return integer is + variable d : integer; + begin + d := a(denom); + return d; + end denominator; + + function "+" (a, b : rational) return rational is + variable r : rational; + variable tn, td : integer; + begin + tn := a(numer)*b(denom) + a(denom)*b(numer); + td := a(denom) * b(denom); + if ( gcd(abs(tn), abs(td)) > 0 ) then + r(numer) := tn / gcd(abs(tn), abs(td)); + r(denom) := td / gcd(abs(tn), abs(td)); + else + r(numer) := tn; + r(denom) := td; + end if; + return r; + end "+"; + + function "-" (a, b : rational) return rational is + variable r : rational; + variable tn, td : integer; + begin + tn := a(numer)*b(denom) - a(denom)*b(numer); + td := a(denom) * b(denom); + if ( gcd(abs(tn), abs(td)) > 0 ) then + r(numer) := tn / gcd(abs(tn), abs(td)); + r(denom) := td / gcd(abs(tn), abs(td)); + else + r(numer) := tn; + r(denom) := td; + end if; + return r; + end "-"; + + function "*" (a, b : rational) return rational is + variable r : rational; + variable tn, td : integer; + begin + tn := a(numer) * b(numer); + td := a(denom) * b(denom); + if ( gcd(abs(tn), abs(td)) > 0 ) then + r(numer) := tn / gcd(abs(tn), abs(td)); + r(denom) := td / gcd(abs(tn), abs(td)); + else + r(numer) := tn; + r(denom) := td; + end if; + return r; + end "*"; + + function "/" (a, b : rational) return rational is + variable r : rational; + variable tn, td : integer; + begin + tn := a(numer) * b(denom); + td := a(denom) * b(numer); + if ( gcd(abs(tn), abs(td)) > 0 ) then + r(numer) := tn / gcd(abs(tn), abs(td)); + r(denom) := td / gcd(abs(tn), abs(td)); + else + r(numer) := tn; + r(denom) := td; + end if; + return r; + end "/"; + + function "abs" (a : rational) return rational is + variable ta, tb, y : integer; + variable r : rational; + begin + ta := a(numer); + tb := a(denom); + if (ta < 0) then + ta := - a(numer); + end if; + if (tb < 0) then + tb := - a(denom); + end if; + r := to_rational(ta, tb); + return r; + end "abs"; + + function ">" (a, b : rational) return boolean is + variable diff : rational := a - b; + begin + return (((diff(numer) > 0) and (diff(denom) > 0)) or + ((diff(numer) < 0) and (diff(denom) < 0))); + end ">"; + + function "<" (a, b : rational) return boolean is + variable diff : rational := a - b; + begin + return (((diff(numer) > 0) and (diff(denom) < 0)) or + ((diff(numer) < 0) and (diff(denom) > 0))); + end "<"; + + function ">=" (a, b : rational) return boolean is + variable diff : rational := a - b; + begin + return (((diff(numer) >= 0) and (diff(denom) > 0)) or + ((diff(numer) <= 0) and (diff(denom) < 0))); + end ">="; + + function "<=" (a, b : rational) return boolean is + variable diff : rational := a - b; + begin + return (((diff(numer) >= 0) and (diff(denom) < 0)) or + ((diff(numer) <= 0) and (diff(denom) > 0))); + end "<="; + + function "=" (a, b : rational) return boolean is + variable diff : rational := a - b; + begin + return (diff(numer) = 0); + end "="; + + function "/=" (a, b : rational) return boolean is + variable diff : rational := a - b; + begin + return (diff(numer) /= 0); + end "/="; + + function gcd (a, b : integer) return integer is + begin + if a = 0 then + return b; + end if; + if b = 0 then + return a; + end if; + if (a > b) then + return gcd(b, a mod b); + else + return gcd(a, b mod a); + end if; + end gcd; + + function mediant (a, b : rational) return rational is + variable r : rational; + variable tn, td : integer; + begin + tn := a(numer) + b(numer); + td := a(denom) + b(denom); + if ( gcd(abs(tn), abs(td)) > 0 ) then + r(numer) := tn / gcd(abs(tn), abs(td)); + r(denom) := td / gcd(abs(tn), abs(td)); + else + r(numer) := tn; + r(denom) := td; + end if; + return r; + end mediant; + +end ratpack;
ratpack.vhd Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: ratpack_results1.txt =================================================================== --- ratpack_results1.txt (nonexistent) +++ ratpack_results1.txt (revision 2) @@ -0,0 +1,195 @@ +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15 +5/12 + 2/3 = 13/12 +5/12 - 2/3 = -1/4 +5/12 * 2/3 = 5/18 +5/12 : 2/3 = 5/8 +mediant(5/12 , 2/3) = 7/15
ratpack_results1.txt Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: ratpack_results2.txt =================================================================== --- ratpack_results2.txt (nonexistent) +++ ratpack_results2.txt (revision 2) @@ -0,0 +1,12 @@ + F1= 0/1 + F2= 0/1 1/2 1/1 + F3= 0/1 1/3 1/2 2/3 1/1 + F4= 0/1 1/4 1/3 1/2 2/3 3/4 1/1 + F5= 0/1 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 1/1 + F6= 0/1 1/6 1/5 1/4 1/3 2/5 1/2 3/5 2/3 3/4 4/5 5/6 1/1 + F7= 0/1 1/7 1/6 1/5 1/4 2/7 1/3 2/5 3/7 1/2 4/7 3/5 2/3 5/7 3/4 4/5 5/6 6/7 1/1 + F8= 0/1 1/8 1/7 1/6 1/5 1/4 2/7 1/3 3/8 2/5 3/7 1/2 4/7 3/5 5/8 2/3 5/7 3/4 4/5 5/6 6/7 7/8 1/1 + F9= 0/1 1/9 1/8 1/7 1/6 1/5 2/9 1/4 2/7 1/3 3/8 2/5 3/7 4/9 1/2 5/9 4/7 3/5 5/8 2/3 5/7 3/4 7/9 4/5 5/6 6/7 7/8 8/9 1/1 + F10= 0/1 1/10 1/9 1/8 1/7 1/6 1/5 2/9 1/4 2/7 3/10 1/3 3/8 2/5 3/7 4/9 1/2 5/9 4/7 3/5 5/8 2/3 7/10 5/7 3/4 7/9 4/5 5/6 6/7 7/8 8/9 9/10 1/1 + F11= 0/1 1/11 1/10 1/9 1/8 1/7 1/6 2/11 1/5 2/9 1/4 3/11 2/7 3/10 1/3 4/11 3/8 2/5 3/7 4/9 5/11 1/2 6/11 5/9 4/7 3/5 5/8 7/11 2/3 7/10 5/7 8/11 3/4 7/9 4/5 9/11 5/6 6/7 7/8 8/9 9/10 10/11 1/1 + F12= 0/1 1/12 1/11 1/10 1/9 1/8 1/7 1/6 2/11 1/5 2/9 1/4 3/11 2/7 3/10 1/3 4/11 3/8 2/5 5/12 3/7 4/9 5/11 1/2 6/11 5/9 4/7 7/12 3/5 5/8 7/11 2/3 7/10 5/7 8/11 3/4 7/9 4/5 9/11 5/6 6/7 7/8 8/9 9/10 10/11 11/12 1/1
ratpack_results2.txt Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: ChangeLog =================================================================== --- ChangeLog (nonexistent) +++ ChangeLog (revision 2) @@ -0,0 +1,9 @@ +2010-05-14 Nikolaos Kavvadias + + * Release 0.1. + +2010-06-07 Nikolaos Kavvadias + + * Minor release 0.1.1. + +ChangeLog ends here
ChangeLog Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: COPYING =================================================================== --- COPYING (nonexistent) +++ COPYING (revision 2) @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library.
COPYING Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: THANKS =================================================================== --- THANKS (nonexistent) +++ THANKS (revision 2) @@ -0,0 +1,7 @@ +Thanks to: + + X.Y. for whatever. + + +Thessaloniki, Greece, 2010-05-14 +
THANKS Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: ratpack.mk =================================================================== --- ratpack.mk (nonexistent) +++ ratpack.mk (revision 2) @@ -0,0 +1,26 @@ +GHDL=ghdl +GHDLFLAGS=--ieee=synopsys -fexplicit --workdir=work +# Use stop-time = 2340ns for computing Farey series' F1 to F12. +GHDLRUNFLAGS=--stop-time=2340ns + +# Default target : elaborate +all : run + +# Elaborate target. Almost useless +elab : force + $(GHDL) -c $(GHDLFLAGS) -e ratpack_tb + +# Run target +run: force + $(GHDL) --elab-run $(GHDLFLAGS) ratpack_tb $(GHDLRUNFLAGS) + +# Targets to analyze libraries +init: force + mkdir work + $(GHDL) -a $(GHDLFLAGS) ratpack.vhd + $(GHDL) -a $(GHDLFLAGS) ratpack_tb$(TEST).vhd + +force: + +clean : + rm -rf *.o work ratpack_results.txt
ratpack.mk Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: ratpack_tb1.vhd =================================================================== --- ratpack_tb1.vhd (nonexistent) +++ ratpack_tb1.vhd (revision 2) @@ -0,0 +1,125 @@ +-------------------------------------------------------------------------------- +-- Filename: ratpack_tb1.vhd +-- Purpose : A simple testbench for "ratpack". +-- Author : Nikolaos Kavvadias +-- Date : 14-May-2010 +-- Version : 0.1 +-- Revision: 0.0.0 (2010/05/14) +-- Initial version. +-- License : Copyright (C) 2010 by Nikolaos Kavvadias +-- This program is free software. You can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License, +-- either version 3 of the License, or (at your option) any later +-- version. See COPYING. +-- +-------------------------------------------------------------------------------- + +library STD, IEEE; +use STD.textio.all; +use IEEE.std_logic_1164.all; +use WORK.ratpack.all; + + +entity ratpack_tb is +end ratpack_tb; + + +architecture tb_arch of ratpack_tb is + ------------------------------------------------------- + -- Declare results file + ------------------------------------------------------- + file ResultsFile: text open write_mode is + "ratpack_results.txt"; + ------------------------------------------------------- + -- Constant declarations + ------------------------------------------------------- + constant CLK_PERIOD : time := 10 ns; +begin + + -- Test the basic operators. + TEST_OPS: process + variable a, b, c: rational := RAT_ZERO; + variable BufLine: line; + begin + a := to_rational(5, 12); + b := to_rational(2, 3); + wait for CLK_PERIOD; + -- Test rational addition + c := a + b; + write(Bufline, a(numer)); + write(Bufline, string'("/")); + write(Bufline, a(denom)); + write(Bufline, string'(" + ")); + write(Bufline, b(numer)); + write(Bufline, string'("/")); + write(Bufline, b(denom)); + write(Bufline, string'(" = ")); + write(Bufline, c(numer)); + write(Bufline, string'("/")); + write(Bufline, c(denom)); + writeline(ResultsFile, Bufline); + wait for CLK_PERIOD; + -- Test rational subtraction + c := a - b; + write(Bufline, a(numer)); + write(Bufline, string'("/")); + write(Bufline, a(denom)); + write(Bufline, string'(" - ")); + write(Bufline, b(numer)); + write(Bufline, string'("/")); + write(Bufline, b(denom)); + write(Bufline, string'(" = ")); + write(Bufline, c(numer)); + write(Bufline, string'("/")); + write(Bufline, c(denom)); + writeline(ResultsFile, Bufline); + wait for CLK_PERIOD; + -- Test rational multiplication + c := a * b; + write(Bufline, a(numer)); + write(Bufline, string'("/")); + write(Bufline, a(denom)); + write(Bufline, string'(" * ")); + write(Bufline, b(numer)); + write(Bufline, string'("/")); + write(Bufline, b(denom)); + write(Bufline, string'(" = ")); + write(Bufline, c(numer)); + write(Bufline, string'("/")); + write(Bufline, c(denom)); + writeline(ResultsFile, Bufline); + wait for CLK_PERIOD; + -- Test rational division + c := a / b; + write(Bufline, a(numer)); + write(Bufline, string'("/")); + write(Bufline, a(denom)); + write(Bufline, string'(" : ")); + write(Bufline, b(numer)); + write(Bufline, string'("/")); + write(Bufline, b(denom)); + write(Bufline, string'(" = ")); + write(Bufline, c(numer)); + write(Bufline, string'("/")); + write(Bufline, c(denom)); + writeline(ResultsFile, Bufline); + wait for CLK_PERIOD; + -- Test mediant + c := mediant(a, b); + write(Bufline, string'("mediant(")); + write(Bufline, a(numer)); + write(Bufline, string'("/")); + write(Bufline, a(denom)); + write(Bufline, string'(" , ")); + write(Bufline, b(numer)); + write(Bufline, string'("/")); + write(Bufline, b(denom)); + write(Bufline, string'(") = ")); + write(Bufline, c(numer)); + write(Bufline, string'("/")); + write(Bufline, c(denom)); + writeline(ResultsFile, Bufline); + wait for CLK_PERIOD; + end process TEST_OPS; + +end tb_arch;
ratpack_tb1.vhd Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: ratpack_tb2.vhd =================================================================== --- ratpack_tb2.vhd (nonexistent) +++ ratpack_tb2.vhd (revision 2) @@ -0,0 +1,90 @@ +-------------------------------------------------------------------------------- +-- Filename: ratpack_tb2.vhd +-- Purpose : A testbench for "ratpack" generating the Farey series' up to order +-- 12. +-- Author : Nikolaos Kavvadias +-- Date : 14-May-2010 +-- Version : 0.1 +-- Revision: 0.0.0 (2010/05/14) +-- Initial version. +-- License : Copyright (C) 2010 by Nikolaos Kavvadias +-- This program is free software. You can redistribute it and/or +-- modify it under the terms of the GNU Lesser General Public License, +-- either version 3 of the License, or (at your option) any later +-- version. See COPYING. +-- +-------------------------------------------------------------------------------- + +library STD; +use STD.textio.all; +use WORK.ratpack.all; + + +entity ratpack_tb is +end ratpack_tb; + + +architecture tb_arch of ratpack_tb is + ------------------------------------------------------- + -- Declare results file + ------------------------------------------------------- + file ResultsFile: text open write_mode is + "ratpack_results.txt"; + ------------------------------------------------------- + -- Constant declarations + ------------------------------------------------------- + constant CLK_PERIOD : time := 10 ns; +begin + + -- Compute the Farey sequences F1 to F12. + -- The Farey sequence Fn for any positive integer n is the set of irreducible + -- rational numbers a/b with 0<=a<=b<=n and (a,b)=1 arranged in increasing + -- order. + FAREY_SERIES: process + variable a, b, c, d, k, n : integer; + variable ta, tb, tc, td : integer; + variable r : rational := RAT_ZERO; + variable BufLine: line; + begin + for n in 1 to 12 loop + write(Bufline, string'(" F")); + write(Bufline, n); + write(Bufline, string'("= ")); + -- Initialize a, b, c, d for computing the ascending Farey sequence + a := 0; + b := 1; + c := 1; + d := n; + -- Print r = a/b + r := to_rational(a, b); + write(Bufline, r(numer)); + write(Bufline, string'("/")); + write(Bufline, r(denom)); + write(Bufline, string'(" ")); + wait for CLK_PERIOD; + -- Compute the subsequent terms of the Farey sequence + while (c < n) loop + k := (n + b) / d; + ta := a; + tb := b; + tc := c; + td := d; + a := tc; + b := td; + c := k * tc - ta; + d := k * td - tb; + c := k * tc - ta; + -- Print r = a/b + r := to_rational(a, b); + write(Bufline, r(numer)); + write(Bufline, string'("/")); + write(Bufline, r(denom)); + write(Bufline, string'(" ")); + wait for CLK_PERIOD; + end loop; + writeline(ResultsFile, Bufline); + end loop; + wait for CLK_PERIOD; + end process FAREY_SERIES; + +end tb_arch;
ratpack_tb2.vhd Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: README =================================================================== --- README (nonexistent) +++ README (revision 2) @@ -0,0 +1,102 @@ +------------------------------------------------------------------------------ +-- Title : ratpack (VHDL rational arithmetic package). -- +-- Author : Nikolaos Kavvadias -- +-- Contact : nikolaos.kavvadias@gmail.com -- +-- : http://electronics.physics.auth.gr/people/nkavv/ -- +-- : http://www.nkavvadias.eu -- +-- Release Date : O7 June 2010 -- +-- Version : 0.1.1 -- +--------------------:--------------------------------------------------------- +-- Revision history : -- +-- v0.1 : 2010-05-14 -- +-- : Initial release. -- +-- v0.1.1 : 2010-06-07 -- +-- : Minor update in documentation (README). -- +------------------------------------------------------------------------------ + + +1. INTRODUCTION +--------------- + +"ratpack" is a rational arithmetic package written in VHDL. + +Currently, the "ratpack" package implements the following: + + - the RATIONAL data type. + - to_rational: construction function of a rational given two integers + (numerator and denominator). + - int2rat: conversion function of an integer to its rational + representation. + - numerator: extracts the numerator of a rational number. + - denominator: extracts the denominator of a rational number. + - "+", "-", "*", "/": implementation of the basic arithmetic + operations for rationals. + - abs: extracts the absolute value of a given rational number. + - ">", "<", ">=", "<=", "=", "/=": overload comparison operators for + rationals. + - gcd: computes the greatest common divisor of two integers (positive, + covers the pathological case of division by zero). + - mediant: computes the mediant rational of two given rationals. + +"ratpack" is distributed along with two VHDL testbenches: a simple one +(ratpack_tb1.vhd) and a testbench generating the Farey series of orders 1 to 12 +(ratpack_tb2.vhd). + + +2. FILE LISTING +--------------- + + The ratpack distributions includes the following files: + + /ratpack- + AUTHORS List of "ratpack" authors. + BUGS Bug list. + ChangeLog A log for code changes. + COPYING The LGPL, version 3. + ratpack.mk Makefile + ratpack_results1.txt Result file after the simple test. + ratpack_results2.txt Result file after the computation of Farey series. + ratpack_tb1.vhd A simple testbench. + ratpack_tb2.vhd Testbench generating the Farey series (orders 1-12). + README This file. + run.sh A bash script for testing the package. + THANKS Acknowledgements. + TODO A list of future enhancements. + + +3. RATPACK USAGE +---------------- + + The ratpack package program can be used as follows: + $./run.sh + After this process, the "ratpack_results.txt" file is generated containing + simulation results. + +Here follow some simple usage examples of this bash script. + +1. Compile the "ratpack" package and do a simple test. +$ ./run.sh ratpack 1 + +2. Compile the "ratpack" package and generate the Farey series. +$ ./run.sh ratpack 2 + + +4. PREREQUISITIES +----------------- + +- Standard UNIX-based tools (tested with gcc-3.3.3, 3.4.3 and 3.4.4 on + cygwin/x86) + make +- GHDL simulator (http://ghdl.free.fr) + Provides the "ghdl" executable. + + +5. CONTACT +---------- + +You may contact me for further questions/suggestions/corrections at: + + Nikolaos Kavvadias + + + http://www.nkavvadias.co.cc
README Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property Index: run.sh =================================================================== --- run.sh (nonexistent) +++ run.sh (revision 2) @@ -0,0 +1,14 @@ +#!/bin/bash + +make -f $1.mk TEST=$2 clean +make -f $1.mk TEST=$2 init +make -f $1.mk TEST=$2 run + +if [ "$SECONDS" -eq 1 ] +then + units=second +else + units=seconds +fi +echo "This script has been running for $SECONDS $units." +exit 0
run.sh Property changes : Added: svn:executable ## -0,0 +1 ## +* \ No newline at end of property

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.