|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?注册
x
在学习《uvm实战》过程中,在questa_sim 10.2c上面跑书里面的实例,结果报错,希望有朋友可以指导一下是为什么,代码如下
- module dut(clk,
- rst_n,
- rxd,
- rx_dv,
- txd,
- tx_en);
- input clk;
- input rst_n;
- input[7:0] rxd;
- input rx_dv;
- output [7:0] txd;
- output tx_en;
- reg[7:0] txd;
- reg tx_en;
- always @(posedge clk) begin
- if(!rst_n) begin
- txd <= 8'b0;
- tx_en <= 1'b0;
- end
- else begin
- txd <= rxd;
- tx_en <= rx_dv;
- end
- end
- endmodule
复制代码
-
- `ifndef MY_DRIVER__SV
- `define MY_DRIVER__SV
- class my_driver extends uvm_driver;
- function new(string name = "my_driver", uvm_component parent = null);
- super.new(name, parent);
- endfunction
- extern virtual task main_phase(uvm_phase phase);
- endclass
- task my_driver::main_phase(uvm_phase phase);
- top_tb.rxd <= 8'b0;
- top_tb.rx_dv <= 1'b0;
- while(!top_tb.rst_n)
- @(posedge top_tb.clk);
- for(int i = 0; i < 256; i++)begin
- @(posedge top_tb.clk);
- top_tb.rxd <= $urandom_range(0, 255);
- top_tb.rx_dv <= 1'b1;
- `uvm_info("my_driver", "data is drived", UVM_LOW)
- end
- @(posedge top_tb.clk);
- top_tb.rx_dv <= 1'b0;
- endtask
- `endif
复制代码
-
- `timescale 1ns/1ps
- `include "uvm_macros.svh"
- import uvm_pkg::*;
- `include "my_driver.sv"
- module top_tb;
- reg clk;
- reg rst_n;
- reg[7:0] rxd;
- reg rx_dv;
- wire[7:0] txd;
- wire tx_en;
- dut my_dut(.clk(clk),
- .rst_n(rst_n),
- .rxd(rxd),
- .rx_dv(rx_dv),
- .txd(txd),
- .tx_en(tx_en));
- initial begin
- my_driver drv;
- drv = new("drv", null);
- drv.main_phase(null);
- $finish();
- end
- initial begin
- clk = 0;
- forever begin
- #100 clk = ~clk;
- end
- end
- initial begin
- rst_n = 1'b0;
- #1000;
- rst_n = 1'b1;
- end
- endmodule
-
复制代码
my_driver.sv出现报错,在第三行class my_driver extends uvm_driver;
报错信息如下:
1.near "uvm_driver" syntax error,unexpected IDENTIFIER
2.Error in class extension specification |
|