J
Jason Zheng
Guest
Hi,
The Verilog 2001 reference defines stdin, stdout, and stderr as
pre-opened file descriptors (0x80000001- 0x80000003). However, when I
tried to use stdin in Icarus, the stdin does not seem to be opened.
In addition, although I haven't seen it in the Verilog 2001 reference,
some examples on the web have used "$feof" to test the EOF for a file
descriptor. Icarus doesn't reject it as a syntax error, but when I
tried to use $feof on stdin, it seems to think that stdin has not
reached EOF even though $fget returns FFFFFFFF.
Here's my test code:
`timescale 1ns / 100ps
module mytb;
parameter clk_per = 10;
parameter STDIN = 32'h8000_0001;
reg CLK;
integer tmp;
initial
begin
CLK = 0;
forever
#(clk_per/2) CLK = ~CLK;
end
always @ (negedge CLK)
if (!$feof(STDIN))
begin
tmp = $fgetc(STDIN);
$display("%x",tmp);
end
else
$finish;
endmodule
Any thoughts, Steve?
The Verilog 2001 reference defines stdin, stdout, and stderr as
pre-opened file descriptors (0x80000001- 0x80000003). However, when I
tried to use stdin in Icarus, the stdin does not seem to be opened.
In addition, although I haven't seen it in the Verilog 2001 reference,
some examples on the web have used "$feof" to test the EOF for a file
descriptor. Icarus doesn't reject it as a syntax error, but when I
tried to use $feof on stdin, it seems to think that stdin has not
reached EOF even though $fget returns FFFFFFFF.
Here's my test code:
`timescale 1ns / 100ps
module mytb;
parameter clk_per = 10;
parameter STDIN = 32'h8000_0001;
reg CLK;
integer tmp;
initial
begin
CLK = 0;
forever
#(clk_per/2) CLK = ~CLK;
end
always @ (negedge CLK)
if (!$feof(STDIN))
begin
tmp = $fgetc(STDIN);
$display("%x",tmp);
end
else
$finish;
endmodule
Any thoughts, Steve?