So I need to get sinus waveform. In cases I have wrote values of x and y axis in range of 2pi
how to get the waveform of the sinus in this range?
module sinus1(in,clk,res,out);
input clk,res;
input [7:0]in;
output reg [7:0]out;
always @(posedge clk)
if (res)
case (in)
8'b00000000: out<=8'b10000000;
8'b00000001: out<=8'b10000011;
8'b00000010: out<=8'b10000110;
8'b00000011: out<=8'b10001001;
8'b00000100: out<=8'b10001100;
8'b00000101: out<=8'b10001111;
8'b00000110: out<=8'b10010010;
...
...
...
8'b11111111: out<=8'b01111101;
endcase
else out<=8'b00000000;
endmodule
module testbench;
reg clk,res;
reg [7:0]in;
sinus1 sinusoid(in,clk,res,out);
always #5 clk=~clk
initial
begin
clk=0;res=0;
#5 res=1;
#5000 $finish;
end
endmodule
If you want get the values for each input, you should sweep the values in your testbench, perhaps from 0 to 255. Here is a link that does this on Eda Playground:
http://www.edaplayground.com/x/2bx
Output: