首页 | 新闻 | 新品 | 文库 | 方案 | 视频 | 下载 | 商城 | 开发板 | 数据中心 | 座谈新版 | 培训 | 工具 | 博客 | 论坛 | 百科 | GEC | 活动 | 主题月 | 电子展
返回列表 回复 发帖

如何应用测试平台?[原创]

16.task
//Define a module called operation which contains the task bitwise_oper
module operation;
parameter delay = 10;
reg [15:0] A, B;
reg [15:0] AB_AND, AB_OR, AB_XOR;

initial
$monitor( "%0d AB_AND = %b, AB_OR = %b, AB_XOR = %b, A = %b, B = %b",
$time, AB_AND, AB_OR, AB_XOR, A, B);

initial
begin
#1 A = 16'b1111_0000_1010_0111;
B = 16'b1010_0101_1000_1100;
end

always @(A or B) //whenever A or B changes in value
begin
//invoke the task bitwise_oper. provide 2 input arguments A, B
//Expect 3 output arguments AB_AND, AB_OR, AB_XOR
//The arguments must be specified in the same order as they
//appear in the task declaration.
bitwise_oper(AB_AND, AB_OR, AB_XOR, A, B);
end


//define task bitwise_oper
task bitwise_oper;
output [15:0] ab_and, ab_or, ab_xor; //outputs from the task
input [15:0] a, b; //inputs to the task
begin
#delay ab_and = a & b;
ab_or = a | b;
ab_xor = a ^ b;
end
endtask
endmodule
17.while
module count;

//Illustration 1: Increment count from 0 to 127.
//Exit at count 128. Display the count variable.
integer count;

initial
begin
count = 0;

while (count < 128) //Execute loop till count is 127.
//exit at count 128
begin
$display("Count = %d", count);
count = count + 1;
end
end

endmodule

如何应用测试平台?[原创]

在哪里能找到VHDL TEST BENCH 方面的语法和详细示例?
这是我能找到资料。不知道对您有没有用处。呵呵呵呵。。。。
返回列表