Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
ce78a659
Commit
ce78a659
authored
Aug 01, 2013
by
Paweł Szostek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add GPL info to the files where it's missing
parent
e60d0ffe
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
573 additions
and
119 deletions
+573
-119
__main__.py
hdlmake/__main__.py
+16
-1
__init__.py
hdlmake/action/__init__.py
+20
-2
action.py
hdlmake/action/action.py
+20
-1
check_manifest.py
hdlmake/action/check_manifest.py
+21
-0
clean.py
hdlmake/action/clean.py
+21
-0
default.py
hdlmake/action/default.py
+20
-0
fetch.py
hdlmake/action/fetch.py
+20
-0
fetch_makefile.py
hdlmake/action/fetch_makefile.py
+21
-0
ise_makefile.py
hdlmake/action/ise_makefile.py
+21
-0
ise_project.py
hdlmake/action/ise_project.py
+21
-0
list_files.py
hdlmake/action/list_files.py
+21
-1
list_modules.py
hdlmake/action/list_modules.py
+21
-0
merge_cores.py
hdlmake/action/merge_cores.py
+21
-0
quartus_project.py
hdlmake/action/quartus_project.py
+21
-0
remote_synthesis.py
hdlmake/action/remote_synthesis.py
+20
-0
simulation.py
hdlmake/action/simulation.py
+21
-1
__init__.py
hdlmake/fetch/__init__.py
+20
-1
backend_factory.py
hdlmake/fetch/backend_factory.py
+20
-1
git.py
hdlmake/fetch/git.py
+20
-1
svn.py
hdlmake/fetch/svn.py
+20
-1
module.py
hdlmake/module.py
+16
-0
isim.py
hdlmake/tools/isim.py
+22
-0
vhdl_parser.py
hdlmake/vhdl_parser.py
+129
-109
No files found.
hdlmake/__main__.py
View file @
ce78a659
...
...
@@ -3,7 +3,22 @@
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
# Modified to allow ISim simulation by Lucas Russo (lucas.russo@lnls.br)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
print_function
import
os
...
...
hdlmake/action/__init__.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
check_manifest
import
CheckManifest
from
clean
import
CleanModules
...
...
@@ -13,4 +32,3 @@ from merge_cores import MergeCores
from
quartus_project
import
GenerateQuartusProject
from
remote_synthesis
import
GenerateRemoteSynthesisMakefile
from
simulation
import
GenerateSimulationMakefile
hdlmake/action/action.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import
sys
import
logging
...
...
hdlmake/action/check_manifest.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
action
import
Action
from
manifest_parser
import
ManifestParser
...
...
hdlmake/action/clean.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
action
import
Action
import
logging
...
...
hdlmake/action/default.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import
logging
import
sys
...
...
hdlmake/action/fetch.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import
logging
import
sys
...
...
hdlmake/action/fetch_makefile.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
action
import
Action
import
logging
...
...
hdlmake/action/ise_makefile.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
print_function
from
action
import
Action
import
logging
...
...
hdlmake/action/ise_project.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
print_function
import
logging
from
action
import
Action
...
...
hdlmake/action/list_files.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
action
import
Action
...
...
hdlmake/action/list_modules.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
action
import
Action
from
util
import
path
...
...
hdlmake/action/merge_cores.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
print_function
import
logging
from
action
import
Action
...
...
hdlmake/action/quartus_project.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
print_function
import
logging
import
os
...
...
hdlmake/action/remote_synthesis.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
action
import
Action
import
logging
...
...
hdlmake/action/simulation.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
print_function
from
action
import
Action
import
logging
...
...
hdlmake/fetch/__init__.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
backend_factory
import
BackendFactory
from
svn
import
Svn
...
...
hdlmake/fetch/backend_factory.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
git
import
Git
from
svn
import
Svn
...
...
hdlmake/fetch/git.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import
os
from
util
import
path
...
...
hdlmake/fetch/svn.py
View file @
ce78a659
#!/usr/bin/env python
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
import
os
import
logging
...
...
hdlmake/module.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
from
__future__
import
print_function
from
manifest_parser
import
Manifest
,
ManifestParser
...
...
hdlmake/tools/isim.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Pawel Szostek (pawel.szostek@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
ISIM_STARDAND_LIBS
=
[
'std'
,
'ieee'
,
'ieee_proposed'
,
'vl'
,
'synopsys'
,
'simprim'
,
'unisim'
,
'unimacro'
,
'aim'
,
'cpld'
,
'pls'
,
'xilinxcorelib'
,
'aim_ver'
,
'cpld_ver'
,
...
...
hdlmake/vhdl_parser.py
View file @
ce78a659
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2013 CERN
# Author: Tomasz Wlostowski (tomasz.wlostowski@cern.ch)
#
# This file is part of Hdlmake.
#
# Hdlmake 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 3 of the License, or
# (at your option) any later version.
#
# Hdlmake 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 Hdlmake. If not, see <http://www.gnu.org/licenses/>.
def
remove_gaps
(
buf
,
delims
,
gap_chars
,
lower_strings
=
False
):
da
=
{}
for
d
in
delims
:
da
[
d
]
=
False
prev_is_gap
=
False
buf2
=
""
lines
=
[]
for
c
in
buf
:
for
d
in
delims
:
if
(
c
==
d
):
da
[
d
]
=
not
da
[
d
]
within_string
=
any
(
da
.
values
())
and
not
(
c
in
delims
)
if
(
not
within_string
):
if
(
c
in
gap_chars
):
if
(
not
prev_is_gap
):
prev_is_gap
=
True
buf2
+=
" "
else
:
prev_is_gap
=
False
buf2
+=
c
if
(
c
==
";"
or
c
==
"
\n
"
):
lines
.
append
(
buf2
);
buf2
=
""
else
:
buf2
+=
c
;
prev_is_gap
=
False
da
=
{}
for
d
in
delims
:
da
[
d
]
=
False
prev_is_gap
=
False
buf2
=
""
lines
=
[]
for
c
in
buf
:
for
d
in
delims
:
if
(
c
==
d
):
da
[
d
]
=
not
da
[
d
]
within_string
=
any
(
da
.
values
())
and
not
(
c
in
delims
)
if
(
not
within_string
):
if
(
c
in
gap_chars
):
if
(
not
prev_is_gap
):
prev_is_gap
=
True
buf2
+=
" "
else
:
prev_is_gap
=
False
buf2
+=
c
if
(
c
==
";"
or
c
==
"
\n
"
):
lines
.
append
(
buf2
);
buf2
=
""
else
:
buf2
+=
c
;
prev_is_gap
=
False
return
lines
return
lines
from
dep_solver
import
DepParser
,
DepRelation
,
DepFile
class
VHDLParser
(
DepParser
):
def
parse
(
self
,
f_deps
,
filename
):
f
=
open
(
filename
,
"r"
)
buf
=
""
# stage 1: strip comments
for
l
in
f
:
ci
=
l
.
find
(
"--"
)
if
(
ci
==
0
):
continue
while
(
ci
>
0
):
nquotes
=
l
[:
ci
]
.
count
(
'"'
)
# ignore comments in strings
if
(
nquotes
%
2
==
0
):
l
=
l
[:
ci
-
1
];
break
ci
=
l
.
find
(
"--"
,
ci
+
1
)
buf
+=
l
# stage 2: remove spaces, crs, lfs, strip strings (we don't need them)
buf2
=
""
string_literal
=
char_literal
=
False
prev_is_gap
=
False
gap_chars
=
"
\r\n\t
"
lines
=
[]
for
c
in
buf
:
if
(
c
==
'"'
and
not
char_literal
):
string_literal
=
not
string_literal
if
(
c
==
"'"
and
not
string_literal
)
:
char_literal
=
not
char_literal
within_string
=
(
string_literal
or
char_literal
)
and
(
c
!=
'"'
)
and
(
c
!=
"'"
)
if
(
not
within_string
):
if
(
c
in
gap_chars
):
if
(
not
prev_is_gap
):
prev_is_gap
=
True
buf2
+=
" "
else
:
prev_is_gap
=
False
buf2
+=
c
.
lower
()
if
(
c
==
";"
):
lines
.
append
(
buf2
);
buf2
=
""
else
:
prev_is_gap
=
False
def
parse
(
self
,
f_deps
,
filename
):
f
=
open
(
filename
,
"r"
)
buf
=
""
# stage 1: strip comments
for
l
in
f
:
ci
=
l
.
find
(
"--"
)
if
(
ci
==
0
):
continue
while
(
ci
>
0
):
nquotes
=
l
[:
ci
]
.
count
(
'"'
)
# ignore comments in strings
if
(
nquotes
%
2
==
0
):
l
=
l
[:
ci
-
1
];
break
ci
=
l
.
find
(
"--"
,
ci
+
1
)
buf
+=
l
# stage 2: remove spaces, crs, lfs, strip strings (we don't need them)
buf2
=
""
string_literal
=
char_literal
=
False
prev_is_gap
=
False
gap_chars
=
"
\r\n\t
"
lines
=
[]
for
c
in
buf
:
if
(
c
==
'"'
and
not
char_literal
):
string_literal
=
not
string_literal
if
(
c
==
"'"
and
not
string_literal
)
-
:
char_literal
=
not
char_literal
within_string
=
(
string_literal
or
char_literal
)
and
(
c
!=
'"'
)
and
(
c
!=
"'"
)
if
(
not
within_string
):
if
(
c
in
gap_chars
):
if
(
not
prev_is_gap
):
prev_is_gap
=
True
buf2
+=
" "
else
:
prev_is_gap
=
False
buf2
+=
c
.
lower
()
if
(
c
==
";"
):
lines
.
append
(
buf2
);
buf2
=
""
else
:
prev_is_gap
=
False
import
re
import
re
patterns
=
{
"use"
:
"^ *use *(
\
w+) *
\
. *(
\
w+) *. *
\
w+ *;"
,
"entity"
:
"^ *entity +(
\
w+) +is +(port|generic)"
,
"package"
:
"^ *package +(
\
w+) +is"
,
"arch_begin"
:
"^ *architecture +(
\
w+) +of +(
\
w+) +is +"
,
"arch_end"
:
"^ *end +(
\
w+) +;"
,
"instance"
:
"^ *(
\
w+) *
\
: *(
\
w+) *(port|generic) *map"
}
compiled_patterns
=
map
(
lambda
p
:
(
p
,
re
.
compile
(
patterns
[
p
])),
patterns
)
patterns
=
{
"use"
:
"^ *use *(
\
w+) *
\
. *(
\
w+) *. *
\
w+ *;"
,
"entity"
:
"^ *entity +(
\
w+) +is +(port|generic)"
,
"package"
:
"^ *package +(
\
w+) +is"
,
"arch_begin"
:
"^ *architecture +(
\
w+) +of +(
\
w+) +is +"
,
"arch_end"
:
"^ *end +(
\
w+) +;"
,
"instance"
:
"^ *(
\
w+) *
\
: *(
\
w+) *(port|generic) *map"
}
compiled_patterns
=
map
(
lambda
p
:
(
p
,
re
.
compile
(
patterns
[
p
])),
patterns
)
within_architecture
=
False
for
l
in
lines
:
matches
=
filter
(
lambda
(
k
,
v
):
v
!=
None
,
map
(
lambda
(
k
,
v
):
(
k
,
re
.
match
(
v
,
l
)),
compiled_patterns
))
if
(
not
len
(
matches
)):
continue
what
,
g
=
matches
[
0
]
if
(
what
==
"use"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
)
+
"."
+
g
.
group
(
2
),
DepRelation
.
USE
,
DepRelation
.
PACKAGE
))
if
(
what
==
"package"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
PROVIDE
,
DepRelation
.
PACKAGE
))
elif
(
what
==
"entity"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
PROVIDE
,
DepRelation
.
ENTITY
))
elif
(
what
==
"package"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
PROVIDE
,
DepRelation
.
PACKAGE
))
elif
(
what
==
"arch_begin"
):
arch_name
=
g
.
group
(
1
)
within_architecture
=
True
elif
(
what
==
"arch_end"
and
within_architecture
and
g
.
group
(
1
)
==
arch_name
):
within_architecture
=
False
elif
(
what
==
"instance"
and
within_architecture
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
USE
,
DepRelation
.
ENTITY
))
within_architecture
=
False
for
l
in
lines
:
matches
=
filter
(
lambda
(
k
,
v
):
v
!=
None
,
map
(
lambda
(
k
,
v
):
(
k
,
re
.
match
(
v
,
l
)),
compiled_patterns
))
if
(
not
len
(
matches
)):
continue
what
,
g
=
matches
[
0
]
if
(
what
==
"use"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
)
+
"."
+
g
.
group
(
2
),
DepRelation
.
USE
,
DepRelation
.
PACKAGE
))
if
(
what
==
"package"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
PROVIDE
,
DepRelation
.
PACKAGE
))
elif
(
what
==
"entity"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
PROVIDE
,
DepRelation
.
ENTITY
))
elif
(
what
==
"package"
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
PROVIDE
,
DepRelation
.
PACKAGE
))
elif
(
what
==
"arch_begin"
):
arch_name
=
g
.
group
(
1
)
within_architecture
=
True
elif
(
what
==
"arch_end"
and
within_architecture
and
g
.
group
(
1
)
==
arch_name
):
within_architecture
=
False
elif
(
what
==
"instance"
and
within_architecture
):
f_deps
.
add_relation
(
DepRelation
(
g
.
group
(
1
),
DepRelation
.
USE
,
DepRelation
.
ENTITY
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a 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