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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [math/] [p_test] - Blame information for rev 134

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 134 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
#/**********************************************************************/
4
#/*                                                                    */
5
#/*             -------                                                */
6
#/*            /   SOC  \                                              */
7
#/*           /    GEN   \                                             */
8
#/*          /    TOOL    \                                            */
9
#/*          ==============                                            */
10
#/*          |            |                                            */
11
#/*          |____________|                                            */
12
#/*                                                                    */
13
#/*                                                                    */
14
#/*                                                                    */
15
#/*                                                                    */
16
#/*  Author(s):                                                        */
17
#/*      - John Eaton, jt_eaton@opencores.org                          */
18
#/*                                                                    */
19
#/**********************************************************************/
20
#/*                                                                    */
21
#/*    Copyright (C) <2010-2011>                */
22
#/*                                                                    */
23
#/*  This source file may be used and distributed without              */
24
#/*  restriction provided that this copyright statement is not         */
25
#/*  removed from the file and that any derivative work contains       */
26
#/*  the original copyright notice and the associated disclaimer.      */
27
#/*                                                                    */
28
#/*  This source file is free software; you can redistribute it        */
29
#/*  and/or modify it under the terms of the GNU Lesser General        */
30
#/*  Public License as published by the Free Software Foundation;      */
31
#/*  either version 2.1 of the License, or (at your option) any        */
32
#/*  later version.                                                    */
33
#/*                                                                    */
34
#/*  This source is distributed in the hope that it will be            */
35
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
36
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
37
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
38
#/*  details.                                                          */
39
#/*                                                                    */
40
#/*  You should have received a copy of the GNU Lesser General         */
41
#/*  Public License along with this source; if not, download it        */
42
#/*  from http://www.opencores.org/lgpl.shtml                          */
43
#/*                                                                    */
44
#/**********************************************************************/
45
 
46
 
47
############################################################################
48
# General PERL config
49
############################################################################
50
use Getopt::Long;
51
use English;
52
use File::Basename;
53
use Cwd;
54
use Scalar::Util qw(looks_like_number);
55
use XML::LibXML;
56
use lib './tools';
57
use sys::lib;
58
use yp::lib;
59
use math::lib;
60
use BerkeleyDB;
61
 
62
 
63
$OUTPUT_AUTOFLUSH = 1; # set autoflush of stdout to TRUE.
64
 
65
 
66
############################################################################
67
### Process the options
68
############################################################################
69
Getopt::Long::config("require_order", "prefix=-");
70
GetOptions("h","help",
71
           "exp=s" => \$exp
72
) || die "(use '$program_name -h' for help)";
73
 
74
 
75
##############################################################################
76
## Help option
77
##############################################################################
78
if ( $opt_h  or $opt_help  )
79
  { print "\n test     \n";
80
    exit 1;
81
  }
82
 
83
 
84
 
85
 
86
 
87
 
88
#############################################################################
89
##
90
##
91
#############################################################################
92
 
93
 
94
$home = cwd();
95
 
96
 
97
my $line   = "PROG_ROM_ADD+3-2";
98
my $symbol = "ROM_ADD";
99
my $value  = "6";
100
 
101
$line = math::lib::parse($line,$symbol,$value) ;
102
 
103
 
104
 
105
 
106
 
107
$line   = "2/3+PROG_ROM_ADD+3-8'hff+ROM_ADD+8";
108
$line = math::lib::parse($line,$symbol,$value) ;
109
print "----------------------->$line\n\n\n\n\n";
110
 
111
 
112
 
113
$line   = "2/3+PROG_ROM_ADD+3-8'hff/ROM_ADD+8";
114
$line = math::lib::parse($line,$symbol,$value) ;
115
print "----------------------->$line\n\n\n\n\n";
116
 
117
 
118
$line   = "2/3+PROG_ROM_ADD+3-8'hff-ROM_ADD+8";
119
$line = math::lib::parse($line,$symbol,$value) ;
120
print "----------------------->$line\n\n\n\n\n";
121
 
122
 
123
$line   = "2/3+PROG_ROM_ADD+3-8'hff*ROM_ADD+8";
124
$line = math::lib::parse($line,$symbol,$value) ;
125
print "----------------------->$line\n\n\n\n\n";
126
 
127
 
128
 
129
$line   = "2/3+PROG_ROM_ADD+3-8'hff*ROM_ADD+8/2-3+ROM_ADD";
130
$line = math::lib::parse($line,$symbol,$value) ;
131
print "----------------------->$line\n\n\n\n\n";
132
 
133
 
134
$line   = "2+3+8*ROM_ADD+2-3+ROM_ADD";
135
$line = math::lib::parse($line,$symbol,$value) ;
136
print "----------------------->$line\n\n\n\n\n";
137
 
138
1

powered by: WebSVN 2.1.0

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