keerthna
Member level 1
How do I measure the power of a signal i.e., the instantaneous power and also the voltage and current at any given instant of time? I have to do this in Verilog. Is there any piece of code that I can write?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 module scopemeasure(signalin,clk,q,rst,edgedet); input clk; input signalin; input rst; reg [24:0]count1; reg [24:0]count2; output edgedet; reg edgedet; output [3:0]q; reg[3:0]q; reg signald; reg tempedge; reg flag; reg high; initial begin count1=0; count2=0; flag=0; end always@(posedge clk) begin if(rst==1) begin signald<=1'b0; count1=0; tempedge<=signalin&(~signald); end else begin count1=count1+1; high=0; signald<=signalin; tempedge<=signalin&(~signald); end if((count1>=25'b1111101111000101001000000)&&(count1<=25'b1111101111000101100001000)) begin count1=0; high=1; flag=0; end if(tempedge==1) begin count2=count2+1; edgedet<=tempedge; end if(high==1) begin q[0]=count2[0]; q[1]=count2[1]; q[2]=count2[2]; q[3]=count2[3]; count2=0; end end endmodule