how to write output in file (in veriliog)

Status
Not open for further replies.

vinodh475

Newbie level 5
Joined
Sep 24, 2012
Messages
9
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,349
i am writing one verilog code
my number is 128 bit number and it will generate different number in every clock cycle
so i need to write each and every number in a file
can u please help me how can i do that?
 

can u please help me how can i do that?
Since I also don't know how to perform a google search using the terms verilog file output I can't help you.
 

Hi Vinod,
First open file using $fopen task in an initial block.
Then you can use $fdisplay task. Let's assume your number changes on rising edge of the clock, then I would read its value on falling edge
always @(negedge clk)
$fdisplay(fid1,"%d", theNumber);
Before ending simulation you'll need to close the file ID.

Start doing, debugging errors you will learn better, then using ready code.

Good luck!
 

    V

    Points: 2
    Helpful Answer Positive Rating
Go ogle a google? I am confused now.

Other than my increased level of confusion, seriously, try using google sometimes. This one is no worse than some other complacent posts on this forum, but sometimes ... Just for the fun of it I just did a cut & paste of "how to write output in file (in veriliog)" into google, and even that turns up pretty relevant answers.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…