Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

How do I write a verilog code to store different values at different times?

Status
Not open for further replies.

keerthna

Member level 1
Joined
Sep 16, 2014
Messages
33
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
251
I am trying to design a counter whose value might vary based on the frequency of the reference clock. So if I want to observe the count value for 5 cycles of time, how do I save those values?

for example if I have something like


Code dot - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
always@(posedge clk)
    begin
    count=count+1;
    if(count==some value)
    begin
    count=0;
    high=1;
    end
  if(high==1)
 begin
newcount1<=count2; // Count2 is another counter which detects the edges in a signal and                       increments. 
end
end



Now my problem is I want to observe the value of newcount1,newcount2newcount3,newcount4,newcount5 etc., so how do I store the values like this usine VERILOG?
 
Last edited by a moderator:

hi

Now my problem is I want to observe the value of newcount1,newcount2newcount3,newcount4,newcount5 etc., so how do I store the values like this usine VERILOG?
i think you can store those values to a register.
declare a 2D array like [0:7]mem[0:8]

then

mem <= newcount1;
i<= i+1;

and i didnt know what you asked here
I am trying to design a counter whose value might vary based on the frequency of the reference clock

hope this helps

thanks & regards
 

But my "newcount1" is a 32 bit register. So the value of this 32 bit register isn't going to the mem variable. Am i missing out something? please help. thanks in advance
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top