hdl: bladerf2: Modify pinout for preprod boards
This commit is contained in:
parent
927c544ec9
commit
043e8f759d
5 changed files with 97 additions and 46 deletions
|
|
@ -1,6 +1,6 @@
|
|||
# Clock inputs
|
||||
create_clock -period "38.4 MHz" [get_ports c5_clock_1]
|
||||
create_clock -period "38.4 MHz" [get_ports c5_clock_2]
|
||||
create_clock -period "38.4 MHz" [get_ports c5_clock1]
|
||||
create_clock -period "38.4 MHz" [get_ports c5_clock2]
|
||||
create_clock -period "250.0 MHz" [get_ports adi_rx_clock]
|
||||
|
||||
# Generate the appropriate PLL clocks
|
||||
|
|
|
|||
|
|
@ -136,8 +136,8 @@ set_location_assignment PIN_U16 -to adi_ctrl_out[1]
|
|||
set_location_assignment PIN_U21 -to "adi_tx_data[0](n)"
|
||||
set_location_assignment PIN_U17 -to adi_ctrl_out[0]
|
||||
set_location_assignment PIN_U20 -to adi_tx_data[0]
|
||||
set_location_assignment PIN_P14 -to psu_ctl_d[0]
|
||||
set_location_assignment PIN_AB17 -to psu_ctl_d[1]
|
||||
set_location_assignment PIN_P14 -to pwr_sda
|
||||
set_location_assignment PIN_AB17 -to pwr_scl
|
||||
|
||||
# Bank 5B
|
||||
set_location_assignment PIN_N16 -to adi_ctrl_in[0]
|
||||
|
|
@ -172,6 +172,7 @@ set outs {
|
|||
ps_sync_1p1
|
||||
ps_sync_1p8
|
||||
adi_sync_in
|
||||
pwr_scl
|
||||
}
|
||||
for { set i 0 } { $i < 4 } { incr i } {
|
||||
lappend outs "adi_ctrl_in\[${i}\]"
|
||||
|
|
@ -185,8 +186,7 @@ foreach pin ${outs} {
|
|||
|
||||
# Single-ended inout constraints
|
||||
set inouts {
|
||||
psu_ctl_d[0]
|
||||
psu_ctl_d[1]
|
||||
pwr_sda
|
||||
}
|
||||
|
||||
foreach pin ${inouts} {
|
||||
|
|
@ -241,10 +241,10 @@ foreach pin ${lvds_ins} {
|
|||
##########
|
||||
# BANK 5A
|
||||
##########
|
||||
set_location_assignment PIN_T19 -to pwr_scl
|
||||
set_location_assignment PIN_T18 -to pwr_sda
|
||||
set_location_assignment PIN_T17 -to adf_muxout
|
||||
set_location_assignment PIN_T22 -to adf_ce
|
||||
set_location_assignment PIN_T19 -to ufl_clock_oe
|
||||
set_location_assignment PIN_T18 -to adf_ce
|
||||
set_location_assignment PIN_T17 -to c5_clock2_oe
|
||||
set_location_assignment PIN_T22 -to si_clock_sel
|
||||
set_location_assignment PIN_T15 -to adi_rx_spdt1_v[2]
|
||||
set_location_assignment PIN_R22 -to adi_rx_spdt1_v[1]
|
||||
set_location_assignment PIN_R15 -to adi_rx_spdt2_v[2]
|
||||
|
|
@ -256,7 +256,7 @@ set_location_assignment PIN_P19 -to adi_tx_spdt2_v[1]
|
|||
set_location_assignment PIN_P16 -to fx3_uart_cts
|
||||
set_location_assignment PIN_P18 -to fx3_uart_rxd
|
||||
set_location_assignment PIN_P17 -to fx3_uart_txd
|
||||
set_location_assignment PIN_T20 -to exp_clock_en
|
||||
set_location_assignment PIN_T20 -to exp_clock_oe
|
||||
|
||||
|
||||
# Bank voltage
|
||||
|
|
@ -267,8 +267,10 @@ set outs {
|
|||
fx3_uart_cts
|
||||
fx3_uart_rxd
|
||||
adf_ce
|
||||
pwr_scl
|
||||
exp_clock_en
|
||||
exp_clock_oe
|
||||
ufl_clock_oe
|
||||
c5_clock2_oe
|
||||
si_clock_sel
|
||||
}
|
||||
for { set i 1 } { $i < 3 } { incr i } {
|
||||
lappend outs "adi_rx_spdt1_v\[${i}\]"
|
||||
|
|
@ -285,7 +287,7 @@ foreach pin ${outs} {
|
|||
|
||||
# Single-ended inout constraints
|
||||
set inouts {
|
||||
pwr_sda
|
||||
|
||||
}
|
||||
|
||||
foreach pin ${inouts} {
|
||||
|
|
@ -297,7 +299,6 @@ foreach pin ${inouts} {
|
|||
# Single-ended input constraints
|
||||
set ins {
|
||||
fx3_uart_txd
|
||||
adf_muxout
|
||||
}
|
||||
|
||||
foreach pin ${ins} {
|
||||
|
|
@ -316,19 +317,22 @@ set_location_assignment PIN_K19 -to led[1]
|
|||
set_location_assignment PIN_G16 -to adf_sclk
|
||||
set_location_assignment PIN_G18 -to adf_sdi
|
||||
set_location_assignment PIN_H18 -to adf_csn
|
||||
set_location_assignment PIN_H16 -to c5_clock_1
|
||||
set_location_assignment PIN_F12 -to adf_muxout
|
||||
set_location_assignment PIN_H16 -to c5_clock1
|
||||
set_location_assignment PIN_G15 -to exp_present
|
||||
set_location_assignment PIN_B15 -to exp_i2c_scl
|
||||
set_location_assignment PIN_F14 -to exp_i2c_sda
|
||||
set_location_assignment PIN_A13 -to tx_bias_en
|
||||
set_location_assignment PIN_J11 -to rx_bias_en
|
||||
set_location_assignment PIN_H13 -to c5_clock_2
|
||||
set_location_assignment PIN_H13 -to c5_clock2
|
||||
set_location_assignment PIN_A12 -to dac_sclk
|
||||
set_location_assignment PIN_H11 -to dac_sdi
|
||||
set_location_assignment PIN_G12 -to dac_csn
|
||||
set_location_assignment PIN_D12 -to exp_clock_req
|
||||
set_location_assignment PIN_J18 -to mini_exp1
|
||||
set_location_assignment PIN_J17 -to mini_exp2
|
||||
set_location_assignment PIN_E12 -to hw_rev[0]
|
||||
set_location_assignment PIN_E15 -to hw_rev[1]
|
||||
|
||||
# Bank 8A
|
||||
set_location_assignment PIN_G10 -to exp_gpio[15]
|
||||
|
|
@ -414,10 +418,12 @@ foreach pin ${inouts} {
|
|||
|
||||
# Single-ended input constraints
|
||||
set ins {
|
||||
c5_clock_1
|
||||
c5_clock_2
|
||||
c5_clock1
|
||||
c5_clock2
|
||||
exp_present
|
||||
exp_clock_req
|
||||
hw_rev[0]
|
||||
hw_rev[1]
|
||||
}
|
||||
|
||||
foreach pin ${ins} {
|
||||
|
|
|
|||
|
|
@ -154,10 +154,12 @@ begin
|
|||
-- PLLs
|
||||
-- ========================================================================
|
||||
|
||||
-- TODO: implement c5_clock1 / c5_clock2 auto switchover in PLL
|
||||
|
||||
-- Create 80 MHz system clock from c5_clock_1 (38.4 MHz)
|
||||
U_system_pll : component system_pll
|
||||
port map (
|
||||
refclk => c5_clock_1,
|
||||
refclk => c5_clock2,
|
||||
rst => sys_pll_reset,
|
||||
outclk_0 => sys_clock,
|
||||
locked => sys_pll_locked
|
||||
|
|
@ -169,7 +171,7 @@ begin
|
|||
DEVICE_FAMILY => "Cyclone V"
|
||||
)
|
||||
port map (
|
||||
sys_clock => c5_clock_1,
|
||||
sys_clock => c5_clock2,
|
||||
pll_locked => sys_pll_locked,
|
||||
pll_reset => sys_pll_reset
|
||||
);
|
||||
|
|
@ -205,12 +207,14 @@ begin
|
|||
-- Therefore, sync must fall between:
|
||||
-- -10% of 201.117 KHz = 177.575 KHz
|
||||
-- +10% of 197.305 KHz = 217.036 KHz
|
||||
-- Dividing 38.4 MHz by 200 KHz yields 192, or 96 clock periods.
|
||||
ps_sync : process(c5_clock_1)
|
||||
-- Dividing 38.4 MHz by 200 KHz yields 192 clock periods. For a 50% duty
|
||||
-- cycle, ps_clk must spend half that time (96 periods) in logic '1' state,
|
||||
-- and the other half in logic '0' state.
|
||||
ps_sync : process(c5_clock2)
|
||||
variable count : natural range 0 to 96 := 96;
|
||||
variable ps_clk : std_logic := '0';
|
||||
begin
|
||||
if( rising_edge(c5_clock_1) ) then
|
||||
if( rising_edge(c5_clock2) ) then
|
||||
ps_sync_1p1 <= ps_clk;
|
||||
ps_sync_1p8 <= ps_clk;
|
||||
count := count - 1;
|
||||
|
|
@ -429,10 +433,38 @@ begin
|
|||
tx_trigger_ctl <= unpack(tx_trigger_ctl_i, tx_trigger_line);
|
||||
|
||||
-- LEDs
|
||||
led(1) <= led1_blink when nios_gpio.led_mode = '0' else not nios_gpio.leds(1);
|
||||
led(2) <= tx_underflow_led when nios_gpio.led_mode = '0' else not nios_gpio.leds(2);
|
||||
--led(1) <= led1_blink when nios_gpio.led_mode = '0' else not nios_gpio.leds(1);
|
||||
--led(2) <= tx_underflow_led when nios_gpio.led_mode = '0' else not nios_gpio.leds(2);
|
||||
led(3) <= rx_overflow_led when nios_gpio.led_mode = '0' else not nios_gpio.leds(3);
|
||||
|
||||
led1_blink_proc : process(c5_clock1)
|
||||
variable count : natural range 0 to 192e5 := 192e5;
|
||||
variable led1 : std_logic := '0';
|
||||
begin
|
||||
if( rising_edge(c5_clock1) ) then
|
||||
led(1) <= led1;
|
||||
count := count - 1;
|
||||
if( count = 0 ) then
|
||||
count := count'high;
|
||||
led1 := not led1;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
led2_blink_proc : process(c5_clock2)
|
||||
variable count : natural range 0 to 192e5 := 192e5;
|
||||
variable led2 : std_logic := '0';
|
||||
begin
|
||||
if( rising_edge(c5_clock2) ) then
|
||||
led(2) <= led2;
|
||||
count := count - 1;
|
||||
if( count = 0 ) then
|
||||
count := count'high;
|
||||
led2 := not led2;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- DAC SPI (data latched on falling edge)
|
||||
dac_sclk <= not nios_sclk when nios_gpio.adf_chip_enable = '0' else '0';
|
||||
dac_sdi <= nios_sdio when nios_gpio.adf_chip_enable = '0' else '0';
|
||||
|
|
@ -454,11 +486,11 @@ begin
|
|||
i2c_scl_in <= pwr_scl;
|
||||
i2c_sda_in <= pwr_sda;
|
||||
|
||||
-- Power mux control
|
||||
psu_ctl_d <= "ZZ";
|
||||
|
||||
-- Expansion clock request/enable
|
||||
exp_clock_en <= exp_present and exp_clock_req;
|
||||
-- SI53304 controls / clock output enables
|
||||
si_clock_sel <= nios_gpio.si_clock_sel;
|
||||
c5_clock2_oe <= '1'; -- TODO: not sure if we need this to be a Nios GPIO, or if we can auto detect
|
||||
exp_clock_oe <= exp_present and exp_clock_req;
|
||||
ufl_clock_oe <= nios_gpio.ufl_clock_oe;
|
||||
|
||||
-- Expansion I2C
|
||||
exp_i2c_scl <= 'Z';
|
||||
|
|
|
|||
|
|
@ -27,8 +27,14 @@ library ieee ;
|
|||
entity bladerf is
|
||||
port (
|
||||
-- Main 38.4MHz system clock (3.3 V)
|
||||
c5_clock_1 : in std_logic ;
|
||||
c5_clock_2 : in std_logic ;
|
||||
c5_clock1 : in std_logic ;
|
||||
c5_clock2 : in std_logic ;
|
||||
|
||||
-- SI53304 clock controls (3.3 V)
|
||||
si_clock_sel : out std_logic := '0';
|
||||
c5_clock2_oe : out std_logic := '0';
|
||||
ufl_clock_oe : out std_logic := '0';
|
||||
exp_clock_oe : out std_logic := '0';
|
||||
|
||||
-- VCTCXO DAC (3.3 V)
|
||||
dac_sclk : out std_logic := '0' ;
|
||||
|
|
@ -46,9 +52,6 @@ entity bladerf is
|
|||
pwr_sda : inout std_logic := 'Z';
|
||||
pwr_scl : out std_logic := 'Z';
|
||||
|
||||
-- Power mux control (2.5)
|
||||
psu_ctl_d : inout std_logic_vector(1 downto 0) ;
|
||||
|
||||
-- AD9361 RX Interface (2.5 V, LVDS)
|
||||
adi_rx_clock : in std_logic ;
|
||||
adi_rx_data : in std_logic_vector(5 downto 0) ;
|
||||
|
|
@ -105,16 +108,20 @@ entity bladerf is
|
|||
fx3_uart_txd : in std_logic ;
|
||||
fx3_uart_cts : out std_logic ;
|
||||
|
||||
-- Expansion Interface (3.3 V)
|
||||
-- Expansion Interface (3.3 V / 2.5 V / 1.8 V)
|
||||
exp_present : in std_logic;
|
||||
exp_clock_req : in std_logic;
|
||||
exp_clock_en : out std_logic;
|
||||
exp_i2c_sda : inout std_logic;
|
||||
exp_i2c_scl : inout std_logic;
|
||||
exp_gpio : inout std_logic_vector(31 downto 0);
|
||||
|
||||
-- Mini expansion interface (3.3 V / 2.5 V / 1.8 V)
|
||||
mini_exp1 : inout std_logic := 'Z';
|
||||
mini_exp2 : inout std_logic := 'Z'
|
||||
mini_exp2 : inout std_logic := 'Z';
|
||||
|
||||
-- Hardware revision resistors (3.3 V / 2.5 V / 1.8 V)
|
||||
hw_rev : in std_logic_vector(1 downto 0)
|
||||
|
||||
) ;
|
||||
end entity ; -- bladerf
|
||||
--TODO: explain revisions
|
||||
|
|
|
|||
|
|
@ -261,6 +261,8 @@ package bladerf_p is
|
|||
|
||||
type nios_gpio_t is record
|
||||
xb_mode : std_logic_vector(1 downto 0);
|
||||
si_clock_sel : std_logic;
|
||||
ufl_clock_oe : std_logic;
|
||||
meta_sync : std_logic;
|
||||
led_mode : std_logic;
|
||||
leds : std_logic_vector(3 downto 1);
|
||||
|
|
@ -441,13 +443,15 @@ package body bladerf_p is
|
|||
function pack( x : nios_gpio_t ) return std_logic_vector is
|
||||
variable rv : std_logic_vector(31 downto 0) := (others => '0');
|
||||
begin
|
||||
rv(31 downto 30) := x.xb_mode;
|
||||
rv(16) := x.meta_sync;
|
||||
rv(15) := x.led_mode;
|
||||
rv(14 downto 12) := x.leds;
|
||||
rv(11) := x.adf_chip_enable;
|
||||
rv(10 downto 8) := x.rx_mux_sel;
|
||||
rv(7) := x.usb_speed;
|
||||
rv(31 downto 30) := x.xb_mode;
|
||||
rv(18) := x.si_clock_sel;
|
||||
rv(17) := x.ufl_clock_oe;
|
||||
rv(16) := x.meta_sync;
|
||||
rv(15) := x.led_mode;
|
||||
rv(14 downto 12) := x.leds;
|
||||
rv(11) := x.adf_chip_enable;
|
||||
rv(10 downto 8) := x.rx_mux_sel;
|
||||
rv(7) := x.usb_speed;
|
||||
return rv;
|
||||
end function;
|
||||
|
||||
|
|
@ -504,6 +508,8 @@ package body bladerf_p is
|
|||
variable rv : nios_gpio_t;
|
||||
begin
|
||||
rv.xb_mode := x(31 downto 30);
|
||||
rv.si_clock_sel := x(18);
|
||||
rv.ufl_clock_oe := x(17);
|
||||
rv.meta_sync := x(16);
|
||||
rv.led_mode := x(15);
|
||||
rv.leds := x(14 downto 12);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue