Verbesserte TB
#100000000 muss öfter aufgerufen werden, sonst zahl zu groß tb ist noch nicht einmal komplett durchgelaufen
This commit is contained in:
parent
15b48049ab
commit
c7c804a5f9
@ -46,7 +46,7 @@ endclass
|
|||||||
|
|
||||||
|
|
||||||
`timescale 1ns/1ps
|
`timescale 1ns/1ps
|
||||||
module testbench_toplevel_rnd;
|
module tb;
|
||||||
|
|
||||||
// inputs and outputs
|
// inputs and outputs
|
||||||
reg taster;
|
reg taster;
|
||||||
@ -55,17 +55,24 @@ reg clk12M;
|
|||||||
wire RED;
|
wire RED;
|
||||||
wire GRN;
|
wire GRN;
|
||||||
wire alarm;
|
wire alarm;
|
||||||
|
wire alarm_r;
|
||||||
wire SI;
|
wire SI;
|
||||||
wire SO;
|
wire SO;
|
||||||
wire SCK;
|
wire SCK;
|
||||||
wire nCS;
|
wire nCS;
|
||||||
|
reg endOfConvRnd;
|
||||||
|
|
||||||
//random
|
//random
|
||||||
Taster_rnd taster_rnd = new();
|
Taster_rnd taster_rnd = new();
|
||||||
Data_ADC_rnd data_ADC_rnd = new();
|
Data_ADC_rnd data_ADC_rnd = new();
|
||||||
|
|
||||||
// connect module
|
// connect module
|
||||||
SPI_FRAM_Module fram_storage(.SI(SI),.SO(SO),.SCK(SCK),.nCS(nCS).opcode().addr(),.mem_data(),.stat_reg,.hibernate());
|
SPI_FRAM_Module fram_storage(
|
||||||
|
.SI(SI),
|
||||||
|
.SO(SO),
|
||||||
|
.SCK(SCK),
|
||||||
|
.nCS(nCS),.opcode(),.addr());
|
||||||
|
Top top(.clk(clk12M),.rst(taster),.endOfConv(endOfConvRnd),.LEDg(GRN),.LEDr(RED),.AlarmAmpel(alarm),.Alarm_R(alarm_r));
|
||||||
|
|
||||||
initial
|
initial
|
||||||
begin
|
begin
|
||||||
@ -76,27 +83,41 @@ always
|
|||||||
|
|
||||||
//random test
|
//random test
|
||||||
initial begin
|
initial begin
|
||||||
repeat (50) begin
|
endOfConvRnd = 1;
|
||||||
#50000
|
repeat (2) begin
|
||||||
|
#100000000
|
||||||
Data_ADC_rnd.randomize();
|
#100000000
|
||||||
Taster_rnd.randomize();
|
#100000000
|
||||||
|
#100000000
|
||||||
|
#100000000
|
||||||
|
#100000000
|
||||||
|
#100000000
|
||||||
|
#100000000
|
||||||
|
#100000000
|
||||||
|
#100000000
|
||||||
|
data_ADC_rnd.randomize();
|
||||||
|
taster_rnd.randomize();
|
||||||
|
|
||||||
taster = taster_rnd.data;
|
taster = taster_rnd.data;
|
||||||
data_ADC = data_ADC_rnd.data;
|
data_ADC = data_ADC_rnd.data;
|
||||||
|
|
||||||
|
|
||||||
// assertions
|
// assertions
|
||||||
|
|
||||||
// assert color green
|
// assert color green
|
||||||
assert property(@(posedge clk12M) disable iff (alarm) ((data_ADC < 100) |=> ##4 (!RED && GRN));
|
assert property(@(posedge clk12M) disable iff (alarm | alarm_r) ((data_ADC < 100) |=> ##4 (!RED && GRN)));
|
||||||
|
|
||||||
//assert color yellow
|
//assert color yellow
|
||||||
|
|
||||||
assert property(@(posedge clk12M) disable iff (alarm) ((data_ADC >= 100) && (data_ADC <= 168))|=> ##4 (RED && GRN));
|
assert property(@(posedge clk12M) disable iff (alarm | alarm_r) (((data_ADC >= 100) && (data_ADC <= 168))|=> ##4 (RED && GRN)));
|
||||||
|
|
||||||
//assert color red + alarm
|
//assert color red + alarm
|
||||||
|
|
||||||
assert property(@(posedge clk12M) (data_ADC > 168) |=> ##4 (RED && !GRN && alarm));
|
assert property(@(posedge clk12M) disable iff (alarm_r) (data_ADC > 168) |=> ##4 (RED && !GRN && alarm));
|
||||||
|
|
||||||
|
//assert alarm reset working
|
||||||
|
|
||||||
|
assert property(@(posedge clk12M) (alarm_r |=> ##4 (!RED && !GRN && !alarm)));
|
||||||
|
|
||||||
$monitor("time=%t, data_ADC=%d, RED=%d, GRN=%d, taster=%d",$time,data_ADC, RED, GRN, taster);
|
$monitor("time=%t, data_ADC=%d, RED=%d, GRN=%d, taster=%d",$time,data_ADC, RED, GRN, taster);
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user