Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

verilog-problem write text file

Status
Not open for further replies.

jalal.baba

Junior Member level 1
Joined
Feb 5, 2018
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
118
Hi
I have three member out_x ,out_y,out_z and I want to write them in text file as shown below:
Code:
out_x[0]    out_y[0]       out_z[0]
out_x[1]    out_y[1]       out_z[1]
out_x[2]    out_y[2]       out_z[2]
.                  .                   .
.                  .                   .
.                  .                   .
.                  .                   .
out_x[n]     out_y[n]       out_z[n]
I wrote code:
Code:
`define Lenght_v 22
integer file,stat,i,j,m,n,k,out;
integer file_v,stat_v;
real out_x[0:`Lenght_v-1];
real out_y[0:`Lenght_v-1];
real out_z[0:`Lenght_v-1];
output reg clk;
always@(posedge clk)
	begin 
		out=$fopen("out.txt","w");
		for(k=0;k<`Lenght_v;k=k+1)
			begin
				$fwrite (out,"a=%f\n b=%f\n c=%f\n",out_x[k],out_y[k],out_z[k]); 
				
			end 
			$fflush(out);
	end

and my result is:
Code:
out_x[0]
out_y[0]
out_z[0]
out_x[1]
out_y[1]
out_z[1]
.
.
.
How can I achieve the desired results?
thanks
 
Last edited by a moderator:

Code:
$fwrite (out,"a=%f     b=%f     c=%f\n",out_x[k],out_y[k],out_z[k]);
 
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top