keerthna
Member level 1
- Joined
- Sep 16, 2014
- Messages
- 33
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 251
Code dot - [expand] 1 2 3 4 5 6 7 8 reg[31:0] mem[0:5]; if(high==1) begin newcount1<=count2; mem[i]<=newcount1; i<=i+1; count2=0; end
But if I try like that no values are getting accumulated in sum. And it is always in the unknown state.
I initialized them to zero.
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 module jitterclk(signalin,clk,rst,edgedet,newcount1); input clk; output [31:0]newcount1; input signalin; input rst; integer i; reg [31:0]count1; reg [31:0]count2; output edgedet; reg edgedet; reg signald; wire signalin; reg tempedge; reg [31:0]newcount1; reg [31:0] mem[0:9]; reg [64:0]sum; reg [32:0]avg; reg high; initial begin count1=0; count2=0; i=0; end always@(posedge clk) begin if(rst==1) begin signald<=1'b0; count1=0; count2=0; tempedge<=1'b0; end else begin count1=count1+1; high=0; signald<=signalin; tempedge<=signalin&(~signald); end if(count1==20'b11110100001001000000) begin count1=0; high=1; end if(tempedge==1) begin count2=count2+1; edgedet<=tempedge; end if(high==1) begin newcount1<=count2; mem[i]<=newcount1; //i<=i+1; count2=0; for(i=0;i<5;i=i+1) begin sum=sum+newcount1[i]; end end endmodule
I am so sorry, I couldn't understand how to add the verilog tags to the code.
Code Verilog - [expand] 1 2 3 4 5 6 7 8 9 10 11 always @(posedge clk) begin if (rst==1) begin signald<=1'b0; // non-blocking count1=0; // blocking count2=0; // blocking tempedge<=1'b0; // non-blocking end else begin // etc
Code Verilog - [expand] 1 2 if(count1==20'b11110100001001000000) begin count1=0;
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?