小编dav*_*vmc的帖子

在 Verilog 中从 txt 读取和写入数组

首先我想说的是,我通过在 ModelSim 中编译的 Verilog 模型在 ADS(高级设计系统 2017)中运行仿真。

我的目标是将 .txt 文件中的数据作为输入加载到测试台中,以便运行模拟,然后将该模拟的结果保存在另一个 .txt 文件中。

以下是名为“param.txt”的输入测试 .txt 文件的内容:

1
2
3
4
5
6
7
8
9
10
Run Code Online (Sandbox Code Playgroud)

这是我的 Verilog 测试台代码:

`include "disciplines.vams"


module resistor(p,n);
electrical p,n;
parameter real R=50.0;
integer file;
integer out;
real pwm_A[0:50];
integer i;
integer j=1;


analog begin

    @(initial_step) // Initial Conditions
    begin


////////////// Read

file=$fopen("param.txt","r");

    if (file)  $display("File was opened successfully : %0d", file);
    else       $display("File was NOT opened successfully : %0d", file);

    for (i=1; i<50; i=i+1) begin …
Run Code Online (Sandbox Code Playgroud)

load verilog file save

4
推荐指数
1
解决办法
6330
查看次数

标签 统计

file ×1

load ×1

save ×1

verilog ×1