module pwn_single_clk(clk,s1,s2,out1,out2,out3,out4

)
input clk,s1,s2;
output reg [3:0] out1,out2,out3,out4l
reg [25:0] count1,count2,count3,count4;
intial
begin
out1<=0;
out2<=0;
out3<=0;
out4<=0;
count1<=0;
count2<=0;
count3<=0;
count4<=0;
end
always @(posedge clk)
count1=count1+1;
count2=count2+1;
count3=count3+1;
count4=count4+1;
if ({s1 s2}==2b'00)
begin
//// 50 % ////
if ( count1<=25_000_000)
begin
out1=~out1;
count1=0;
end
end

if ({s1 s2}==2b'01)
begin
////20 % ////
if ( count2<=10_000_000)
out2=1;
else if ( count2<=50_000_000)
out=0;
count2=0;
end

else if ( count4<=50_000_000) out4=0. count3=0. end . else if ( count3<=50_000_000) out3=0. end if ({s1 s2}==2b'11) begin ///// 80% if ( count4<=40_000_000) out4=1.if ({s1 s2}==2b'10) begin ///// 40 % if ( count3<=20_000_000) out3=1. count4=0.

Sign up to vote on this title
UsefulNot useful