Commit 05c3a6c8 authored by Maciej Lipinski's avatar Maciej Lipinski
Browse files

[WR-dev] added encoding of Bvalue required by Patric Odier and its application.

The Bvalue is received as signed encoded in two's complement. the board used
by Patric expects Offset Binary encoding. Thus, conversion is needed.
parent 5012da56
......@@ -110,7 +110,29 @@ architecture Behavioral of WrBtrainWrapper is
signal rx_Frame_valid_pX : std_logic;
signal tx_FrameHeader : t_FrameHeader;
signal tx_BFramePayloads : t_BFramePayload;
-- ---------------------------------------------------------------------------
-- The function below provides conversion from two's complement to Offset
-- Binary encoding. The encoding is done by adding the offset without overflow.
--
-- The encoding of Bvalue needed by the VFC-HD-based WR-Btrain receiver is
-- an Offset Binary (access-2^31), the value provided by the btrain is signed
-- encoded as two's complement.
-- ---------------------------------------------------------------------------
-- | description |offest binary(access-32 binary)| two's complement |
-- | | (hex) | MSB | MSB | (hex) |
-- | +Full Scale | 0x FFFF FFFF | 1111 1111 | 0111 1111 | 0x 7FFF FFFF |
-- | +Half Scale | 0x C000 0000 | 1100 0000 | | 0x 4000 0000 |
-- | zero | 0x 8000 0000 | 1000 0000 | 0000 0000 | 0x 0000 0000 |
-- | -Half Scale | 0x 4000 0000 | 0100 0000 | | 0x C000 0000 |
-- | -Full Scale | 0x 0000 0000 | 0000 0000 | 1000 0000 | 0x 8000 0000 |
-- ---------------------------------------------------------------------------
function f_encodeOffsetBinary(BvalueIn : std_logic_vector) return std_logic_vector is
variable ret : std_logic_vector(31 downto 0);
begin
ret := not BvalueIn(31) & BvalueIn(30 downto 0);
return ret;
end;
begin
......@@ -158,7 +180,7 @@ begin
BvalueUpdated_p1_o <= '0';
else
if(rx_Frame_valid_pX='1') then
Bvalue_o <= rx_BFramePayloads.B;
Bvalue_o <= f_encodeOffsetBinary(rx_BFramePayloads.B);
BvalueValid_o <= '1';
BvalueUpdated_p1_o <= '1';
else
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment