tonionio
Newbie level 6
Dear all ,
I am trying to build a comparator in VHDL for a 5-port router north port ,south , east ,west and local port to processing unit
I will have an input of 4 bits and these 4 bits will be compared with some x,y coordinates stored for each router's comparator. So lets say that the coordinates are x=1 and y=2 .
The coordinates show the position of a router in a mesh network. So if we have a 4x4 mesh network router 1 2 (xy) will be the second line and thrid row router.
So I want to compare the first 2 input bits (00 , 01 , 10 ,11) out of the 4 with the x coordinate of the router which we said is '1' decimal.
So again lets say that the first 2 bits are (11 binary =3 decimal)
I need to compare: if 2_first_input_bits > x where x is 1 then
out <= '000' where 000 indicates that we need use the east port of the router
elsif 2_first_input_bits < x where x is 1 then
out <= '001' where 001 indicates the west port
elsif 2_first_input_bits = x where x is 1 and 2_second_input_bits > y then
out <= '010' where 010 indicates the north port
elsif 2_first_input_bits = x where x is 1 and and 2_second_input_bits < y then
out <= '011' where 011 indicates the south port
else out <= '100' where 100 indicates the local port
end if ;
So my problem is that I cannot understand how to convert the binary to decimal and how to split the 4 input bits to two segments and use the for each coordinate.
I am trying to build a comparator in VHDL for a 5-port router north port ,south , east ,west and local port to processing unit
I will have an input of 4 bits and these 4 bits will be compared with some x,y coordinates stored for each router's comparator. So lets say that the coordinates are x=1 and y=2 .
The coordinates show the position of a router in a mesh network. So if we have a 4x4 mesh network router 1 2 (xy) will be the second line and thrid row router.
So I want to compare the first 2 input bits (00 , 01 , 10 ,11) out of the 4 with the x coordinate of the router which we said is '1' decimal.
So again lets say that the first 2 bits are (11 binary =3 decimal)
I need to compare: if 2_first_input_bits > x where x is 1 then
out <= '000' where 000 indicates that we need use the east port of the router
elsif 2_first_input_bits < x where x is 1 then
out <= '001' where 001 indicates the west port
elsif 2_first_input_bits = x where x is 1 and 2_second_input_bits > y then
out <= '010' where 010 indicates the north port
elsif 2_first_input_bits = x where x is 1 and and 2_second_input_bits < y then
out <= '011' where 011 indicates the south port
else out <= '100' where 100 indicates the local port
end if ;
So my problem is that I cannot understand how to convert the binary to decimal and how to split the 4 input bits to two segments and use the for each coordinate.
Last edited: