Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tiger
nolimips
Commits
b6c7182d
Commit
b6c7182d
authored
Jul 03, 2003
by
Benoit Perrot
Browse files
Adjust generators output.
parent
b1b38f05
Changes
1
Hide whitespace changes
Inline
Side-by-side
dev/mipsy-inst-gen.py
View file @
b6c7182d
#!/usr/bin/env python
##
## This file is part of Mipsy, a tiny MIPS simulator
## Copyright (C) 2003 Benoit Perrot <benoit@lrde.epita.fr>
##
## Mipsy is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation; either version 2 of the License, or
## (at your option) any later version.
##
## Mipsy is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
## GNU General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with this program; if not, write to the Free Software
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##
import
sys
import
string
,
re
...
...
@@ -132,12 +150,12 @@ instructions = parser.parse(sys.stdin)
## Generate headers --------------------
for
inst
in
instructions
:
if
inst
.
level
==
"native"
:
sys
.
stdout
=
open
(
"/tmp/inst/"
+
inst
.
opcode
+
".hh"
,
"w"
)
sys
.
stdout
=
open
(
inst
.
opcode
+
".hh"
,
"w"
)
header
(
inst
)
## Generate all-includer ---------------
sys
.
stdout
=
open
(
"
/tmp/inst/
all.hh"
,
"w"
)
sys
.
stdout
=
open
(
"all.hh"
,
"w"
)
print
license
print
"#ifndef INST_ALL_HH"
print
"# define INST_ALL_HH"
...
...
@@ -148,7 +166,7 @@ print "#endif // !INST_ALL_HH"
## Generate all-declarator -------------
sys
.
stdout
=
open
(
"
/tmp/inst/
decl.hh"
,
"w"
)
sys
.
stdout
=
open
(
"decl.hh"
,
"w"
)
print
license
print
"#ifndef INST_DECL_HH"
print
"# define INST_DECL_HH"
...
...
@@ -167,7 +185,7 @@ print """
## Generate visitor -----------
sys
.
stdout
=
open
(
"
/tmp/inst/
visitor.hh"
,
"w"
)
sys
.
stdout
=
open
(
"visitor.hh"
,
"w"
)
print
license
print
"""#ifndef INST_VISITOR_HH
# define INST_VISITOR_HH
...
...
@@ -202,27 +220,3 @@ print """
} // namespace inst
#endif // !INST_VISITOR_HH"""
## Generate Makefile.am ----------------
sys
.
stdout
=
open
(
"/tmp/inst/Makefile.am"
,
"w"
)
print
"""INCLUDES = -I $(top_srcdir)/src
noinst_LIBRARIES = libinst.a
libinst_a_SOURCES =
\\
register.hh
\\
exp.hh
\\
exp-visitor.hh
\\
inst.hh
\\
decl.hh
\\
all.hh
\\
visitor.hh
\\
program.hh
\\
label.hh label.cc
\\
text_section.hh
\\
data_section.hh
\\
program.hh
\\
program_builder.hh program_builder.cc
\\
program_solver.hh
\\
"""
for
i
in
range
(
0
,
len
(
instructions
)):
if
instructions
[
i
].
level
==
"native"
:
print
"
\t
"
+
instructions
[
i
].
opcode
+
".hh
\t\t\t\t\\
"
print
"
\t
inst-tasks.hh inst-tasks.cc"
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment