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

Subversion Repositories socgen

[/] [socgen/] [trunk/] [tools/] [bin/] [ver2xml] - Blame information for rev 123

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

Line No. Rev Author Line
1 65 jt_eaton
eval 'exec `which perl` -S $0 ${1+"$@"}'
2
   if 0;
3
 
4
#/**********************************************************************/
5
#/*                                                                    */
6
#/*             -------                                                */
7
#/*            /   SOC  \                                              */
8
#/*           /    GEN   \                                             */
9
#/*          /    TOOL    \                                            */
10
#/*          ==============                                            */
11
#/*          |            |                                            */
12
#/*          |____________|                                            */
13
#/*                                                                    */
14
#/*  convert verilog file(s) to a geda symbol                          */
15
#/*                                                                    */
16
#/*                                                                    */
17
#/*  Author(s):                                                        */
18
#/*      - John Eaton, jt_eaton@opencores.org                          */
19
#/*                                                                    */
20
#/**********************************************************************/
21
#/*                                                                    */
22
#/*    Copyright (C) <2010>                     */
23
#/*                                                                    */
24
#/*  This source file may be used and distributed without              */
25
#/*  restriction provided that this copyright statement is not         */
26
#/*  removed from the file and that any derivative work contains       */
27
#/*  the original copyright notice and the associated disclaimer.      */
28
#/*                                                                    */
29
#/*  This source file is free software; you can redistribute it        */
30
#/*  and/or modify it under the terms of the GNU Lesser General        */
31
#/*  Public License as published by the Free Software Foundation;      */
32
#/*  either version 2.1 of the License, or (at your option) any        */
33
#/*  later version.                                                    */
34
#/*                                                                    */
35
#/*  This source is distributed in the hope that it will be            */
36
#/*  useful, but WITHOUT ANY WARRANTY; without even the implied        */
37
#/*  warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR           */
38
#/*  PURPOSE.  See the GNU Lesser General Public License for more      */
39
#/*  details.                                                          */
40
#/*                                                                    */
41
#/*  You should have received a copy of the GNU Lesser General         */
42
#/*  Public License along with this source; if not, download it        */
43
#/*  from http://www.opencores.org/lgpl.shtml                          */
44
#/*                                                                    */
45
#/**********************************************************************/
46
 
47
#  ToDo:
48
#  parse reg from output bus name
49
#  parse bus and change pin type to bus
50
 
51
use Verilog::Netlist;
52
 
53
# Setup options so files can be found
54
use Verilog::Getopt;
55
my $opt = new Verilog::Getopt;
56
$opt->parameter( "+incdir+verilog",
57
                    "-y","verilog",
58
               );
59
 
60
 
61
@files            = @ARGV;
62
 
63
 
64
# Prepare netlist
65
my $nl = new Verilog::Netlist (options => $opt,);
66
 
67
foreach $file (@files) {
68
                        print "Parsing   $file\n";
69
                        $nl->read_file (filename=>$file);
70
}
71
 
72
 
73
 
74
 
75
 
76
 
77
 
78
# Read in any sub-modules
79
$nl->link();
80
$nl->exit_if_error();
81
 
82
 
83
foreach my $mod ($nl->top_modules_sorted) {make_sch ($mod);}
84
 
85
 
86
 
87
sub make_sch {
88
        my $mod = shift;
89
        my $mod_name  = $mod->name;
90
 
91
        open(FILE,">xml/${mod_name}.xml") or die "No sym directory";
92
 
93 82 jt_eaton
          printf FILE ("\n");
94 65 jt_eaton
 
95
        foreach my $sig ($mod->ports_sorted) {
96
 
97
            my $dir       =  $sig->direction;
98
            my $data_type =  $sig->data_type;
99
            my $sig_name  =  $sig->name;
100
            $data_type  =~ s/reg //;
101
            $data_type  =~ s/reg//;
102
 
103
 
104 82 jt_eaton
          printf FILE ("\n  %sput\n",$dir);
105 65 jt_eaton
 
106
 
107
            if($data_type)
108
              {
109
              printf FILE ("  %s\n",$data_type);
110
              $pin_name = "$sig_name"."$data_type";
111
              }
112
 
113 82 jt_eaton
          printf FILE ("  %s\n\n\n",$sig_name);
114 65 jt_eaton
 
115
        }
116
 
117
 
118 82 jt_eaton
          printf FILE ("\n");
119 65 jt_eaton
 
120
 
121
 
122
 
123
 
124
 
125
 
126
 
127
 
128
        foreach my $cell ($mod->cells_sorted) {
129
            close(FILE);
130
            make_sch ($cell->submod, $cell->name) if $cell->submod;
131
        }
132
    }
133
 
134
 
135
 
136
 
137
 
138
 
139
 
140
1;
141
 
142
 
143
 
144
 
145
 
146
 
147
 

powered by: WebSVN 2.1.0

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