The Maxwell 2023-07-21 10:33 采纳率: 75%
浏览 132

quartus中导入MIF文件异常

在quartus中导入MIF文件,一直无法读取。
我的MIF文件部分内容如下:

DEPTH=256;
WIDTH=8;
ADDRESS_RADIX=UNS;
DATA_RADIX=HEX;
CONTENT BEGIN
0 : 7F;
1 : 82;
2 : 85;
3 : 88;
4 : 8B;
5 : 8E;
6 : 91;

当我在quartus中使用$readmemh时报错:Error (10852): Verilog HDL error at output.mif(1): illegal character 'p' in hexadecimal number
Error (10170): Verilog HDL syntax error at output.mif(1) near text p
当我使用$readmemb时报错:Error (10079): Verilog HDL syntax error at output.mif(1): illegal character in binary number
Error (10170): Verilog HDL syntax error at output.mif(1) near text D
我确定我的MIF文件类型没有问题,Verilog文件代码如下:

module DDS(
    input clk,
    input startPhase,
    input signed [3:0] freqPower,
    input amp,
    input waveform,
    output reg [7:0] out);
    
    reg count;
    reg time0;
    
    reg [7:0] table0 [0:255];

  initial begin
    $readmemb("output.mif", table0);
  end
  
    always@(posedge clk) begin
        if (freqPower > 0)
            count <= count + 1 << freqPower + startPhase;
        else
            time0 <= time0 + 1;
            count <= time0 >> (~freqPower + 1) + startPhase;
        case(waveform)
            1'd0 : out <= table0[count];
            //1'd1 : table1;
            //1'd2 : table2;
        endcase
    end
endmodule
  • 写回答

3条回答 默认 最新

  • 技术宅program 2023-07-21 10:49
    关注

    你的MIF文件使用的是16进制吧,$readmemh读取时,MIF文件应该是16进制格式,用$readmemb时则是二进制

    评论

报告相同问题?

问题事件

  • 创建了问题 7月21日