I have problems with refer to specific matrix cells. I wanna to do state machine where I could do some action like comparision by xor as you can see below. I try check every outputs(x,x) and each show 0.
signal bit_index : integer range 9 to 0 := 9;
signal matrix_value0 : integer := 0;
signal matrix_value1 : integer := 0;
signal binary_value0 : std_logic_vector(1 downto 0) := "00";
signal binary_value1 : std_logic_vector(1 downto 0) := "00";
signal xor_result_0 : std_logic_vector(1 downto 0) := "00";
signal xor_result_1 : std_logic_vector(1 downto 0) := "00";
signal message :std_logic_vector(9 downto 0) := "0110101010";
signal outputs : t_matrix := ( -- before was constant
(0, 3, 2, 1),
(1, 2, 3, 0));
type t_binary is array (0 to 3) of std_logic_vector(1 downto 0);
constant binary_values : t_binary := (
"00", -- 0
"01", -- 1
"10", -- 2
"11" -- 3
);
[...]
for bit_index in 9 to 0 loop
case state is
when D0 =>
if put = '1' then
matrix_value0 <= outputs(0,0);
binary_value0 <= binary_values(matrix_value0);
xor_result_0 <= binary_value0 xor message(bit_index downto bit_index - 1);
else
matrix_value0 <= outputs(1,0);
binary_value0 <= binary_values(matrix_value0);
xor_result_0 <= binary_value0 xor message(bit_index downto bit_index - 1);
[...]
I checked others question on stackoverflow like this -> VHDL: assign new value to the specific element of 2D Array, but it just help me how I should write matrix.
I will be really glad if will tell me what I should do to fix matrix_value_0 and matrix_value_1, maybe I’m writing the data wrong.
Dominika is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1