Discussion:
[Ghdl-discuss] Windows GHDL and DLX processor model - compilation problems.
Sanjay Singh
2014-10-30 03:55:43 UTC
Permalink
Greetings fellow GHDL users.

I was hoping to use the Windows GHDL version so that undergrad students I
am helping could easily practice with VHDL coding on their personal
machines.

But I am experiencing a problem with Windows GHDL and I don't know what
the workaround is. Perhaps it's simple and someone might be able to help
me out. GHDL is of such quality that I believe the fault is with me rather
than the program.

Here is my attempt to compile and run the tarball DLX on Windows with GHDL
0.29.1 Sokcho:

===
C:\Documents and Settings\ASIC\dlx>ghdl -i --workdir=work *.vhdl

C:\Documents and Settings\ASIC\dlx>ghdl -m --workdir=WORK dlx_test_behaviour

C:\Documents and Settings\ASIC\dlx>ghdl -r dlx_test_behaviour
error: cannot find entity or configuration dlx_test_behaviour

C:\Documents and Settings\ASIC\dlx>
===

And on my Unix machine, running GHDL 0.27:

bash-2.03$ ghdl -i --workdir=WORK *.vhdl
bash-2.03$ ghdl -m --workdir=WORK dlx_test_behaviour
analyze dlx_test.vhdl
analyze dlx_types.vhdl
analyze dlx_types-body.vhdl
analyze mem_types.vhdl
analyze dlx_test-bench.vhdl
analyze clock_gen.vhdl
analyze clock_gen-behaviour.vhdl
analyze memory.vhdl
analyze bv_arithmetic.vhdl
analyze bv_arithmetic-body.vhdl
analyze images.vhdl
analyze images-body.vhdl
analyze memory-behaviour.vhdl
analyze dlx_bus_monitor.vhdl
analyze dlx_instr.vhdl
analyze dlx_instr-body.vhdl
analyze dlx_bus_monitor-behaviour.vhdl
analyze dlx.vhdl
analyze dlx-behaviour.vhdl
analyze dlx_test_behaviour.vhdl
elaborate dlx_test_behaviour
bash-2.03$ ghdl -r dlx_test_behaviour
0 X"20020000"
4 X"AC020018"
8 X"20420001"
12 X"6441000A"
16 X"1420FFF0"
20 X"44000000"
proc: fetching instruction...
proc: fetching instruction...
bus monitor: I-fetch from X"00000000"
bus monitor: X"20020000" [ ADDI R2, R0, 0 ]
proc: incrementing PC...
proc: decoding instruction...
proc: executing instruction...
proc: end of execution
[...]

===

I (and the students) would be grateful for any help on this.

Also, I am working on an update of the GHDL tutorial guide PDF that is a
few years old. I want to include some of this information that pertains to
a newer release of GHDL. Once I get past this snag, and have gone through
the rest of the GHDL guide, I'll send updates to this list for suggestions
and feedback.

Thanks,

(S)
Tristan Gingold
2014-11-22 09:06:31 UTC
Permalink
Post by Sanjay Singh
Greetings fellow GHDL users.
I was hoping to use the Windows GHDL version so that undergrad students
I am helping could easily practice with VHDL coding on their personal
machines.
But I am experiencing a problem with Windows GHDL and I don't know what
the workaround is. Perhaps it's simple and someone might be able to help
me out. GHDL is of such quality that I believe the fault is with me
rather than the program.
Here is my attempt to compile and run the tarball DLX on Windows with
===
C:\Documents and Settings\ASIC\dlx>ghdl -i --workdir=work *.vhdl
C:\Documents and Settings\ASIC\dlx>ghdl -m --workdir=WORK
dlx_test_behaviour
C:\Documents and Settings\ASIC\dlx>ghdl -r dlx_test_behaviour
error: cannot find entity or configuration dlx_test_behaviour
I think this is an inconsistency between windows and linux. On Windows,
you don't need to do the 'ghdl -m' step, and simply try
(note -c -r):

ghdl -c -r dlx_test_behaviour
Post by Sanjay Singh
===
I (and the students) would be grateful for any help on this.
Also, I am working on an update of the GHDL tutorial guide PDF that is a
few years old. I want to include some of this information that pertains
to a newer release of GHDL. Once I get past this snag, and have gone
through the rest of the GHDL guide, I'll send updates to this list for
suggestions and feedback.
Changes to the documentation are welcome!

Tristan.
Brian Davis
2014-11-25 02:02:30 UTC
Permalink
Post by Sanjay Singh
Here is my attempt to compile and run the
I would advise switching to the current ghdl-0.31-mcode-win32 build
from SourceForge.

Download Page:
http://sourceforge.net/projects/ghdl-updates/files/Builds/ghdl-0.31/Windows/

Windows Install Wiki Page:
http://sourceforge.net/p/ghdl-updates/wiki/Windows%20ghdl-0.31%20install%20from%20zip/

I can successfully run the DLX example with the following using
ghdl-0.31-mcode-win32:

ghdl -i --workdir=work *.vhdl
ghdl -m --workdir=work dlx_test_behaviour
ghdl -e --workdir=work dlx_test_behaviour
ghdl -r --workdir=work dlx_test_behaviour --assert-level=note

I tend to include the elaborate stage, which although not strictly
necessary for the mcode build, more closely resembles GHDL usage for
the gcc back end.

============
Using GHDL with obsolete synposys std_logic_arith, std_logic_{un}signed
libraries:
Add the --ieee=synopsys option to the commands lines.

============
Using GHDL with GTKWave

Adding the --wave option to the run command line will generate a .ghw
file that can be viewed with GTKWave.
Note that this waveform capture will slow the simulation.

ghdl -r --workdir=work.ghd testbench --stop-time=500ms
--wave=ghdl_sim.ghw

If the testbench stops the clock upon completion, there is no need for
the --stop-time option.

============
Some other windows GHDL scripting examples in can be found in my
perpetually unfinished homebrew processor project:

Switch debouncer stimulus testbench:

https://code.google.com/p/yard-1/source/browse/trunk/hdl/common/debounce/test/

UART test bench:

https://code.google.com/p/yard-1/source/browse/trunk/hdl/cores/m_uart/test/

I typically use batch file(s) that look like this:
ghdl -a -v --workdir=work.ghd ..\m_uart_pkg.vhd
..\simple_baud_gen.vhd ..\m_uart.vhd m_uart_tb.vhd
ghdl -e --workdir=work.ghd testbench
ghdl -r --workdir=work.ghd testbench --wave=ghdl_sim.ghw

-Brian
Brian Drummond
2014-11-25 11:00:13 UTC
Permalink
Post by Brian Davis
Post by Sanjay Singh
Here is my attempt to compile and run the
I would advise switching to the current ghdl-0.31-mcode-win32 build
from SourceForge.
http://sourceforge.net/projects/ghdl-updates/files/Builds/ghdl-0.31/Windows/
http://sourceforge.net/p/ghdl-updates/wiki/Windows%20ghdl-0.31%20install%20from%20zip/
Or indeed the even newer ghdl-0.32rc1 if you're brave enough to build
from source...

Brian, have you tried that one yet?

If not, "hg clone" from the repo, "hg update -r ghdl-0.32" for the rc1
snapshot, and give it a go, if you have time.

I just built the gcc version yesterday ... smooth except one minor
niggle that won't affect the mcode build, and I hope to get a chance to
test it today.

So feedback on building it for Windows would be useful if time and
enthusiasm allows.

The main thing it adds is a fair bit of VHDL-2008 support, enough to
allow OSVVM 2014-01 to run without VHDL-2002 fiddles.
Post by Brian Davis
============
Some other windows GHDL scripting examples in can be found in my
https://code.google.com/p/yard-1/source/browse/trunk/hdl/common/debounce/test/
https://code.google.com/p/yard-1/source/browse/trunk/hdl/cores/m_uart/test/
ghdl -a -v --workdir=work.ghd ..\m_uart_pkg.vhd
..\simple_baud_gen.vhd ..\m_uart.vhd m_uart_tb.vhd
ghdl -e --workdir=work.ghd testbench
ghdl -r --workdir=work.ghd testbench --wave=ghdl_sim.ghw
-Brian
Oooh, these might be useful additions to our Wiki, if you so permit...

- Brian
Brian Davis
2014-11-26 02:42:24 UTC
Permalink
Post by Brian Drummond
Brian, have you tried that one yet?
I saw the 0.32 list traffic earlier this month, but haven't had time to
try a build yet, hopefully by the end of November.

I need to first recreate the Windows build/regression test environment
on my new PC.
( The GNAT stuff is native, but the test suite needs an ersatz shell
environment to run. )
Post by Brian Drummond
Post by Brian Davis
Some other windows GHDL scripting examples in can be found
Oooh, these might be useful additions to our Wiki, if you so permit...
Certainly.
I've also been meaning to add equivalent shell scripts to those project
directories.

Looking at the current "Using ghdl" wiki page, I think David's
stackoverflow answer covers much of that ground already, and would make
a good basis for a cross-platform wiki page or manual section.

-Brian
Brian Davis
2014-11-30 02:40:29 UTC
Permalink
Or indeed the even newer ghdl-0.32rc1 <snip>
Brian, have you tried that one yet?
At a first glance, it doesn't appear that the Windows build
infrastructure has been kept up to date with the 0.32 source tree
changes.

I was hoping to get things sorted out over this long weekend (US
holiday), but two days without power put somewhat of a crimp in my
computing plans.

Attached is a work-in-progress patch file for what I've found so far.

See notes below.

-Brian

------------------
Build Problems

In previous releases, I used ./translate/mcode/winbuild.bat to build
the Windows mcode target; this then invokes compile.bat and complib.bat
in ./translate/mcode/windows

In 0.32, this process fails, as the file
./translate/ghdldrv/ghdl_mcode.adb has been renamed to ghdl_jit.adb in
the source tree.

After patching compile.bat to use ghdl_jit, ghdl.exe is then built; but
the subsequent library analysis fails.

------------------
Library Analysis Problems

I see various errors analyzing the VHDL libraries with the resulting
ghdl.exe

- the v87 std library isn't being analyzed sucessfully, which then
causes a cascade of failures.

- the v93 library fails on textio.

It seems that .\translate\mcode\windows\ghdlfilter.adb was not updated
to support the --{START-|END-}V08 markups needed to preprocess the new
version of the libraries.

Additionally, the 2008 block markups added to the libraries do not
start in column 1 as required by the currrent ghdlfilter.exe

After patching ghdlfilter and the libraries, the analysis errors are
gone (although there are still warnings I need to review.)

I will also need to update complib.bat (and the derived
reanalyze_libs.bat found in the zip file distribution) to analyze the
v08 libs along with v87 and v93.

------------------
version & configuration report:

It's odd that the 0.32 --disp_config no longer sees GHDL_PREFIX from
the Windows environment variable.
echo %GHDL_PREFIX%
C:\Ghdl\ghdl-0.32-test\lib
ghdl --version
GHDL 0.32rc1 (20141104) [Dunoon edition]
Compiled with GNAT Version: GPL 2014 (20140331)
mcode code generator
Written by Tristan Gingold.

Copyright (C) 2003 - 2014 Tristan Gingold.
GHDL is free software, covered by the GNU General Public License.
There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE.
ghdl --disp-config
command line prefix (--PREFIX): (not set)
environment prefix (GHDL_PREFIX): (not set)
exec prefix (from program name): C:\Ghdl\ghdl-0.32-test

library prefix: C:\Ghdl\ghdl-0.32-test\lib
library directory: C:\Ghdl\ghdl-0.32-test\lib
command_name: C:\Ghdl\ghdl-0.32-test\bin\ghdl.exe
default library pathes:
C:\Ghdl\ghdl-0.32-test\lib\v93\std\
C:\Ghdl\ghdl-0.32-test\lib\v93\ieee\

---
Tristan Gingold
2014-11-30 10:37:09 UTC
Permalink
Post by Brian Davis
Or indeed the even newer ghdl-0.32rc1 <snip>
Brian, have you tried that one yet?
At a first glance, it doesn't appear that the Windows build
infrastructure has been kept up to date with the 0.32 source tree changes.
I was hoping to get things sorted out over this long weekend (US
holiday), but two days without power put somewhat of a crimp in my
computing plans.
Attached is a work-in-progress patch file for what I've found so far.
That's look correct to me. I will merge your patch.

Thanks!

Tristan.
Tristan Gingold
2014-12-03 02:18:52 UTC
Permalink
Post by Brian Davis
Or indeed the even newer ghdl-0.32rc1 <snip>
Brian, have you tried that one yet?
At a first glance, it doesn't appear that the Windows build
infrastructure has been kept up to date with the 0.32 source tree changes.
I was hoping to get things sorted out over this long weekend (US
holiday), but two days without power put somewhat of a crimp in my
computing plans.
Attached is a work-in-progress patch file for what I've found so far.
I have just pushed your patches (on both the branch and the head).

On the head, I haven't yet reworked the scripts after source reorg. But
I need to reboot on windows for that.

Thanks!
Tristan.
Brian Davis
2014-12-05 00:44:38 UTC
Permalink
Post by Tristan Gingold
I have just pushed your patches (on both the branch and the head).
Thanks- I have also started working on the 2008 library updates to
complib.bat, I hope to finish that this weekend.

At that point I should be able to try running the testsuite.

I have not looked into the GHDL_PATH issue yet.
Post by Tristan Gingold
On the head, I haven't yet reworked the scripts after source reorg.
But I need to reboot on windows for that.
I noticed that the old Windows build directory had vanished in the
mainline, but wasn't sure what the plan was...

Is the new ./dist/mcode/windows directory the intended method to do a
windows build ?

Or is the plan to eventually build the Windows mcode target with the
new top level configure/make infrastructure, running in MSYS/MinGW ?

-Brian


Posted by Tristan Gingold on December 03, 2014 - 03:19:

On 30/11/14 03:40, Brian Davis wrote:

On November 25, 2014, Brian Drummond wrote:


Or indeed the even newer ghdl-0.32rc1 <snip>
Brian, have you tried that one yet?

At a first glance, it doesn't appear that the Windows build
infrastructure has been kept up to date with the 0.32 source tree
changes.

I was hoping to get things sorted out over this long weekend (US
holiday), but two days without power put somewhat of a crimp in my
computing plans.

Attached is a work-in-progress patch file for what I've found so
far.


I have just pushed your patches (on both the branch and the head).

On the head, I haven't yet reworked the scripts after source reorg. But
I need to reboot on windows for that.


Thanks!
Tristan.
Tristan Gingold
2014-12-05 05:18:57 UTC
Permalink
Post by Brian Davis
Post by Tristan Gingold
I have just pushed your patches (on both the branch and the head).
Thanks- I have also started working on the 2008 library updates to
complib.bat, I hope to finish that this weekend.
At that point I should be able to try running the testsuite.
That would be a good test.
Post by Brian Davis
I have not looked into the GHDL_PATH issue yet.
I am not sure that this is a real issue. On windows, path for the
library is built from the executable path.
Post by Brian Davis
Post by Tristan Gingold
On the head, I haven't yet reworked the scripts after source reorg.
But I need to reboot on windows for that.
I noticed that the old Windows build directory had vanished in the
mainline, but wasn't sure what the plan was...
Hasn't really vanished, but moved to dist/
Post by Brian Davis
Is the new ./dist/mcode/windows directory the intended method to do a
windows build ?
Or is the plan to eventually build the Windows mcode target with the new
top level configure/make infrastructure, running in MSYS/MinGW ?
Good question. I haven't updated dist/mcode/windows but I plan to do it
eventually. configure/make should work on windows too and bug/patches
for that are welcome, but the windows scripts also build the NSIS installer.

Tristan.
Brian Drummond
2014-12-05 11:36:02 UTC
Permalink
Post by Tristan Gingold
Post by Brian Davis
I noticed that the old Windows build directory had vanished in the
mainline, but wasn't sure what the plan was...
Hasn't really vanished, but moved to dist/
Post by Brian Davis
Is the new ./dist/mcode/windows directory the intended method to do a
windows build ?
Or is the plan to eventually build the Windows mcode target with the new
top level configure/make infrastructure, running in MSYS/MinGW ?
Good question. I haven't updated dist/mcode/windows but I plan to do it
eventually. configure/make should work on windows too and bug/patches
for that are welcome, but the windows scripts also build the NSIS installer.
It was my understanding that 0.32 is built according to the current
process, but future versions are changing, yes?
Looks like it might be a very worthwhile improvement.

- Brian

Loading...