How to update a row and a column at the same clock cycle?

Hi

I have a simple 4x4 array defined as follows:

type rib is array (0 to 3) of std_logic_vector(3 downto 0); signal RanIB : rib;

In my combinational logic stage I evaluate a new column that I wanna store in my 4x4 array at the next clock cycle. However, the problem is that at the next clock cycle I also wanna update one row of the same array and set to ZERO all the values in a specific row. The problem is that also the row index of the newly added column should be set to ZERO at the same clock... Cleary I will get an undefined value for one element in my array when I try to write from two sources at the same time. Is there an elegant way to implement this stuff?

For clarification a little example ;)

My array looks as follows:

1 1 1 0 1 1 0 1 1 1 1 0 1 1 1 1

At the next clock cycle I wanna update column 2 for instance

1 1 1 0 1 1 0 1 1 0 0 0
Reply to
R. Hofman
Loading thread data ...

R. Hofman a écrit :

Hello Your array will be managed by a single process. So you don't have to worry about any conflict. Just define what you want to happen in cell (2, 0)

Nicolas

Reply to
Nicolas Matringe

0)

Nicolas is right. You are thinking that somehow when you make two assignments to the same signal or variable that it will cause a conflict. That is not correct. If you have a conflict, it is because you have improperly constructed code, not because of what you are trying to do with the code.

First, you need to decide what you want the design to do in the case of updating both a row and a column. Then you construct the code to do that. Remember that you are not writing software, you are describing hardware. The code does not know that you are writing to a row or a column. It only knows that you are making assignments to a signal or a variable.

If you are having trouble figuring out how to construct your code, make a stab at it and we will be happy to correct mistakes and give suggestions on how you can do it better. But it is not much fun for us to write the code for you. So give it a try and show us what you come up with.

BTW, what you are calling a row is a column and your column is a row. Rows run left-right and columns up-down.

Rick

Reply to
rickman

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.