J
JT
Guest
During the simulation I want to query the user for interactive
test parameters. I really don't want to have to go through the PLI
and I was hoping that the new file IO features of verilog 2001 would
do the job. I'm using a Modelsim PE simulator and I tried the following
code snippet however it didn't work as expected.
The call to getc (also tried getchar()) always returns 0x00 so something is
wrong here.
Anyone have any thoughts on doing console IO during a simulation run?
integer i_char;
reg done;
initial
begin
..
..
..
$display ("Module %m: At %d: Enter a character", $time);
done = 0;
while (!done)
begin
i_char = $getc();
if (i_char != 8'h00)
done = 1;
end
$display ("Module %m: At %d: The character was: %h", $time, i_char);
test parameters. I really don't want to have to go through the PLI
and I was hoping that the new file IO features of verilog 2001 would
do the job. I'm using a Modelsim PE simulator and I tried the following
code snippet however it didn't work as expected.
The call to getc (also tried getchar()) always returns 0x00 so something is
wrong here.
Anyone have any thoughts on doing console IO during a simulation run?
integer i_char;
reg done;
initial
begin
..
..
..
$display ("Module %m: At %d: Enter a character", $time);
done = 0;
while (!done)
begin
i_char = $getc();
if (i_char != 8'h00)
done = 1;
end
$display ("Module %m: At %d: The character was: %h", $time, i_char);