0

我正在尝试使用 xilinx 的保险丝(ISE 的一部分)使用我从大学获得的库编译 vhdl 文件 - pgm_pkg.vhd. 该库用于将 *.pgm 图像格式读入 vhdl 模拟器。在 Windows 的 Modelsim 中模拟时它工作正常,但不幸的是,在使用 fuse 在 debian 上编译时会产生以下错误:
*** glibc detected *** /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse: malloc(): memory corruption (fast): 0x00000000019c7780 ***

在运行 Windows 的虚拟机上使用 Modelsim(在学生版中非常慢)(这使得它更慢)是我想不惜一切代价避免的事情。我已将问题缩小到read_pgm_file()迭代 *.pgm 文件并提供图像后续像素的函数。

我读过 gcc 在编译崩溃之前经常会引发这种错误,但即使这样也无济于事,因为 fuse 是一个闭源应用程序。我尝试使用不同的 *.pgm 图片,我还尝试使用详细模式编译它(我没有发现任何有用的东西)并且编译多线程关闭 - 仍然会发生相同的错误。

1)我该如何处理这样的错误?编译过程中是否有任何调试工具?2)图书馆有什么问题?我看不到任何可能导致问题的东西,尤其是同一个库在 Windows 上运行良好。

vhdl 测试文件:IEEE 库;使用 IEEE.std_logic_1164.all;使用 IEEE.std_logic_arith.all;使用 IEEE.std_logic_unsigned.all;

    USE work.pgm_pkg.ALL; -- read and write pgm format files package (max 512x512)

    entity test_raw_tb is
        GENERIC (
                    ifile : STRING := "pepper.ascii.pgm"
        );
    end test_raw_tb;

    architecture behavioral of test_raw_tb is
        constant infile : pgm_record_type := read_pgm_file(ifile);
    begin   -- architecture

    end behavioral;

pgm_pkg.vhd 库:

PACKAGE pgm_pkg IS

    constant max : NATURAL := 640;
    constant pgm_row_size : integer :=18;

  TYPE pixel_array_type IS ARRAY(0 TO max-1, 0 TO max - 1) OF integer;

  TYPE pgm_record_type IS RECORD
    magic_number : STRING(1 TO 2);
    width        : NATURAL;
    height       : NATURAL;
    max_val      : NATURAL;
    pixel        : pixel_array_type;
  END RECORD;

  IMPURE FUNCTION read_pgm_file(filename : IN STRING) 
  RETURN pgm_record_type;

  IMPURE FUNCTION write_pgm_file(filename : IN STRING; pgm : pgm_record_type) 
  RETURN BOOLEAN;

  IMPURE FUNCTION write_pgm_comment_file(filename : IN STRING; pgm : pgm_record_type) 
  RETURN BOOLEAN;

END pgm_pkg;
-----------------------------------------------------------------------------
library IEEE;
use IEEE.std_logic_1164.all;
library std;
use std.textio.all;

PACKAGE BODY pgm_pkg IS

   IMPURE FUNCTION read_pgm_file(filename : IN STRING) 
    RETURN pgm_record_type IS
    FILE     filehandle   : TEXT open read_mode is filename;
    VARIABLE inline       : LINE;
    VARIABLE inline_copy  : LINE;
    VARIABLE char         : CHARACTER;
    VARIABLE good         : BOOLEAN;
    VARIABLE number       : integer;
    VARIABLE header_index : NATURAL;
    VARIABLE magic_number : STRING(1 TO 2);
    VARIABLE got_magic_number : BOOLEAN := FALSE;
    VARIABLE width        : NATURAL;
    VARIABLE height       : NATURAL;
    VARIABLE max_val      : NATURAL;
    VARIABLE got_header   : BOOLEAN;
    VARIABLE pi,pj        : NATURAL; -- pixel index
    VARIABLE pgm          : pgm_record_type;
  BEGIN
    got_magic_number := FALSE;
    got_header := FALSE;
    header_index := 0;
    pi := 0; -- pixel index
    pj := 0;
    WHILE (NOT(ENDFILE(filehandle))) LOOP
      READLINE(filehandle, inline);
      -- make a copy of inline string for later (note it's an access type)
      inline_copy := new STRING'(inline.ALL);
      READ(inline, char, good);
      -- move on to next line if it's a comment
      NEXT WHEN char = '#';
      -- special case for magic number
      IF (got_magic_number = FALSE) THEN
        ASSERT (char = 'P' OR char = 'p')
          REPORT "Error: Not PGM format file. Magic number should start with P."
          SEVERITY FAILURE;
        READ(inline, char, good);
        ASSERT (char = '2')
          REPORT "Error: Not ASCII PGM format file. Magic number should be P2."
          SEVERITY FAILURE;
        pgm.magic_number(1) := 'P';
        pgm.magic_number(2) := '2';
        got_magic_number := TRUE;
        -- strip off first two characters of inline_copy as they were magic_number
        READ(inline_copy, char, good);
        READ(inline_copy, char, good);
      END IF;
      IF (got_magic_number = TRUE) THEN 
        good := TRUE;
        WHILE (inline_copy'LENGTH /= 0 AND good = TRUE) LOOP
          READ(inline_copy, number, good);
          IF (good = TRUE) THEN
            IF (got_header = TRUE) THEN
              pgm.pixel(pi,pj) := number;
              pj := pj + 1;
              if pj=pgm.width then
                 pj:=0;
                 pi:=pi+1;
              end if;
            ELSE
              IF (header_index = 0) THEN -- it must be width
                pgm.width := number;
                header_index := 1; -- look for height next
                ELSIF (header_index = 1) THEN -- it must be height
                pgm.height := number;
                header_index := 2; -- look for max_val next
              ELSE -- it must be max_val
                pgm.max_val := number;
                got_header := TRUE;
              END IF; -- header_index
            END IF; -- got_header
          END IF; -- good
        END LOOP;
      END IF; -- got_magic_number = TRUE
    END LOOP; -- NOT ENDFILE
    ASSERT got_header
      REPORT "Error: Can't find header information - giving up."
      SEVERITY FAILURE;      
    RETURN pgm;
  END read_pgm_file;

-----------------------------------------------------------------------

  IMPURE FUNCTION write_pgm_comment_file(filename : IN STRING;
                          pgm : pgm_record_type) 
    RETURN BOOLEAN IS
    FILE     filehandle : TEXT open write_mode is filename;
    VARIABLE outline : LINE;
    VARIABLE pi,pj : NATURAL; -- pixel index
    VARIABLE k : NATURAL := 0;
    CONSTANT row_comment : STRING := "# row ";
  BEGIN

    WRITE(outline, pgm.magic_number);
    WRITELINE(filehandle, outline);
    WRITE(outline, pgm.width);
    WRITELINE(filehandle, outline);
    WRITE(outline, pgm.height);
    WRITELINE(filehandle, outline);
    WRITE(outline, pgm.max_val);
    WRITELINE(filehandle, outline);
    pi := 0;
    pj := 0;
    k := 0;

    wfile_i: 
    for pi in 0 to pgm.height-1 loop
        write(outline, string'("# row "));
        write(outline, pi, left, 5);
        writeline(filehandle, outline);
        wfile_j: 
        for pj in 0 to pgm.width-1 loop
            write(outline,pgm.pixel(pi,pj),right,4);
            if k < (pgm_row_size - 1) then
                k:=k+1;
            else
                writeline(filehandle,outline); 
                k:=0;
            end if;
        end loop wfile_j;
        k:=0;       
        writeline(filehandle,outline); 
    end loop wfile_i;

    RETURN TRUE;
end write_pgm_comment_file;

-----------------------------------------------------------------------------

  IMPURE FUNCTION write_pgm_file(filename : IN STRING;
                          pgm : pgm_record_type) 
    RETURN BOOLEAN IS
    FILE     filehandle : TEXT open write_mode is filename;
    VARIABLE outline : LINE;
    VARIABLE pi,pj : NATURAL; -- pixel index
    VARIABLE k : NATURAL := 0;
  BEGIN

    WRITE(outline, pgm.magic_number);
    WRITELINE(filehandle, outline);
    WRITE(outline, pgm.width);
    WRITE(outline, ' ');
    WRITE(outline, pgm.height);
    WRITELINE(filehandle, outline);
    WRITE(outline, pgm.max_val);
    WRITELINE(filehandle, outline);
    pi := 0;
    pj := 0;
    k := 0;

       wfile_i: 
       for pi in 0 to pgm.height-1 loop
           wfile_j: 
           for pj in 0 to pgm.width-1 loop
               write(outline,pgm.pixel(pi,pj),right,4);
               if k < (pgm_row_size - 1) then
                   k:=k+1;
               else
                   writeline(filehandle,outline); 
                   k:=0;
               end if;
           end loop wfile_j;
           k:=0;
           writeline(filehandle,outline); 
       end loop wfile_i;

    RETURN TRUE;
    end write_pgm_file;

end pgm_pkg;

编译日志:

Compilation of test_raw_tb.vhd...
Running: /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse -v 2 -mt off -o test_raw_tb.exe -prj test_raw_tb.prj test_raw_tb 
ISim P.49d (signature 0xfbc00daa)
Turned off multi-threading for compilation
Determining compilation order of HDL files
--output trimmed--
Parsing VHDL file "pgm_pkg.vhd" into library work
Parsing VHDL file "test_raw_tb.vhd" into library work
Starting static elaboration
Executing test_raw_tb(behavioral)
*** glibc detected *** /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse: malloc(): memory corruption (fast): 0x00000000019c7780 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x76d76)[0x7f11af7c4d76]
/lib/x86_64-linux-gnu/libc.so.6(+0x7a658)[0x7f11af7c8658]
/lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x70)[0x7f11af7c9b90]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libstlport.so.5.1(_Znwm+0x1d)[0x7f11b2b7909d]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libPortability.so(_ZN15Port_MsgManData12createObjectEPKcS1_iS1_+0x33)[0x7f11b286a043]
/opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse[0x5fe2ba]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xf030)[0x7f11b0180030]
/lib/x86_64-linux-gnu/libc.so.6(+0x1277fc)[0x7f11af8757fc]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific5Array6RemoveEjj+0x3a)[0x7f11b3748906]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific16VhdlSubprogramId24ElaboratePragmaProcedureEPKNS_5ArrayEPNS_12VhdlDataFlowE+0x145f)[0x7f11b3a2e295]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific16VhdlSubprogramId19ElaborateSubprogramEPNS_5ArrayEPNS_14VhdlConstraintEPNS_12VhdlDataFlowEPNS_12VhdlTreeNodeEPNS_9VhdlIdDefE+0xf3)[0x7f11b3a2e8b1]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific15VhdlIndexedName8EvaluateEPNS_14VhdlConstraintEPNS_12VhdlDataFlowEj+0x12b)[0x7f11b3a4cc81]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific26VhdlProcedureCallStatement9ElaborateEPNS_12VhdlDataFlowEPNS_22VhdlBlockConfigurationE+0x3e)[0x7f11b3a85c7a]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific15VhdlWhileScheme9ElaborateEPNS_9VhdlIdDefEPNS_5ArrayES4_PNS_22VhdlBlockConfigurationEPNS_12VhdlDataFlowE+0x2b3)[0x7f11b3a38867]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific17VhdlLoopStatement9ElaborateEPNS_12VhdlDataFlowEPNS_22VhdlBlockConfigurationE+0xfe)[0x7f11b3a85da8]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific15VhdlIfStatement13ElaborateCoreEPNS_12VhdlDataFlowE+0x24f)[0x7f11b3a88731]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific15VhdlIfStatement9ElaborateEPNS_12VhdlDataFlowEPNS_22VhdlBlockConfigurationE+0x52)[0x7f11b3a88e8a]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific15VhdlWhileScheme9ElaborateEPNS_9VhdlIdDefEPNS_5ArrayES4_PNS_22VhdlBlockConfigurationEPNS_12VhdlDataFlowE+0x2b3)[0x7f11b3a38867]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific17VhdlLoopStatement9ElaborateEPNS_12VhdlDataFlowEPNS_22VhdlBlockConfigurationE+0xfe)[0x7f11b3a85da8]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific18VhdlSubprogramBody19ElaborateSubprogramEPKNS_5ArrayEPNS_14VhdlConstraintEPNS_12VhdlDataFlowEPNS_12VhdlTreeNodeEjPNS_9VhdlIdDefE+0x1217)[0x7f11b3a10cdf]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific16VhdlSubprogramId19ElaborateSubprogramEPNS_5ArrayEPNS_14VhdlConstraintEPNS_12VhdlDataFlowEPNS_12VhdlTreeNodeEPNS_9VhdlIdDefE+0x1aa)[0x7f11b3a2e968]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific15VhdlIndexedName8EvaluateEPNS_14VhdlConstraintEPNS_12VhdlDataFlowEj+0x12b)[0x7f11b3a4cc81]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific16VhdlConstantDecl9ElaborateEPNS_12VhdlDataFlowE+0x8b)[0x7f11b3a0d7f1]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific20VhdlArchitectureBody15StaticElaborateEPNS_22VhdlBlockConfigurationE+0x9e)[0x7f11b3ac9c54]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific14VhdlEntityDecl23StaticElaborateInternalEPKcPNS_5ArrayES4_PNS_22VhdlBlockConfigurationEPNS_9VhdlIdDefE+0x3ff)[0x7f11b3ac91d1]
/opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(_ZN7Verific14VhdlEntityDecl15StaticElaborateEPKcPNS_5ArrayES4_PNS_22VhdlBlockConfigurationEPNS_9VhdlIdDefE+0x157)[0x7f11b3ac7f35]
/opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(_ZN5ISIMC4Fuse15elaborateDesignEv+0x27a)[0x4550aa]
/opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(_ZN5ISIMC4Fuse3runEv+0x117)[0x46aaf7]
/opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(_ZN5ISIMC4Fuse4mainEiPPc+0x59)[0x46bcb9]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd)[0x7f11af76cead]
/opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(__gxx_personality_v0+0x209)[0x451c49]
======= Memory map: ========
00400000-006c0000 r-xp 00000000 08:05 1977591                            /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse
008c0000-008c7000 rw-p 002c0000 08:05 1977591                            /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse
008c7000-008c8000 rw-p 00000000 00:00 0 
01602000-019cf000 rw-p 00000000 00:00 0                                  [heap]
7f11a8000000-7f11a8021000 rw-p 00000000 00:00 0 
7f11a8021000-7f11ac000000 ---p 00000000 00:00 0 
7f11aec42000-7f11aef92000 r-xp 00000000 08:05 1978523                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libxercesc.so
7f11aef92000-7f11af191000 ---p 00350000 08:05 1978523                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libxercesc.so
7f11af191000-7f11af1ce000 rw-p 0034f000 08:05 1978523                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libxercesc.so
7f11af1ce000-7f11af1cf000 rw-p 00000000 00:00 0 
7f11af1cf000-7f11af22f000 r-xp 00000000 08:05 1978520                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libUtilC_MessageDispatcher.so
7f11af22f000-7f11af42f000 ---p 00060000 08:05 1978520                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libUtilC_MessageDispatcher.so
7f11af42f000-7f11af433000 rw-p 00060000 08:05 1978520                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libUtilC_MessageDispatcher.so
7f11af433000-7f11af449000 r-xp 00000000 08:05 1978531                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_zlib-gcc41-mt-p-1_38.so.1.38.0
7f11af449000-7f11af548000 ---p 00016000 08:05 1978531                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_zlib-gcc41-mt-p-1_38.so.1.38.0
7f11af548000-7f11af549000 rw-p 00015000 08:05 1978531                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_zlib-gcc41-mt-p-1_38.so.1.38.0
7f11af549000-7f11af54d000 r-xp 00000000 08:05 786505                     /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f11af54d000-7f11af74c000 ---p 00004000 08:05 786505                     /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f11af74c000-7f11af74d000 r--p 00003000 08:05 786505                     /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f11af74d000-7f11af74e000 rw-p 00004000 08:05 786505                     /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7f11af74e000-7f11af8ce000 r-xp 00000000 08:05 786451                     /lib/x86_64-linux-gnu/libc-2.13.so
7f11af8ce000-7f11aface000 ---p 00180000 08:05 786451                     /lib/x86_64-linux-gnu/libc-2.13.so
7f11aface000-7f11afad2000 r--p 00180000 08:05 786451                     /lib/x86_64-linux-gnu/libc-2.13.so
7f11afad2000-7f11afad3000 rw-p 00184000 08:05 786451                     /lib/x86_64-linux-gnu/libc-2.13.so
7f11afad3000-7f11afad8000 rw-p 00000000 00:00 0 
7f11afad8000-7f11afaed000 r-xp 00000000 08:05 786436                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f11afaed000-7f11afced000 ---p 00015000 08:05 786436                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f11afced000-7f11afcee000 rw-p 00015000 08:05 786436                     /lib/x86_64-linux-gnu/libgcc_s.so.1
7f11afcee000-7f11afd6f000 r-xp 00000000 08:05 786448                     /lib/x86_64-linux-gnu/libm-2.13.so
7f11afd6f000-7f11aff6e000 ---p 00081000 08:05 786448                     /lib/x86_64-linux-gnu/libm-2.13.so
7f11aff6e000-7f11aff6f000 r--p 00080000 08:05 786448                     /lib/x86_64-linux-gnu/libm-2.13.so
7f11aff6f000-7f11aff70000 rw-p 00081000 08:05 786448                     /lib/x86_64-linux-gnu/libm-2.13.so
7f11aff70000-7f11b0056000 r-xp 00000000 08:05 1983260                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libstdc++.so.6
7f11b0056000-7f11b0156000 ---p 000e6000 08:05 1983260                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libstdc++.so.6
7f11b0156000-7f11b0157000 r--p 000e6000 08:05 1983260                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libstdc++.so.6
7f11b0157000-7f11b015f000 rw-p 000e7000 08:05 1983260                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libstdc++.so.6
7f11b015f000-7f11b0171000 rw-p 00000000 00:00 0 
7f11b0171000-7f11b0188000 r-xp 00000000 08:05 786441                     /lib/x86_64-linux-gnu/libpthread-2.13.so
7f11b0188000-7f11b0387000 ---p 00017000 08:05 786441                     /lib/x86_64-linux-gnu/libpthread-2.13.so
7f11b0387000-7f11b0388000 r--p 00016000 08:05 786441                     /lib/x86_64-linux-gnu/libpthread-2.13.so
7f11b0388000-7f11b0389000 rw-p 00017000 08:05 786441                     /lib/x86_64-linux-gnu/libpthread-2.13.so
7f11b0389000-7f11b038d000 rw-p 00000000 00:00 0 
7f11b038d000-7f11b038f000 r-xp 00000000 08:05 786444                     /lib/x86_64-linux-gnu/libdl-2.13.so
7f11b038f000-7f11b058f000 ---p 00002000 08:05 786444                     /lib/x86_64-linux-gnu/libdl-2.13.so
7f11b058f000-7f11b0590000 r--p 00002000 08:05 786444                     /lib/x86_64-linux-gnu/libdl-2.13.so
7f11b0590000-7f11b0591000 rw-p 00003000 08:05 786444                     /lib/x86_64-linux-gnu/libdl-2.13.so
7f11b0591000-7f11b05df000 r-xp 00000000 08:05 1978522                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libUtilities.so
7f11b05df000-7f11b07de000 ---p 0004e000 08:05 1978522                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libUtilities.so
7f11b07de000-7f11b07e1000 rw-p 0004d000 08:05 1978522                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libUtilities.so
7f11b07e1000-7f11b07f2000 r-xp 00000000 08:05 1978515                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libStaticFileParsers.so
7f11b07f2000-7f11b09f2000 ---p 00011000 08:05 1978515                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libStaticFileParsers.so
7f11b09f2000-7f11b09f3000 rw-p 00011000 08:05 1978515                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libStaticFileParsers.so
7f11b09f3000-7f11b0a02000 r-xp 00000000 08:05 1978526                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_bzip2-gcc41-mt-p-1_38.so.1.38.0
7f11b0a02000-7f11b0b01000 ---p 0000f000 08:05 1978526                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_bzip2-gcc41-mt-p-1_38.so.1.38.0
7f11b0b01000-7f11b0b03000 rw-p 0000e000 08:05 1978526                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_bzip2-gcc41-mt-p-1_38.so.1.38.0
7f11b0b03000-7f11b0b04000 r-xp 00000000 08:05 1978009                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libCit_Core.so
7f11b0b04000-7f11b0d04000 ---p 00001000 08:05 1978009                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libCit_Core.so
7f11b0d04000-7f11b0d05000 rw-p 00001000 08:05 1978009                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libCit_Core.so
7f11b0d05000-7f11b0d8a000 r-xp 00000000 08:05 1978505                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libPersonalityModule.so
7f11b0d8a000-7f11b0f89000 ---p 00085000 08:05 1978505                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libPersonalityModule.so
7f11b0f89000-7f11b0f8e000 rw-p 00084000 08:05 1978505                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libPersonalityModule.so
7f11b0f8e000-7f11b0f9b000 r-xp 00000000 08:05 1978528                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_iostreams-gcc41-mt-p-1_38.so.1.38.0
7f11b0f9b000-7f11b109a000 ---p 0000d000 08:05 1978528                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_iostreams-gcc41-mt-p-1_38.so.1.38.0
7f11b109a000-7f11b109b000 rw-p 0000c000 08:05 1978528                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_iostreams-gcc41-mt-p-1_38.so.1.38.0
7f11b109b000-7f11b1153000 r-xp 00000000 08:05 1978529                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_regex-gcc41-mt-p-1_38.so.1.38.0
7f11b1153000-7f11b1252000 ---p 000b8000 08:05 1978529                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_regex-gcc41-mt-p-1_38.so.1.38.0
7f11b1252000-7f11b1257000 rw-p 000b7000 08:05 1978529                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libboost_regex-gcc41-mt-p-1_38.so.1.38.0
7f11b1257000-7f11b1260000 r-xp 00000000 08:05 1978503                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libMiniZip.so
7f11b1260000-7f11b145f000 ---p 00009000 08:05 1978503                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libMiniZip.so
7f11b145f000-7f11b1460000 rw-p 00008000 08:05 1978503                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libMiniZip.so
7f11b1460000-7f11b1476000 r-xp 00000000 08:05 1978525                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libZlib.so
7f11b1476000-7f11b1675000 ---p 00016000 08:05 1978525                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libZlib.so
7f11b1675000-7f11b1676000 rw-p 00015000 08:05 1978525                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libZlib.so
7f11b1676000-7f11b1680000 r-xp 00000000 08:05 1978518                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libThread.so
7f11b1680000-7f11b187f000 ---p 0000a000 08:05 1978518                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libThread.so
7f11b187f000-7f11b1880000 rw-p 00009000 08:05 1978518                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libThread.so
7f11b1880000-7f11b1883000 rw-p 00000000 00:00 0 
7f11b1883000-7f11b188b000 r-xp 00000000 08:05 1978507                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libPort_Std.so
7f11b188b000-7f11b1a8a000 ---p 00008000 08:05 1978507                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libPort_Std.so
7f11b1a8a000-7f11b1a8b000 rw-p 00007000 08:05 1978507                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libPort_Std.so
7f11b1a8b000-7f11b1c8d000 rwxp 00000000 08:05 1978502                    /opt/Xilinx/14.4/ISE_DS/ISE/lib/lin64/libisl_iostreams.soERROR:Simulator:772 - Signal SIGABRT received
Printing stacktrace...

[0] /lib/x86_64-linux-gnu/libc.so.6(+0x6d52b) [0x7f11af7bb52b]
[1] /lib/x86_64-linux-gnu/libc.so.6(+0x76d76) [0x7f11af7c4d76]
[2] /lib/x86_64-linux-gnu/libc.so.6(+0x7a658) [0x7f11af7c8658]
[3] /lib/x86_64-linux-gnu/libc.so.6(__libc_malloc+0x70) [0x7f11af7c9b90]
[4] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libstlport.so.5.1(operator new(unsigned long)+0x1d) [0x7f11b2b7909d]
[5] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libPortability.so(Port_MsgManData::createObject(char const*, char const*, int, char const*)+0x33) [0x7f11b286a043]
[6] /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse() [0x5fe2ba]
[7] /lib/x86_64-linux-gnu/libpthread.so.0(+0xf030) [0x7f11b0180030]
[8] /lib/x86_64-linux-gnu/libc.so.6(+0x1277fc) [0x7f11af8757fc]
[9] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::Array::Remove(unsigned int, unsigned int)+0x3a) [0x7f11b3748906]
[10] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlSubprogramId::ElaboratePragmaProcedure(Verific::Array const*, Verific::VhdlDataFlow*)+0x145f) [0x7f11b3a2e295]
[11] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlSubprogramId::ElaborateSubprogram(Verific::Array*, Verific::VhdlConstraint*, Verific::VhdlDataFlow*, Verific::VhdlTreeNode*, Verific::VhdlIdDef*)+0xf3) [0x7f11b3a2e8b1]
[12] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlIndexedName::Evaluate(Verific::VhdlConstraint*, Verific::VhdlDataFlow*, unsigned int)+0x12b) [0x7f11b3a4cc81]
[13] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlProcedureCallStatement::Elaborate(Verific::VhdlDataFlow*, Verific::VhdlBlockConfiguration*)+0x3e) [0x7f11b3a85c7a]
[14] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlWhileScheme::Elaborate(Verific::VhdlIdDef*, Verific::Array*, Verific::Array*, Verific::VhdlBlockConfiguration*, Verific::VhdlDataFlow*)+0x2b3) [0x7f11b3a38867]
[15] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlLoopStatement::Elaborate(Verific::VhdlDataFlow*, Verific::VhdlBlockConfiguration*)+0xfe) [0x7f11b3a85da8]
[16] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlIfStatement::ElaborateCore(Verific::VhdlDataFlow*)+0x24f) [0x7f11b3a88731]
[17] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlIfStatement::Elaborate(Verific::VhdlDataFlow*, Verific::VhdlBlockConfiguration*)+0x52) [0x7f11b3a88e8a]
[18] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlWhileScheme::Elaborate(Verific::VhdlIdDef*, Verific::Array*, Verific::Array*, Verific::VhdlBlockConfiguration*, Verific::VhdlDataFlow*)+0x2b3) [0x7f11b3a38867]
[19] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlLoopStatement::Elaborate(Verific::VhdlDataFlow*, Verific::VhdlBlockConfiguration*)+0xfe) [0x7f11b3a85da8]
[20] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlSubprogramBody::ElaborateSubprogram(Verific::Array const*, Verific::VhdlConstraint*, Verific::VhdlDataFlow*, Verific::VhdlTreeNode*, unsigned int, Verific::VhdlIdDef*)+0x1217) [0x7f11b3a10cdf]
[21] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlSubprogramId::ElaborateSubprogram(Verific::Array*, Verific::VhdlConstraint*, Verific::VhdlDataFlow*, Verific::VhdlTreeNode*, Verific::VhdlIdDef*)+0x1aa) [0x7f11b3a2e968]
[22] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlIndexedName::Evaluate(Verific::VhdlConstraint*, Verific::VhdlDataFlow*, unsigned int)+0x12b) [0x7f11b3a4cc81]
[23] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlConstantDecl::Elaborate(Verific::VhdlDataFlow*)+0x8b) [0x7f11b3a0d7f1]
[24] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlArchitectureBody::StaticElaborate(Verific::VhdlBlockConfiguration*)+0x9e) [0x7f11b3ac9c54]
[25] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlEntityDecl::StaticElaborateInternal(char const*, Verific::Array*, Verific::Array*, Verific::VhdlBlockConfiguration*, Verific::VhdlIdDef*)+0x3ff) [0x7f11b3ac91d1]
[26] /opt/Xilinx/14.4/ISE_DS/ISE//lib/lin64/libVrfc_Verific.so(Verific::VhdlEntityDecl::StaticElaborate(char const*, Verific::Array*, Verific::Array*, Verific::VhdlBlockConfiguration*, Verific::VhdlIdDef*)+0x157) [0x7f11b3ac7f35]
[27] /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(ISIMC::Fuse::elaborateDesign()+0x27a) [0x4550aa]
[28] /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(ISIMC::Fuse::run()+0x117) [0x46aaf7]
[29] /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(ISIMC::Fuse::main(int, char**)+0x59) [0x46bcb9]
[30] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xfd) [0x7f11af76cead]
[31] /opt/Xilinx/14.4/ISE_DS/ISE/bin/lin64/unwrapped/fuse(__gxx_personality_v0+0x209) [0x451c49]
4

1 回答 1

2

PGM 是一种基于 ASCII 的格式,这也是因为 ISE 模拟器在访问二进制文件时存在问题。(可以做到,但您必须跳过几个环节,包括赛灵思实际上拒绝记录的 9 字节标头)

最可能的原因是您试图在堆栈上返回一个固定大小的 640x640x4 字节数组,而不管实际图像大小如何。写那个包的人需要检查他们的头脑。

但在进一步沿着这条推理线前进之前,值得检查堆栈上的一个小得多的数组是否可以工作。找到一个小的 PGMfile(比如 16*16)并编辑包,使其“最大”略大于文件(20*20 或 32*32 应该是安全的)。

假设可行,报告回来,我们可以制定一个更合适的解决方案:要么是一个带有 OUT 参数的过程(调用者分配它),要么是一个函数返回一个访问类型(指针)到实际存储。

或者:尝试使用 GHDL 作为替代模拟器。它具有控制堆栈大小的运行时选项,这可能会绕过该问题。

进行一些实验后进行编辑:(1)“内存损坏”似乎出现在数据后包含空格的行上。在文本编辑器中删除它会消除该问题(重写行解析器以消除该问题可能是一个更好的答案......)

(2) 修复后,精化阶段似乎挂起。行后的一些断言pgm.pixel(pi,pj) := number;表明它实际上正在运行;爬行或滑行可能是一个更好的术语。我实际上还没有总结耐心让它运行超过 100 行,所以我不能说结果是否成功。

      pgm.pixel(pi,pj) := number;
      assert pi < 10 report "Pixel " & natural'image(pi) & " : " & natural'image(pj) severity note;

(ETC)

编辑后进一步挖掘:

显然,ISIM 对精细化的处理与运行时计算不同。假设在那里完成的实际工作很少或没有完成,并且其详细说明的质量和性能都与模拟时运行的可执行文件不同。

因此,将架构替换为:

architecture behavioral of test_raw_tb is
    --constant infile : pgm_record_type := read_pgm_file(ifile);
begin   -- architecture

 process
 variable infile : pgm_record_type;
 begin
    infile := read_pgm_file(ifile);
     wait;
 end process;

end behavioral;

作为强制文件解析延迟到运行时的一种方法;编译成功,仿真以令人满意的速度进行,直到:

ERROR: Index 640 out of bound 0 to 639. 
ERROR: In process test_raw_tb.vhd:17 

(空白固定文件不会发生此错误,因此似乎仍有解析器问题需要解决)

于 2013-11-14T13:18:18.713 回答