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

Subversion Repositories ao68000

[/] [ao68000/] [trunk/] [sw/] [ao68000_tool/] [Main.java] - Blame information for rev 16

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 12 alfik
/*
2
 * Copyright 2010, Aleksander Osman, alfik@poczta.fm. All rights reserved.
3
 *
4
 * Redistribution and use in source and binary forms, with or without modification, are
5
 * permitted provided that the following conditions are met:
6
 *
7
 *  1. Redistributions of source code must retain the above copyright notice, this list of
8
 *     conditions and the following disclaimer.
9
 *
10
 *  2. Redistributions in binary form must reproduce the above copyright notice, this list
11
 *     of conditions and the following disclaimer in the documentation and/or other materials
12
 *     provided with the distribution.
13
 *
14
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
15
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
16
 * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR
17
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20
 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
21
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
22
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23
 */
24
 
25
package ao68000_tool;
26
 
27
import java.io.File;
28
import java.io.FileOutputStream;
29
 
30
public class Main {
31
    /**
32
     * Print program call arguments description and exit.
33
     */
34
    static void print_call_arguments() {
35
        System.out.println("Can not parse program arguments.");
36
        System.out.println("");
37
        System.out.println("ao68000_tool accepts the following syntax:");
38
        System.out.println("<operation> [operation arguments]");
39
        System.out.println("");
40
        System.out.println("The following   <operations> are available:");
41
        System.out.println("\t parser       <input ao68000.v> <output Parser.java>");
42
        System.out.println("\t microcode    <input/output ao68000.v> <output microcode.mif>");
43
        System.out.println("\t test         <input exe1> <input exe2> <start> <end>");
44
        System.out.println("\t spec_extract <input> <output>");
45
        System.out.println("");
46
        System.out.println("For more information please read the ao68000 IP core documentation.");
47
 
48
        System.exit(1);
49
    }
50
 
51
    /**
52
     * @param args          - program arguments described in method
53
     *                        print_call_arguments().
54
     */
55
    public static void main(String[] args) {
56
        try {
57
            // check program call arguments
58
            if(args.length == 0)                                                print_call_arguments();
59
            else if(args[0].equals("parser") == true && args.length != 3)       print_call_arguments();
60
            else if(args[0].equals("microcode") == true && args.length != 3)    print_call_arguments();
61
            else if(args[0].equals("test") == true && args.length != 5)         print_call_arguments();
62
            else if(args[0].equals("spec_extract") == true && args.length != 3) print_call_arguments();
63
 
64
            if(args[0].equals("parser")) {
65
                String java = ParseParams.parse(args[1]);
66
 
67
                FileOutputStream output = new FileOutputStream(args[2]);
68
                output.write(java.getBytes());
69
                output.close();
70
            }
71
            else if(args[0].equals("microcode")) {
72
                ParseParams.parse(args[1]);
73
 
74
                FileOutputStream microcode_os = new FileOutputStream(args[2]);
75
 
76
                GenerateMicrocode.generate(microcode_os, args[1]);
77
 
78
                microcode_os.close();
79
            }
80
            else if(args[0].equals("test")) {
81
                File exe1 = new File(args[1]);
82
                File exe2 = new File(args[2]);
83
 
84
                int start = Integer.parseInt(args[3]);
85
                int end = Integer.parseInt(args[4]);
86
 
87
                Tester.start_test(exe1, exe2, start, end);
88
            }
89
            else if(args[0].equals("spec_extract")) {
90
                DocumentationTool.extract(args[1], args[2]);
91
            }
92
 
93
            System.exit(0);
94
        }
95
        catch(Exception e) {
96
            e.printStackTrace();
97
 
98
            try {
99
                while(true) {
100
                    Thread.sleep(1000);
101
                }
102
            }
103
            catch(Exception e2) {
104
                e2.printStackTrace();
105
            }
106
        }
107
    }
108
}

powered by: WebSVN 2.1.0

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