We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

## General Technical Discussion

Showing results for
Do you mean
Highlighted
Participant
Posts: 61
Registered: ‎08-15-2016

I have the following Simple Dual Port RAM:

Port A (write only) and Port B - (read only):: Width - 33 Depth - 6500 Address Width - 13

*Max address of the ra is 6500 not 8192 (2^13).

I have to calculate the following:

``````rd_ptr <= (last_ptr - offset_size);
``````

last ptr is the address of last value of some serial of numbers ,and offset size is the size between the last_ptr to the first address I want to start read from.

The problem occur when the reult is negative. How can I calculate this rep round in one cycle?

Participant
Posts: 61
Registered: ‎08-15-2016

## Re: Manage addresses in bram, and get the correct read pointer:

After edit...

I have the following Simple Dual Port RAM:

Port A (write only) and Port B - (read only):: Width - 33 Depth - 6500 Address Width - 13

*Max address of the ra is 6499 not 8192 (2^13 - 1).

I have to calculate the following:

``````rd_ptr <= (last_ptr - offset_size);
``````

where:

``````  offset_size       : in  unsigned (12 downto 0);
signal rd_ptr        : unsigned (12 downto 0);
signal last_ptr      : unsigned (12 downto 0);
``````

last ptr is the address of last value of some serial of numbers ,and offset size is the size between the last_ptr to the first address I want to start read from.

The problem occur when the reult is negative. How can I calculate this in one cycle?

For example: last ptr = 0; offset = 5 The result for

``````rd_ptr <= (last_ptr - offset_size);
``````

will be 8187, but it should be 1691.