From: Cary R. <cy...@ya...> - 2011-11-03 16:39:27
|
Regarding the first warning. The definition of $readmem changed slightly in the 1364-2005 standard. This was discussed on this list so look in the archives for more information. This message is to inform you that our version of $readmem has detected a situation where the the two standards will produce different results and we are following the 1364-2005 standard. If you want the details look at the comments in the code and read the appropriate sections of the two standards. If things are working as you expect then you can disregard the warning. As I remember this is all related to the order of the array [0:x] vs [x:0] and a range not being provided on the $readmem call. The second one is there to say that the memory was not filled, so don't expect every element to contain a value. I believe it is required by the standardand if you provide an address specification in the file the message is not printed (e.g. @0 to say start loading the next lines starting at address 0). It's been a while and I don't have time to look this up. To get the first four bytes you could open the file and read the first 4 bytes using the normal file I/O routines. The last warning is basically the same as the second one. I believe it is required by the standard and can be suppressed by using an address specification. Cary ----- Original Message ----- From: R. Diez <rdi...@ya...> To: Discussions Icarus Verilog development <ive...@li...> Cc: Sent: Thursday, November 3, 2011 3:52 AM Subject: [Iverilog-devel] Reading a file of variable length without Icarus warnings Hi all: I'm trying to read a hex firmware file into a Verilog array with $readmemh(). The firmware file's size depends on the C source code, so that, although it will always be smaller than the Verilog array, its size is not fixed. I'm getting these warnings: WARNING: minsoc_bench.v:111: $readmemh: Standard inconsistency, following 1364-2005. WARNING: minsoc_bench.v:111: $readmemh(../../sw/uart/uart.hex): Not enough words in the file for the requested range [0:32767]. The "Standard inconsistency" text could by the way be more user friendly. I guess the problem is that I'm trying to read too much. How do I find out the file size before calling $readmemh(), in order to avoid those warnings? The file's data length is inside the file itself, as a 4-byte header, but if I try to read just that 4-byte header, I get this warning, because I'm reading too little (!): WARNING: minsoc_bench.v:111: $readmemh(../../sw/uart/uart.hex): Too many words in the file for the requested range [0:3]. Thanks, R. Diez ------------------------------------------------------------------------------ RSA(R) Conference 2012 Save $700 by Nov 18 Register now http://p.sf.net/sfu/rsa-sfdev2dev1 _______________________________________________ Iverilog-devel mailing list Ive...@li... https://lists.sourceforge.net/lists/listinfo/iverilog-devel |