Commit 3dd3145d authored by Dimitris Lampridis's avatar Dimitris Lampridis
Browse files

Merge remote-tracking branch 'origin/ML-btrain-wrenable' into dlamprid-wrbtrain_vfchd

parents aaff76e8 05c3a6c8
...@@ -4,3 +4,6 @@ ...@@ -4,3 +4,6 @@
[submodule "Hdl/FpgaModules/SystemSpecific/wr-cores"] [submodule "Hdl/FpgaModules/SystemSpecific/wr-cores"]
path = Hdl/FpgaModules/SystemSpecific/WhiteRabbit/wr-cores path = Hdl/FpgaModules/SystemSpecific/WhiteRabbit/wr-cores
url = git://ohwr.org/hdl-core-lib/wr-cores.git url = git://ohwr.org/hdl-core-lib/wr-cores.git
[submodule "Hdl/FpgaModules/ApplicationSpecific/WrBtrain/PS-BTrain-over-WhiteRabbit"]
path = Hdl/FpgaModules/ApplicationSpecific/WrBtrain/PS-BTrain-over-WhiteRabbit
url = ssh://git@gitlab.cern.ch:7999/BTrain-TEAM/PS-BTrain-over-WhiteRabbit.git
...@@ -11,13 +11,9 @@ module AddrDecoderWBApp( ...@@ -11,13 +11,9 @@ module AddrDecoderWBApp(
input AckAppReleaseId_i, input AckAppReleaseId_i,
output reg StbAppReleaseId_o, output reg StbAppReleaseId_o,
input [31:0] DatCtrlReg_ib32, input [31:0] DatWrBtrain_ib32,
input AckCtrlReg_i, input AckWrBtrain_i,
output reg StbCtrlReg_o, output reg StbWrBtrain_o
input [31:0] DatStatReg_ib32,
input AckStatReg_i,
output reg StbStatReg_o
); );
...@@ -27,14 +23,12 @@ reg [1:0] SelectedModule_b2; ...@@ -27,14 +23,12 @@ reg [1:0] SelectedModule_b2;
localparam c_SelNothing = 2'd0, localparam c_SelNothing = 2'd0,
c_SelAppRevisionId = 2'd1, c_SelAppRevisionId = 2'd1,
c_SelCtrlReg = 2'd2, c_SelWRBtrain = 2'd2;
c_SelStatReg = 2'd3;
always @* always @*
casez(Adr_ib21) casez(Adr_ib21)
21'b0_0000_0000_0000_0000_00??: SelectedModule_b2 = c_SelAppRevisionId; // FROM 00_0000 TO 00_0003 (WB) == FROM 00_0000 TO 00_000C (VME) <- 4 regs (16B) 21'b0_0000_0000_0000_0000_00??: SelectedModule_b2 = c_SelAppRevisionId; // FROM 00_0000 TO 00_0003 (WB) == FROM 00_0000 TO 00_000C (VME) <- 4 regs (16B)
21'b0_0000_0000_0000_0000_01??: SelectedModule_b2 = c_SelCtrlReg; // FROM 00_0004 TO 00_0007 (WB) == FROM 00_0010 TO 00_001C (VME) <- 4 regs (16B) 21'b0_0000_0000_0000_0001_????: SelectedModule_b2 = c_SelWRBtrain; // FROM 00_0010 TO 00_001F (WB) == FROM 00_0040 TO 00_007C (VME) <-16 regs (64B)
21'b0_0000_0000_0000_0000_10??: SelectedModule_b2 = c_SelStatReg; // FROM 00_0008 TO 00_000B (WB) == FROM 00_0020 TO 00_002C (VME) <- 4 regs (16B)
default: SelectedModule_b2 = c_SelNothing; default: SelectedModule_b2 = c_SelNothing;
endcase endcase
...@@ -42,23 +36,17 @@ always @* begin ...@@ -42,23 +36,17 @@ always @* begin
Ack_o <= #dly 1'b0; Ack_o <= #dly 1'b0;
Dat_ob32 <= #dly 32'h0; Dat_ob32 <= #dly 32'h0;
StbAppReleaseId_o <= #dly 1'b0; StbAppReleaseId_o <= #dly 1'b0;
StbCtrlReg_o <= #dly 1'b0; StbWrBtrain_o <= #dly 1'b0;
StbStatReg_o <= #dly 1'b0;
case(SelectedModule_b2) case(SelectedModule_b2)
c_SelAppRevisionId: begin c_SelAppRevisionId: begin
StbAppReleaseId_o <= #dly Stb_i; StbAppReleaseId_o <= #dly Stb_i;
Dat_ob32 <= #dly DatAppReleaseId_ib32; Dat_ob32 <= #dly DatAppReleaseId_ib32;
Ack_o <= #dly AckAppReleaseId_i; Ack_o <= #dly AckAppReleaseId_i;
end end
c_SelCtrlReg: begin c_SelWRBtrain: begin
StbCtrlReg_o <= #dly Stb_i; StbWrBtrain_o <= #dly Stb_i;
Dat_ob32 <= #dly DatCtrlReg_ib32; Dat_ob32 <= #dly DatWrBtrain_ib32;
Ack_o <= #dly AckCtrlReg_i; Ack_o <= #dly AckWrBtrain_i;
end
c_SelStatReg: begin
StbStatReg_o <= #dly Stb_i;
Dat_ob32 <= #dly DatStatReg_ib32;
Ack_o <= #dly AckStatReg_i;
end end
default: ; default: ;
endcase endcase
......
...@@ -6,49 +6,14 @@ module VfcHdApplication ...@@ -6,49 +6,14 @@ module VfcHdApplication
g_ApplicationReleaseMonth_b8 = 8'h07, g_ApplicationReleaseMonth_b8 = 8'h07,
g_ApplicationReleaseYear_b8 = 8'h16) g_ApplicationReleaseYear_b8 = 8'h16)
( (
//@@@@@@@@@@@@@@@@@@@@@@@@@
//External connections
//@@@@@@@@@@@@@@@@@@@@@@@@@
// FMC connector: // FMC connector:
output VfmcEnableN_oen, output VfmcEnableN_oen,
/* -----\/----- EXCLUDED -----\/----- output [33:0] FmcLaP_ob34,
inout [33:0] FmcLaP_iob34, output [33:0] FmcLaN_ob34,
inout [33:0] FmcLaN_iob34, // GPIO:
inout [23:0] FmcHaP_iob24, output [3:0] GpIo_ob4,
inout [23:0] FmcHaN_iob24,
inout [21:0] FmcHbP_iob22,
inout [21:0] FmcHbN_iob22,
input FmcPrsntM2C_in,
output FmcTck_ok,
output FmcTms_o,
output FmcTdi_o,
input FmcTdo_i,
output FmcTrstL_orn,
inout FmcScl_iok,
inout FmcSda_io,
input FmcPgM2C_in,
output FmcPgC2M_on,
input FmcClk0M2CCmos_ik,
input FmcClk1M2CCmos_ik,
inout FmcClk2Bidir_iok, // Comment: Differential signal
inout FmcClk3Bidir_iok, // Comment: Differential signal
input FmcClkDir_i,
output [ 9:0] FmcDpC2M_ob10, // Comment: Differential signal
input [ 9:0] FmcDpM2C_ib10,
input FmcGbtClk0M2CLeft_ik, // Comment: Differential signal
input FmcGbtClk1M2CLeft_ik, // Comment: Differential signal
input FmcGbtClk0M2CRight_ik, // Comment: Differential signal
input FmcGbtClk1M2CRight_ik, // Comment: Differential signal
-----/\----- EXCLUDED -----/\----- */
// Clock sources and control: // Clock sources and control:
input GbitTrxClkRefR_ik, // Comment: Differential reference for the Gbit lines ~125MHz input GbitTrxClkRefR_ik, // Comment: Differential reference for the Gbit lines ~125MHz
// SW1:
input [ 1:0] Switch_ib2,
// GPIO:
inout [ 4:1] GpIo_iob4,
//@@@@@@@@@@@@@@@@@@@@@@@@@
//System-Application interface
//@@@@@@@@@@@@@@@@@@@@@@@@@
// Reset: // Reset:
input Reset_irqp, // Comment: Reset Synchronous with the WbClk_ik input Reset_irqp, // Comment: Reset Synchronous with the WbClk_ik
output ResetRequest_oqp, // Comment: Request to issue a reset output ResetRequest_oqp, // Comment: Request to issue a reset
...@@ -63,10 +28,26 @@ module VfcHdApplication ...@@ -63,10 +28,26 @@ module VfcHdApplication
output WbSlaveAck_o, output WbSlaveAck_o,
// Interrupt: // Interrupt:
output [23:0] InterruptRequest_opb24, output [23:0] InterruptRequest_opb24,
// GPIO direction: // WR Btrain interface:
output GpIo1DirOut_o, output [207:0] WrBtrainTxData_o,
output GpIo2DirOut_o, output WrBtrainTxValid_o,
output GpIo34DirOut_o input WrBtrainTxDreq_i,
output WrBtrainTxLast_o,
output WrBtrainTxFlush_o,
input WrBtrainRxFirst_i,
input WrBtrainRxLast_i,
input [207:0] WrBtrainRxData_i,
input WrBtrainRxValid_i,
output WrBtrainRxDreq_o,
// WRPC timecode input:
input WrpcPps_i,
input WrpcTmTimeValid_i,
input [39:0] WrpcTmTai_i,
input [27:0] WrpcTmCycles_i,
input WrpcLedLink_i,
input WrpcLedAct_i,
// WRPC system clock:
input WrpcSysClk_ik
); );
//**************************** //****************************
...@@ -77,15 +58,13 @@ wire Clk_k; ...@@ -77,15 +58,13 @@ wire Clk_k;
wire WbStbAppReleaseId, WbAckAppReleaseId; wire WbStbAppReleaseId, WbAckAppReleaseId;
wire [31:0] WbDatAppReleaseId_b32; wire [31:0] WbDatAppReleaseId_b32;
wire WbStbCtrlReg, WbAckCtrlReg; wire WbStbWrBtrain, WbAckWrBtrain;
wire [31:0] WbDatCtrlReg_b32; wire [31:0] WbDatWrBtrain_b32;
wire WbStbStatReg, WbAckStatReg;
wire [31:0] WbDatStatReg_b32;
wire [31:0] Reg0Value_b32;
wire GpIo1Dir, GpIo2Dir,GpIo34Dir;
wire [31:0] WrBtrainBvalue;
wire WrBtrainBvalueValid;
wire WrBtrainBvalueUpdated;
//**************************** //****************************
//Fixed assignments //Fixed assignments
//**************************** //****************************
...@@ -94,26 +73,12 @@ assign InterruptRequest_opb24 = 24'b0; ...@@ -94,26 +73,12 @@ assign InterruptRequest_opb24 = 24'b0;
assign ResetRequest_oqp = 1'b0; assign ResetRequest_oqp = 1'b0;
assign GpIo1Dir = 1'b0;
assign GpIo2Dir = 1'b0;
assign GpIo34Dir = 1'b0;
assign GpIo1DirOut_o = GpIo1Dir;
assign GpIo2DirOut_o = GpIo2Dir;
assign GpIo34DirOut_o = GpIo34Dir;
assign GpIo_iob4[4] = GpIo34Dir ? 1'b0 : 1'bz;
assign GpIo_iob4[3] = GpIo34Dir ? 1'b0 : 1'bz;
assign GpIo_iob4[2] = GpIo2Dir ? 1'b0 : 1'bz;
assign GpIo_iob4[1] = GpIo1Dir ? 1'b0 : 1'bz;
assign VfmcEnableN_oen = 1'b0;
//**************************** //****************************
//Clocking //Clocking
//**************************** //****************************
assign Clk_k = GbitTrxClkRefR_ik; //~125MHz //assign Clk_k = GbitTrxClkRefR_ik; //~125MHz
assign Clk_k = WrpcSysClk_ik;
assign WbClk_ok = Clk_k; assign WbClk_ok = Clk_k;
//**************************** //****************************
...@@ -121,23 +86,19 @@ assign WbClk_ok = Clk_k; ...@@ -121,23 +86,19 @@ assign WbClk_ok = Clk_k;
//**************************** //****************************
AddrDecoderWBApp i_AddrDecoderWbApp( AddrDecoderWBApp i_AddrDecoderWbApp(
.Clk_ik (Clk_k), .Clk_ik(Clk_k),
.Adr_ib21 (WbSlaveAdr_ib25[20:0]), .Adr_ib21(WbSlaveAdr_ib25[20:0]),
.Stb_i (WbSlaveStb_i), .Stb_i(WbSlaveStb_i),
.Dat_ob32 (WbSlaveDat_ob32), .Dat_ob32(WbSlaveDat_ob32),
.Ack_o (WbSlaveAck_o), .Ack_o(WbSlaveAck_o),
//--
.DatAppReleaseId_ib32 (WbDatAppReleaseId_b32), .DatAppReleaseId_ib32(WbDatAppReleaseId_b32),
.AckAppReleaseId_i (WbAckAppReleaseId), .AckAppReleaseId_i(WbAckAppReleaseId),
.StbAppReleaseId_o (WbStbAppReleaseId), .StbAppReleaseId_o(WbStbAppReleaseId),
//--
.DatCtrlReg_ib32 (WbDatCtrlReg_b32), .DatWrBtrain_ib32(WbDatWrBtrain_b32),
.AckCtrlReg_i (WbAckCtrlReg), .AckWrBtrain_i(WbAckWrBtrain),
.StbCtrlReg_o (WbStbCtrlReg), .StbWrBtrain_o(WbStbWrBtrain));
//--
.DatStatReg_ib32 (WbDatStatReg_b32),
.AckStatReg_i (WbAckStatReg),
.StbStatReg_o (WbStbStatReg));
//**************************** //****************************
//Release ID //Release ID
...@@ -157,48 +118,133 @@ Generic4InputRegs i_AppReleaseId( ...@@ -157,48 +118,133 @@ Generic4InputRegs i_AppReleaseId(
.Reg3Value_ib32 ({g_ApplicationVersion_b8, g_ApplicationReleaseDay_b8, g_ApplicationReleaseMonth_b8, g_ApplicationReleaseYear_b8})); .Reg3Value_ib32 ({g_ApplicationVersion_b8, g_ApplicationReleaseDay_b8, g_ApplicationReleaseMonth_b8, g_ApplicationReleaseYear_b8}));
//**************************** //****************************
//Example registers ////WR-Btrain
//**************************** //****************************
//Control register bank: WrBtrainWrapper #(
Generic4OutputRegs #( .g_st_data_width (208),
.Reg0Default (32'hBABEB00B), .g_wb_addr_width (25),
.Reg0AutoClrMask (32'hFFFFFFFF), .g_wb_data_width (32))
.Reg1Default (32'h00000000), i_WrBtrainWrapper (
.Reg1AutoClrMask (32'hFFFFFFFF), .clk_i (Clk_k),
.Reg2Default (32'h00000000), .rst_n_i (~Reset_irqp),
.Reg2AutoClrMask (32'hFFFFFFFF),
.Reg3Default (32'h00000000), .tx_data_o (WrBtrainTxData_o),
.Reg3AutoClrMask (32'hFFFFFFFF)) .tx_valid_o (WrBtrainTxValid_o),
i_ControlRegs ( .tx_dreq_i (WrBtrainTxDreq_i),
.Clk_ik (Clk_k), .tx_last_o (WrBtrainTxLast_o),
.Rst_irq (Reset_irqp), .tx_flush_o (WrBtrainTxFlush_o),
.Cyc_i (WbSlaveCyc_i),
.Stb_i (WbStbCtrlReg), .rx_data_i (WrBtrainRxData_i),
.We_i (WbSlaveWr_i), .rx_valid_i (WrBtrainRxValid_i),
.Adr_ib2 (WbSlaveAdr_ib25[1:0]), .rx_first_i (WrBtrainRxFirst_i),
.Dat_ib32 (WbSlaveDat_ib32), .rx_dreq_o (WrBtrainRxDreq_o),
.Dat_oab32 (WbDatCtrlReg_b32), .rx_last_i (WrBtrainRxLast_i),
.Ack_oa (WbAckCtrlReg),
//-- .Bvalue_o (WrBtrainBvalue),
.Reg0Value_ob32 (Reg0Value_b32), .BvalueValid_o (WrBtrainBvalueValid),
.Reg1Value_ob32 (), .BvalueUpdated_p1_o (WrBtrainBvalueUpdated),
.Reg2Value_ob32 (),
.Reg3Value_ob32 ()); .wb_adr_i (WbSlaveAdr_ib25),
.wb_dat_i (WbSlaveDat_ib32),
//Status registers bank: .wb_dat_o (WbDatWrBtrain_b32),
Generic4InputRegs i_StatusRegs ( .wb_sel_i (3'b111),
.Clk_ik (Clk_k), .wb_we_i (WbSlaveWr_i),
.Rst_irq (Reset_irqp), .wb_cyc_i (WbSlaveCyc_i),
.Cyc_i (WbSlaveCyc_i), .wb_stb_i (WbStbWrBtrain),
.Stb_i (WbStbStatReg), .wb_ack_o (WbAckWrBtrain),
.Adr_ib2 (WbSlaveAdr_ib25[1:0]), .wb_err_o (),
.Dat_oab32 (WbDatStatReg_b32), .wb_rty_o (),
.Ack_oa (WbAckStatReg), .wb_stall_o ());
//--
.Reg0Value_ib32 (Reg0Value_b32), //@@@@@@@@@@@@@@@@@@@
.Reg1Value_ib32 (32'hCAFEAC1D), //FMC signal mapping
.Reg2Value_ib32 (32'hACDCDEAD), //@@@@@@@@@@@@@@@@@@@
.Reg3Value_ib32 (32'hFEEDBEEF));
assign VfmcEnableN_oen = 1'b0;
assign FmcLaP_ob34[0] = ~WrBtrainBvalue[31];
assign FmcLaP_ob34[2] = WrBtrainBvalue[30];
assign FmcLaN_ob34[0] = WrBtrainBvalue[29];
assign FmcLaN_ob34[2] = WrBtrainBvalue[28];
assign FmcLaP_ob34[3] = WrBtrainBvalue[27];
assign FmcLaP_ob34[4] = WrBtrainBvalue[26];
assign FmcLaN_ob34[3] = WrBtrainBvalue[25];
assign FmcLaN_ob34[4] = WrBtrainBvalue[24];
assign FmcLaP_ob34[8] = WrBtrainBvalue[23];
assign FmcLaP_ob34[7] = WrBtrainBvalue[22];
assign FmcLaN_ob34[8] = WrBtrainBvalue[21];
assign FmcLaN_ob34[7] = WrBtrainBvalue[20];
assign FmcLaP_ob34[12] = WrBtrainBvalue[19];
assign FmcLaP_ob34[11] = WrBtrainBvalue[18];
assign FmcLaN_ob34[12] = WrBtrainBvalue[17];
assign FmcLaN_ob34[11] = WrBtrainBvalue[16];
assign FmcLaP_ob34[16] = WrBtrainBvalue[15];
assign FmcLaP_ob34[15] = WrBtrainBvalue[14];
assign FmcLaN_ob34[16] = WrBtrainBvalue[13];
assign FmcLaN_ob34[15] = WrBtrainBvalue[12];
assign FmcLaP_ob34[20] = WrBtrainBvalue[11];
assign FmcLaP_ob34[19] = WrBtrainBvalue[10];
assign FmcLaN_ob34[20] = WrBtrainBvalue[9];
assign FmcLaN_ob34[19] = WrBtrainBvalue[8];
assign FmcLaP_ob34[22] = WrBtrainBvalue[7];
assign FmcLaP_ob34[21] = WrBtrainBvalue[6];
assign FmcLaN_ob34[22] = WrBtrainBvalue[5];
assign FmcLaN_ob34[21] = WrBtrainBvalue[4];
assign FmcLaP_ob34[25] = WrBtrainBvalue[3];
assign FmcLaP_ob34[24] = WrBtrainBvalue[2];
assign FmcLaN_ob34[25] = WrBtrainBvalue[1];
assign FmcLaN_ob34[24] = WrBtrainBvalue[0];
assign FmcLaP_ob34[28] = WrBtrainBvalueUpdated;
assign FmcLaP_ob34[29] = WrBtrainBvalueValid;
assign FmcLaN_ob34[28] = WrpcLedAct_i;
assign FmcLaN_ob34[29] = WrpcLedLink_i;
assign FmcLaP_ob34[31] = WrpcTmTimeValid_i;
assign FmcLaP_ob34[30] = 1'b0; // BT_UP_o
assign FmcLaN_ob34[31] = 1'b0; // BT_DN_o
// unused, driven to ground
assign FmcLaP_ob34[1] = 1'b0;
assign FmcLaN_ob34[1] = 1'b0;
assign FmcLaP_ob34[5] = 1'b0;
assign FmcLaN_ob34[5] = 1'b0;
assign FmcLaP_ob34[6] = 1'b0;
assign FmcLaN_ob34[6] = 1'b0;
assign FmcLaP_ob34[9] = 1'b0;
assign FmcLaN_ob34[9] = 1'b0;
assign FmcLaP_ob34[10] = 1'b0;
assign FmcLaN_ob34[10] = 1'b0;
assign FmcLaP_ob34[13] = 1'b0;
assign FmcLaN_ob34[13] = 1'b0;
assign FmcLaP_ob34[14] = 1'b0;
assign FmcLaN_ob34[14] = 1'b0;
assign FmcLaP_ob34[17] = 1'b0;
assign FmcLaN_ob34[17] = 1'b0;
assign FmcLaP_ob34[18] = 1'b0;
assign FmcLaN_ob34[18] = 1'b0;
assign FmcLaP_ob34[23] = 1'b0;
assign FmcLaN_ob34[23] = 1'b0;
assign FmcLaP_ob34[26] = 1'b0;
assign FmcLaN_ob34[26] = 1'b0;
assign FmcLaP_ob34[27] = 1'b0;
assign FmcLaN_ob34[27] = 1'b0;
assign FmcLaN_ob34[30] = 1'b0;
assign FmcLaP_ob34[32] = 1'b0;
assign FmcLaN_ob34[32] = 1'b0;
assign FmcLaP_ob34[33] = 1'b0;
assign FmcLaN_ob34[33] = 1'b0;
//@@@@@@@@@@@@@@@@@@@
//GPIO signal mapping
//@@@@@@@@@@@@@@@@@@@
assign GpIo_ob4[0] = WrpcPps_i;
assign GpIo_ob4[1] = WrBtrainBvalueValid;
assign GpIo_ob4[2] = 1'b0;
assign GpIo_ob4[3] = 1'b0;
endmodule endmodule
Subproject commit 3a10c23e80700930de0172ea8d196465e05331e6
-------------------------------------------------------------------------------
-- Title : Btrain over White Rabbit
-- Project : Btrain
-------------------------------------------------------------------------------
-- File : WrBtrainWrapper.vhd
-- Author : Maciej Lipinski
-- Company : CERN
-- Created : 2016-07-01
-- Platform : FPGA-generics
-- Standard : VHDL
-------------------------------------------------------------------------------
-- Description:
--
-------------------------------------------------------------------------------
--
-- Copyright (c) 2016 CERN BE-CO-HT
--
-- This source file is free software; you can redistribute it
-- and/or modify it under the terms of the GNU Lesser General
-- Public License as published by the Free Software Foundation;
-- either version 2.1 of the License, or (at your option) any
-- later version.
--
-- This source is distributed in the hope that it will be
-- useful, but WITHOUT ANY WARRANTY; without even the implied
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE. See the GNU Lesser General Public License for more
-- details
--
-- You should have received a copy of the GNU Lesser General
-- Public License along with this source; if not, download it
-- from http://www.gnu.org/licenses/lgpl-2.1.html
--
-------------------------------------------------------------------------------
-- Revisions :
-- Date Version Author Description
-- 2016-07-01 1.0 mlipinsk Created
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use work.WRBtrain_pkg.all;
use work.wishbone_pkg.all;
library work;
entity WrBtrainWrapper is
generic (
g_st_data_width : integer:=c_STREAMER_DATA_WIDTH; -- wr streamer data width
g_wb_addr_width : integer:=25; -- wishbone address width
g_wb_data_width : integer:=32 -- wishbone data width
);
port(
clk_i : in std_logic;
rst_n_i : in std_logic;
----------------------------------------------------------------
-- Interface with wr_transmission
----------------------------------------------------------------
-- tx
tx_data_o : out std_logic_vector(g_st_data_width-1 downto 0);
tx_valid_o : out std_logic;
tx_dreq_i : in std_logic;
tx_last_o : out std_logic;
tx_flush_o : out std_logic;
-- rx
rx_data_i : in std_logic_vector(g_st_data_width-1 downto 0);
rx_valid_i : in std_logic;
rx_first_i : in std_logic;
rx_dreq_o : out std_logic;
rx_last_i : in std_logic;
----------------------------------------------------------------
-- Interface with Btrain FMC
----------------------------------------------------------------
-- 32-bit value of magnetic field received from Btrain master via WR
Bvalue_o : out std_logic_vector(31 downto 0);
-- HIGH indicates that the value in the register have been received (basically, it is low
-- between reset/powerup and first reception)
BvalueValid_o : out std_logic;
-- single period strobe to which indates update of the Bvalue (first cycle of new value)
BvalueUpdated_p1_o : out std_logic;
----------------------------------------------------------------
-- Wishbone interface
----------------------------------------------------------------
wb_adr_i : in std_logic_vector(g_wb_addr_width-1 downto 0) := (others => '0');
wb_dat_i : in std_logic_vector(g_wb_data_width-1 downto 0) := (others => '0');
wb_dat_o : out std_logic_vector(g_wb_data_width-1 downto 0);
wb_sel_i : in std_logic_vector(g_wb_addr_width/8-1 downto 0) := (others => '0');
wb_we_i : in std_logic := '0';
wb_cyc_i : in std_logic := '0';
wb_stb_i : in std_logic := '0';
wb_ack_o : out std_logic;
wb_err_o : out std_logic;
wb_rty_o : out std_logic;
wb_stall_o : out std_logic
);
end WrBtrainWrapper;
architecture Behavioral of WrBtrainWrapper is
------------------------------------------------------------------------------
---Wishbone access to WRPC's: RAM, peripherals, vuart, etc..
------------------------------------------------------------------------------
signal wb_slave_out : t_wishbone_slave_out;
signal wb_slave_in : t_wishbone_slave_in;
------------------------------------------------------------------------------
---Btrain data records
------------------------------------------------------------------------------
signal rx_BFramePayloads : t_BFramePayload;
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.
-- ---------------------------------------------------------------------------