Forum Discussion
Altera_Forum
Honored Contributor
16 years agoGenerating a Sine Wave
Hello Friends, I am a newbie.. hope you dont mind if my query is odd.. i wanted to the know like how can we generate a SINE WAVE.. by writing a verilog or vhdl code. i browsed throug...
Altera_Forum
Honored Contributor
16 years agoThank you Ketan :) and Tricky :) for your valuable and prompt response, i would look into the info as what you have given me but if i dont get any clarity then can you help me furthur probably with any code..and before that can you clarify my furthur doubts please
1) how can we read the values stored in text as DECIMALS into FPGA..i know how to read hex values from text using reg [31:0] Mem [0:3599]; initial $readmemh("sine.txt",Mem); ==>> this reads values stored in sine.txt as only hex how can i read them in decimal format directly 2) i have pasted the sine.txt which i generated using excel sheet.. i have taken some 3600 samples of sine wave i.e, 2*pi/3600 and for each of that value i have taken sine values and stored here and i thought, i can read these sine values in to fpga and display out the values, only (3) is stored as sine.txt (1) (2) (3) S.No 2*Pi/3600 Sin((2*Pi/3600)*S.No) 1 0.001745329 0.001745328 2 0.003490659 0.003490651 3 0.005235988 0.005235964 4 0.006981317 0.00698126 5 0.008726646 0.008726535 6 0.010471976 0.010471784 7 0.012217305 0.012217001 8 0.013962634 0.01396218 9 0.015707963 0.015707317 10 0.017453293 0.017452406 11 0.019198622 0.019197442 12 0.020943951 0.02094242 13 0.02268928 0.022687334 14 0.02443461 0.024432178 15 0.026179939 0.026176948 16 0.027925268 0.027921639 17 0.029670597 0.029666244 18 0.031415927 0.031410759 19 0.033161256 0.033155178 20 0.034906585 0.034899497 21 0.036651914 0.036643709 22 0.038397244 0.038387809 . . . . . . . . . extended to 3600 samples as i told you i cant read this fractional values into fpga. i guess i am wrong here but could please tell me how to read these(ex: 0.001745328) type of values into fpga which command is useful i hope i will get a reply soon :)