cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Observer
Observer
406 Views
Registered: ‎05-01-2019

Implementation

Hello,

I am trying to access various data in a packet sent through the ethernet. I wrote a code using variables as shown:

get: process
begin
wait until rising_edge(INTERNAL_RXCLK);
if(RXDV = '1') then
if(g_data = '1' and g_data_done = '0') then

if(PACKET_LENGTH = 13) then
d_packet <= RXD;

elsif(PACKET_LENGTH = 14 + c_a*5 and d_packet = x"0d") then
addr_reg(c) := RXD;
GPIO_LEDS(3 downto 0) <= RXD(3 downto 0);
c_a <= c_a + 1;
c <= c + 1;

end if;

Both c_a and c are integer variables

But everytime it is showing wrong values. Instead of using variables if I am hard coding the exact numbers then it is working fine. But I can't write the condition for every index. Can somebody suggest something how to solve this error.

Thank you

0 Kudos
2 Replies
Highlighted
Moderator
Moderator
351 Views
Registered: ‎07-21-2014

@anjali_apex 

Can you please share the complete code and associated testbench for us to check and suggest?

 

0 Kudos
Highlighted
Teacher
Teacher
345 Views
Registered: ‎07-09-2009

I'm guessing your more used to writting C++ ? It's not a critisisum. But be carefull.

Is this just for a test bench or synthesis.

Don't use a wait on clock and no sensetivity list.
Put the clock in the sensetuvity list, and use if rising_edge ..

 

Also. Take step back and think what hardware this code would produce, and what hardware u want

 

<== If this was helpful, please feel free to give Kudos, and close if it answers your question ==>
0 Kudos