```
b. Create a new `cl_mem buffer` for the DDS output data.
```
cl::Buffer buffer_waveout(context, CL_MEM_WRITE_ONLY, 1024*sizeof(int));
```
c. Bond the buffer with the kernel.
```
krnl_vector_add.setArg(narg++,buffer_waveout);
```
d. Map the host buffer with the device buffer.
```
int *ptr_waveout = (int *) q.enqueueMapBuffer (buffer_waveout , CL_TRUE , CL_MAP_READ , 0, 1024*sizeof(int));
```
e. Read the data from the DDR.
```
q.enqueueMigrateMemObjects({buffer_waveout},CL_MIGRATE_MEM_OBJECT_HOST);
```
f. Save the data into a file. The data is left shifted by 17 bits because the DDS compiler IP output is 16-bit signed data and the host buffer 32-bit integer data. This is to remove the extra signed bits and keep the actual payload data.
```
FILE *fp_dout;
fp_dout=fopen("wave_out.txt","w");
for (int i = 0; i < 1024; i++) {
fprintf(fp_dout,"%d\n",ptr_waveout[i]<<17);
}
fclose(fp_dout);
```
g. Unmap the buffer.
```
q.enqueueUnmapMemObject(buffer_waveout , ptr_waveout);
```
> Note: For the complete modification code reference on the `vadd` host application, see [host code modifications](./golden/host_modifications.md).
7. Now run emulation on the modified `vadd` application. Follow the instructions in [Versal platform creation tutorial-Step4 Emulation](../../Introduction/03_Edge_VCK190/step4.md#optional-test-the-application-on-hardware-emulation).
8. After 'Test Passed' appears in the console window, copy over the generated `wave_out.txt` file from the QEMU target. First, launch the XSCT console window from `Xilinx` menu if you have not already done so.
Connect to the `tcf` target using the following command:
```
connect -host 127.0.0.1 -port 1440
```
Copy the `wave_out.txt` file from the `tcf` target to the host machine using the following command:
```
tfile copy -to-host /mnt/sd-mmcblk0p1/wave_out.txt $(YOUR_DIR)/wave_out.txt
```
The wave_out.txt file will be copied over to $(YOUR_DIR). Choose a tool to plot the data. A possible option is MATLAB®. If you do not have MATLAB installed, other third-party tools, such as Excel, also provide a similar feature. Use your preferred method to print out a sine wave.
![missing image](images/sinewave.png)
#### Support
GitHub issues will be used for tracking requests and bugs. For questions go to [forums.xilinx.com](https://support.xilinx.com).
#### License
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at [http://www.apache.org/licenses/LICENSE-2.0]( http://www.apache.org/licenses/LICENSE-2.0 )
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
XD019 | © Copyright 2021 Xilinx, Inc.