Overflow pointer cell

Status
Not open for further replies.

nsgil85

Member level 4
Joined
Dec 11, 2012
Messages
73
Helped
1
Reputation
2
Reaction score
1
Trophy points
1,288
Activity points
1,833
Hey all,
Need a little help,

There is one process that writes to 200 cells in cycles, when there is EN, the writing process stops, and begins the reading process from the current cell that reached the counter of writing less X addresses (input vector).
For example:
total_cells = 200
write_cnt = 5
cell_back = 30 (input vector)
read_cnt = 5-30 = -25
Which is cell number 199-25 = 174
The question is how to implement the read_cnt line when there is an overflow without extra clk.


Thanks
 

Very messy question. I don't see the problem, the logic that computes read_cnt can be fully combinational and has no clk dependency.
 

Without any optimizations.
Code:
assign  read_cnt = (write_cnt < cell_back) ? 200-(cell_back-write_cnt) : write_cnt - cell_back);

I think your math is wrong...
e.g.
if you are at write_cnt = 0 and have a cell_back of 1 you want cell 199, right?
Your math gives
read_cnt =0-1 =-1
199-1=198 which is wrong (unless your cell_back meaning is 0 based, where 0 really means back by 1)

you should be subtracting from 200 like I'm showing in the above code.
 
Hi,

My count is from 0 to 199 = 200 cells
cell_back is from 0-19 (0 = go back by one)
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…