Skip to content

Commit

Permalink
stall input in xml tests
Browse files Browse the repository at this point in the history
  • Loading branch information
shuckc committed Jun 26, 2012
1 parent 9d07fe7 commit 6569455
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 35 deletions.
60 changes: 27 additions & 33 deletions xml/XMLdecoder_test.v
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module XMLdecoder_test;
// Outputs
wire [7:0] out;
wire outValid;
wire outEop;
wire isData;
wire isTag;
wire isTagName;
Expand All @@ -44,11 +45,11 @@ module XMLdecoder_test;
.CLOCK(CLOCK),
.in(stream),
.inValid(svalid),
.reset(reset),
.inEop(eop),

.out(out),
.outValid(outValid),
.outEop(outEop),
.isData(isData),
.isTag(isTag),
.isComment(isComment),
Expand All @@ -71,9 +72,9 @@ module XMLdecoder_test;
always #5 CLOCK = ~CLOCK;
integer file;
integer r;
integer i;
integer i, x;
integer overrun;
reg [7:0] outNoNL;
reg [7:0] outNoNL, inNoNL;

initial begin

Expand All @@ -95,52 +96,45 @@ module XMLdecoder_test;

$display("Reading XML");
$display(" ! comment, d data, t tag, n tagname, k tagkey, v tagvalue");
$display(" i in | out dp + - ! d t n k v stack 0 1 2 3 4 5 6 7");
$display(" i e v in | v e out dp + - ! d t n k v stack 0 1 2 3 4 5 6 7");

// Wait 100 ns for global reset to finish
#100;
eop <= $feof(file) != 0;

// stimulus
while (~eop || outValid) begin
while (overrun > 0) begin
@(posedge CLOCK)
stream <= $fgetc(file);
svalid <= $feof(file) == 0;
eop <= $feof(file) != 0;
x = $fgetc(file);
stream <= x;
svalid <= $feof(file) == 0 && x != "#";
eop <= $feof(file) != 0 && overrun == 10;
i <= i+1;
if ( !svalid ) begin
if ( $feof(file) != 0 ) begin
overrun <= overrun - 1;
end
outNoNL = (out == 10) ? "." : out;
$display(" %4d %b %x | %b %x %s %02d %b %b %b %b %b %b %b %b %1d %1d %1d %1d %1d %1d %1d %1d ",
i, svalid, stream,
outValid, out, outNoNL, tagDepth, depthPush, depthPop, isComment, isData, isTag, isTagName, isTagKey, isTagValue,
inNoNL = (stream == 10) ? "." : stream;
$display(" %4d %b %b %x %s | %b %b %x %s %02d %b %b %b %b %b %b %b %b %1d %1d %1d %1d %1d %1d %1d %1d ",
i, eop, svalid, stream, inNoNL,
outValid, outEop, out, outNoNL, tagDepth, depthPush, depthPop, isComment, isData, isTag, isTagName, isTagKey, isTagValue,
s0, s1, s2, s3, s4, s5, s6, s7);

end
if (overrun == 5) begin
// just after EOP
if (s0 != 1) begin
$display("should be exactly one root element");
$finish_and_return(1);
end
if (tagDepth != 0) begin
$display("depth did not finish flat");
$finish_and_return(1);
end
end

// post-test checks
if (tagDepth != 0) begin
$display("depth did not finish flat");
$finish_and_return(1);
end
if (s0 != 1) begin
$display("should be exactly one root element");
$finish_and_return(1);
end

@(posedge CLOCK)
$display(" %4d %b %x | %b %x %s %02d %b %b %b %b %b %b %b %b %1d %1d %1d %1d %1d %1d %1d %1d ",
i, svalid, stream,
outValid, out, outNoNL, tagDepth, depthPush, depthPop, isComment, isData, isTag, isTagName, isTagKey, isTagValue,
s0, s1, s2, s3, s4, s5, s6, s7);

@(posedge CLOCK)
$display(" %4d %b %x | %b %x %s %02d %b %b %b %b %b %b %b %b %1d %1d %1d %1d %1d %1d %1d %1d ",
i, svalid, stream,
outValid, out, outNoNL, tagDepth, depthPush, depthPop, isComment, isData, isTag, isTagName, isTagKey, isTagValue,
s0, s1, s2, s3, s4, s5, s6, s7);

// post-test checks
if (tagDepth != 0) begin
$display("depth did not reset");
$finish_and_return(1);
Expand Down
4 changes: 2 additions & 2 deletions xml/xmltest.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- by chris -->
<!-- by ########chris -->
<note important="false">
<to>Tove</to>
<from>Jani &amp; Chris</from>
<from>Jani &amp; Chris</from########>
<heading>Reminder<!-- </to> -->x</heading>
<body>Don't forget me this weekend!</body>
<deleted/>
Expand Down

0 comments on commit 6569455

Please sign in to comment.