K
Kenneth Brun Nielsen
Guest
I'm developing a testbench in order to create real-life test vectors.
The testbench is reading commands from a command file and interprets
them to perform a given desired behaviour.
E.g. I want to implement a command "VERIFY [SIGNALNAME]" that enables
any output to be compared with its expected value (as a default
outputs are "don't care" )
The testbench reads the command file in a while loop. Here is a
summary:
reg [100*8-1:0] textline;
fd = $fopen("test1.cmd","r");
while (!$feof(fd))
begin
r = $fgets(textline,fd);
if ($sscanf(textline," %1b %1b %1b %1b\n",SS,MOSI,SCK,MISOcmp,INTcmp)
#10
end
else if ($sscanf(textline,"* %s \n",comment) > 0)
$display("Comment read: %s", comment);
else if ($sscanf(textline,"VERIFY %s \n",signalName) > 0)
begin
// In the section I would like to assign a signal
// with a name equal to the signalName string
end
end
Is this possible?
Best regards,
Kenneth
The testbench is reading commands from a command file and interprets
them to perform a given desired behaviour.
E.g. I want to implement a command "VERIFY [SIGNALNAME]" that enables
any output to be compared with its expected value (as a default
outputs are "don't care" )
The testbench reads the command file in a while loop. Here is a
summary:
reg [100*8-1:0] textline;
fd = $fopen("test1.cmd","r");
while (!$feof(fd))
begin
r = $fgets(textline,fd);
if ($sscanf(textline," %1b %1b %1b %1b\n",SS,MOSI,SCK,MISOcmp,INTcmp)
$display("Stimuli data read succesfully");0)
begin
#10
end
else if ($sscanf(textline,"* %s \n",comment) > 0)
$display("Comment read: %s", comment);
else if ($sscanf(textline,"VERIFY %s \n",signalName) > 0)
begin
// In the section I would like to assign a signal
// with a name equal to the signalName string
end
end
Is this possible?
Best regards,
Kenneth