Discussion:
PATCH: verilog hex memory dump backend for BFD
g***@moxielogic.com
2009-04-22 21:15:41 UTC
Permalink
The following patch adds a new output-only format to BFD called
"verilog hex memory dump format".

When developing a new microprocessor in verilog it is important to
develop testbenches using simulated memory containing real programs.
In order to help populate this memory, verilog provides the
$readmemh() function to load an array of verilog registers (memory)
with the contents of a file. The file must be in the verilog hex
memory dump format as defined by the IEEE verilog standard.

Adding support for this format directly into BFD greatly simplifies
the workflow:

$ moxie-elf-gcc -o hello.x hello.c
$ moxie-elf-objcopy -O verilog hello.x hello.vh

Now hello.vh can be used to populate memory modules directly in
verilog like so:

module memory();
reg [7:0] my_memory [0:64000];
initial begin
$readmemh("hello.vh", my_memory);
end
endmodule;

This new feature was tested with a Free Software verilog
implementation called Icarus Verilog.

Ok?


2009-04-22 Anthony Green <***@moxielogic.com>

* verilog.c: New file.
* Makefile.am (BFD32_LIBS): Add verilog.c.
(BFD32_LIBS_CFILES): Add verilog.c.
(verilog.lo): New build rule.
* Makefile.in: Rebuilt.
* targets.c: Add verilog support.
* bfd-in2.h: Add verilog support.
Anthony Green
2009-04-27 12:41:54 UTC
Permalink
Ping. Thanks!

AG
Post by g***@moxielogic.com
The following patch adds a new output-only format to BFD called
"verilog hex memory dump format".
When developing a new microprocessor in verilog it is important to
develop testbenches using simulated memory containing real programs.
In order to help populate this memory, verilog provides the
$readmemh() function to load an array of verilog registers (memory)
with the contents of a file. The file must be in the verilog hex
memory dump format as defined by the IEEE verilog standard.
Adding support for this format directly into BFD greatly simplifies
$ moxie-elf-gcc -o hello.x hello.c
$ moxie-elf-objcopy -O verilog hello.x hello.vh
Now hello.vh can be used to populate memory modules directly in
module memory();
reg [7:0] my_memory [0:64000];
initial begin
$readmemh("hello.vh", my_memory);
end
endmodule;
This new feature was tested with a Free Software verilog
implementation called Icarus Verilog.
Ok?
* verilog.c: New file.
* Makefile.am (BFD32_LIBS): Add verilog.c.
(BFD32_LIBS_CFILES): Add verilog.c.
(verilog.lo): New build rule.
* Makefile.in: Rebuilt.
* targets.c: Add verilog support.
* bfd-in2.h: Add verilog support.
Nick Clifton
2009-04-27 14:29:16 UTC
Permalink
Hi Anthony,
Post by Anthony Green
Ping. Thanks!
Sorry - I was looking at this over the weekend.
Post by Anthony Green
Post by g***@moxielogic.com
* verilog.c: New file.
* Makefile.am (BFD32_LIBS): Add verilog.c.
(BFD32_LIBS_CFILES): Add verilog.c.
(verilog.lo): New build rule.
* Makefile.in: Rebuilt.
* targets.c: Add verilog support.
* bfd-in2.h: Add verilog support.
Approved and applied. I made two small changes - the patch to bfd-in2.h
really needed to be applied to bfd.h, and a quick mention of the new
support was needed in binutils/NEWS.

Cheers
Nick
Anthony Green
2009-04-27 16:05:25 UTC
Permalink
Post by Nick Clifton
Hi Anthony,
Post by Anthony Green
Ping. Thanks!
Sorry - I was looking at this over the weekend.
Post by Anthony Green
Post by g***@moxielogic.com
* verilog.c: New file.
* Makefile.am (BFD32_LIBS): Add verilog.c.
(BFD32_LIBS_CFILES): Add verilog.c.
(verilog.lo): New build rule.
* Makefile.in: Rebuilt.
* targets.c: Add verilog support.
* bfd-in2.h: Add verilog support.
Approved and applied. I made two small changes - the patch to
bfd-in2.h really needed to be applied to bfd.h, and a quick mention of
the new support was needed in binutils/NEWS.
Thanks Nick!

AG
Post by Nick Clifton
Cheers
Nick
Anthony Green
2009-04-30 04:37:18 UTC
Permalink
Post by Nick Clifton
Hi Anthony,
Post by Anthony Green
Ping. Thanks!
Sorry - I was looking at this over the weekend.
Post by Anthony Green
Post by g***@moxielogic.com
* verilog.c: New file.
* Makefile.am (BFD32_LIBS): Add verilog.c.
(BFD32_LIBS_CFILES): Add verilog.c.
(verilog.lo): New build rule.
* Makefile.in: Rebuilt.
* targets.c: Add verilog support.
* bfd-in2.h: Add verilog support.
Approved and applied. I made two small changes - the patch to bfd-in2.h
really needed to be applied to bfd.h, and a quick mention of the new
support was needed in binutils/NEWS.
In the NEWS file, you refer to it as the "verilog binary file format".
There is something called the verilog binary file format, but this isn't
it. This is the verilog memory hex dump format. The "binary files"
serve the same purpose as the hex files, but instead of ASCII hex digits
it's a text file full of '1' and '0' strings. I've committed this minor
but obvious tweak to the NEWS file...


2009-04-29 Anthony Green <***@moxielogic.com>

* NEWS: Tweak verilog support description.

Index: binutils/NEWS
===================================================================
RCS file: /cvs/src/src/binutils/NEWS,v
retrieving revision 1.80
diff -u -r1.80 NEWS
--- binutils/NEWS 27 Apr 2009 14:27:36 -0000 1.80
+++ binutils/NEWS 30 Apr 2009 03:56:11 -0000
@@ -1,7 +1,7 @@
-*- text -*-

-* The verilog binary file format is now supported as an output format
for
- objcopy.
+* The verilog memory hex dump file format is now supported as an output
format
+ for objcopy.
Post by Nick Clifton
Cheers
Nick
Nick Clifton
2009-04-30 06:54:25 UTC
Permalink
Hi Anthony,
Post by Anthony Green
In the NEWS file, you refer to it as the "verilog binary file format".
There is something called the verilog binary file format, but this isn't
it. This is the verilog memory hex dump format. The "binary files"
serve the same purpose as the hex files, but instead of ASCII hex digits
it's a text file full of '1' and '0' strings. I've committed this minor
but obvious tweak to the NEWS file...
Thanks.

Cheers
Nick

Loading...