module KeySummer_TB;
reg iG$MasterClock;
reg iG$MasterReset;
reg [3:0] iD$KeyValue;
reg iC$AddKey;
reg iC$ClearSum;
wire [5:0] oD$KeySum;
wire [2:0] oD$KeysPressed;
wire oS$SumIsCorrect;
wire oS$KeyPressingIsFinished;
parameter MaxChars = 24;
reg [8*MaxChars-1 : 0] Comment;
KeySummer DUT (
.iG$MasterClock (iG$MasterClock),
.iG$MasterReset (iG$MasterReset),
.iD$KeyValue (iD$KeyValue),
.iC$AddKey (iC$AddKey),
.iC$ClearSum (iC$ClearSum),
.oD$KeySum (oD$KeySum),
.oD$KeysPressed (oD$KeysPressed),
.oS$SumIsCorrect (oS$SumIsCorrect),
.oS$KeyPressingIsFinished (oS$KeyPressingIsFinished)
);
initial begin
Comment = "Reset";
iG$MasterClock = 0;
iG$MasterReset = 1;
iD$KeyValue = 0;
iC$AddKey = 0;
iC$ClearSum = 0;
// Take out of reset
#10 iG$MasterReset = 0;
// Apply a valid sequence
Comment = "First Valid Sequence";
Sequence(7,7,7,7,7,7);
// Clear the sum, and apply another valid sequence
Comment = "Second Valid Sequence";
iC$ClearSum = 1;
#10 iC$ClearSum = 0;
Sequence(9,4,6,8,7,8);
// Clear the sum, and apply an invalid sequence
Comment = "Invalid Sequence";
iC$ClearSum = 1;
#10 iC$ClearSum = 0;
Sequence(0,1,2,3,4,5);
#10 $finish;
end
always #5 iG$MasterClock = ~iG$MasterClock;
task Sequence;
input [3:0] A,B,C,D,E,F;
begin
iD$KeyValue = A;
#10 iC$AddKey = 1;
#10 iC$AddKey = 0;
iD$KeyValue = B;
#10 iC$AddKey = 1;
#10 iC$AddKey = 0;
iD$KeyValue = C;
#10 iC$AddKey = 1;
#10 iC$AddKey = 0;
iD$KeyValue = D;
#10 iC$AddKey = 1;
#10 iC$AddKey = 0;
iD$KeyValue = E;
#10 iC$AddKey = 1;
#10 iC$AddKey = 0;
iD$KeyValue = F;
#10 iC$AddKey = 1;
#10 iC$AddKey = 0;
end
endtask
endmodule
This page: |
Created: | Thu Jan 16 14:38:01 2003 |
|
From: |
keysummer_TB.v |