Add Bound checks in Decoder stage
This commit is contained in:
parent
98e50e89a9
commit
84220120e5
@ -107,8 +107,10 @@ NAME DIRECTION CONNECTED
|
|||||||
* GET_<NAME>_LENGTH
|
* GET_<NAME>_LENGTH
|
||||||
The first decode_stage is similar to a 4-byte primitive decode stage and latches the length of the
|
The first decode_stage is similar to a 4-byte primitive decode stage and latches the length of the
|
||||||
sequence into the <NAME>_len_latch. If the length is equal zero, the decode_stage of the next
|
sequence into the <NAME>_len_latch. If the length is equal zero, the decode_stage of the next
|
||||||
declared member is taken, instead of the GET_<NAME>. A special <NAME>_cnt counter (used to
|
declared member is taken, instead of the GET_<NAME>. If on the other hand, the length if greater
|
||||||
index the type specific memory) is initialized to 0.
|
than the MAX sequence length specified in the type package, the length is set to the value of the
|
||||||
|
type package. A special <NAME>_cnt counter (used to index the type specific memory) is initialized to 0.
|
||||||
|
NOTE: It could be configured, that instead of truncating larger sequences, a decode error is triggered.
|
||||||
* GET_<NAME>
|
* GET_<NAME>
|
||||||
This stage is similar to the respective primitive decode_stage with following valiations:
|
This stage is similar to the respective primitive decode_stage with following valiations:
|
||||||
The <NAME>_cnt is used to set the current <NAME>_mem_addr. On sucessful latch
|
The <NAME>_cnt is used to set the current <NAME>_mem_addr. On sucessful latch
|
||||||
@ -118,11 +120,11 @@ NAME DIRECTION CONNECTED
|
|||||||
|
|
||||||
ARRAY
|
ARRAY
|
||||||
-----
|
-----
|
||||||
Array is similar to the sequence, but has no length encoding (since it always has the smae size).
|
Array is similar to the sequence, but has no length encoding (since it always has the same size).
|
||||||
That means that there is no <NAME>_len port signal, <NAME>_len_latch latch, and also no
|
That means that there is no <NAME>_len port signal, <NAME>_len_latch latch, and also no
|
||||||
GET_<NAME>_LENGTH stage.
|
GET_<NAME>_LENGTH stage.
|
||||||
The initialization of the <NAME>_cnt has to be done in the previous decode_stage.
|
The initialization of the <NAME>_cnt has to be done in the previous decode_stage.
|
||||||
The <NAME>_cnt is compared against the fixed array length consatnt form the type package.
|
The <NAME>_cnt is compared against the fixed array length constant form the type package.
|
||||||
|
|
||||||
MAP
|
MAP
|
||||||
---
|
---
|
||||||
@ -133,7 +135,7 @@ struct <NAME>_Entry {
|
|||||||
};
|
};
|
||||||
sequence<<NAME>_Entry> <NAME>;
|
sequence<<NAME>_Entry> <NAME>;
|
||||||
|
|
||||||
For simplicity the name of the structure is ignored.
|
For simplicity the name of the <NAME>_Entry struct is ignored.
|
||||||
(I.e. the generated names are <NAME>_key, <NAME>_value instead of
|
(I.e. the generated names are <NAME>_key, <NAME>_value instead of
|
||||||
<NAME>_<NAME>_Entry_key and <NAME>_<NAME>_Entry_value)
|
<NAME>_<NAME>_Entry_key and <NAME>_<NAME>_Entry_value)
|
||||||
|
|
||||||
|
|||||||
@ -339,7 +339,11 @@ begin
|
|||||||
stage_next <= SKIP_PAYLOAD;
|
stage_next <= SKIP_PAYLOAD;
|
||||||
else
|
else
|
||||||
decode_stage_next <= GET_TESTSEQUENCE_TESTARRAY;
|
decode_stage_next <= GET_TESTSEQUENCE_TESTARRAY;
|
||||||
TestSequence_len_latch_next <= resize(tmp_length, TestSequence_len_latch_next'length);
|
if (tmp_length > TESTSEQUENCE_MAX_DEPTH) then
|
||||||
|
TestSequence_len_latch_next <= to_unsigned(TESTSEQUENCE_MAX_DEPTH, TestSequence_len_latch_next'length);
|
||||||
|
else
|
||||||
|
TestSequence_len_latch_next <= resize(tmp_length, TestSequence_len_latch_next'length);
|
||||||
|
end if;
|
||||||
TestSequence_cnt_next <= 0;
|
TestSequence_cnt_next <= 0;
|
||||||
-- DES: For array types the _cnt has to be initialized in the previous member stage
|
-- DES: For array types the _cnt has to be initialized in the previous member stage
|
||||||
TestSequence_TestArray_cnt_next <= 0;
|
TestSequence_TestArray_cnt_next <= 0;
|
||||||
|
|||||||
@ -684,7 +684,11 @@ begin
|
|||||||
decode_stage_next <= GET_TESTMAP_LENGTH;
|
decode_stage_next <= GET_TESTMAP_LENGTH;
|
||||||
else
|
else
|
||||||
decode_stage_next <= GET_TESTSEQUENCE_TESTARRAY;
|
decode_stage_next <= GET_TESTSEQUENCE_TESTARRAY;
|
||||||
TestSequence_len_latch_next <= resize(tmp_length, TestSequence_len_latch_next'length);
|
if (tmp_length > TESTSEQUENCE_MAX_DEPTH) then
|
||||||
|
TestSequence_len_latch_next <= to_unsigned(TESTSEQUENCE_MAX_DEPTH, TestSequence_len_latch_next'length);
|
||||||
|
else
|
||||||
|
TestSequence_len_latch_next <= resize(tmp_length, TestSequence_len_latch_next'length);
|
||||||
|
end if;
|
||||||
TestSequence_cnt_next <= 0;
|
TestSequence_cnt_next <= 0;
|
||||||
-- DES: For array types the _cnt has to be initialized in the previous member stage
|
-- DES: For array types the _cnt has to be initialized in the previous member stage
|
||||||
TestSequence_TestArray_cnt_next <= 0;
|
TestSequence_TestArray_cnt_next <= 0;
|
||||||
@ -873,7 +877,11 @@ begin
|
|||||||
-- Next Member
|
-- Next Member
|
||||||
decode_stage_next <= GET_TESTENUM;
|
decode_stage_next <= GET_TESTENUM;
|
||||||
else
|
else
|
||||||
TestMap_len_latch_next <= resize(tmp_length, TestMap_len_latch_next'length);
|
if (tmp_length > TESTMAP_MAX_DEPTH) then
|
||||||
|
TestMap_len_latch_next <= to_unsigned(TESTMAP_MAX_DEPTH, TestMap_len_latch_next'length);
|
||||||
|
else
|
||||||
|
TestMap_len_latch_next <= resize(tmp_length, TestMap_len_latch_next'length);
|
||||||
|
end if;
|
||||||
TestMap_cnt_next <= 0;
|
TestMap_cnt_next <= 0;
|
||||||
decode_stage_next <= GET_TESTMAP_KEY;
|
decode_stage_next <= GET_TESTMAP_KEY;
|
||||||
end if;
|
end if;
|
||||||
@ -1033,7 +1041,11 @@ begin
|
|||||||
-- DONE
|
-- DONE
|
||||||
stage_next <= SKIP_PAYLOAD;
|
stage_next <= SKIP_PAYLOAD;
|
||||||
else
|
else
|
||||||
TestString_len_latch_next <= resize(tmp_length, TestString_len_latch_next'length);
|
if (tmp_length > TESTSTRING_MAX_DEPTH) then
|
||||||
|
TestString_len_latch_next <= to_unsigned(TESTSTRING_MAX_DEPTH, TestString_len_latch_next'length);
|
||||||
|
else
|
||||||
|
TestString_len_latch_next <= resize(tmp_length, TestString_len_latch_next'length);
|
||||||
|
end if;
|
||||||
TestString_cnt_next <= 0;
|
TestString_cnt_next <= 0;
|
||||||
decode_stage_next <= GET_TESTSTRING;
|
decode_stage_next <= GET_TESTSTRING;
|
||||||
end if;
|
end if;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user