一旦UART_RXD_PIN设置为“ 1”,我就完成了将数据从XADC传递到其他组件的项目。我正在为此项目使用BASYS3板。现在是时候创建可以模拟模拟信号并将其传递到4个不同xadc引脚的测试平台了。
我已经尝试了一些示例(在Internet上),但是它们使用的是VERILOG而不是VHDL,并且XADC没有像我的项目那样用作组件。我创建了“ supermain.vhdl”,其中top_main是组件,因此vivado可能会自己模拟XADC,但是它不起作用。
这是我的代码:
entity top_main is
Port (
CLK : IN STD_LOGIC;
UART_TXD_pin : IN STD_LOGIC;
UART_RXD_pin : OUT STD_LOGIC
);
end top_main;
architecture Behavioral of top_main is
-- COMPONENTS --
-- XADC --
COMPONENT XADC_block_input
PORT (
di_in : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
daddr_in : IN STD_LOGIC_VECTOR(6 DOWNTO 0);
den_in : IN STD_LOGIC;
dwe_in : IN STD_LOGIC;
drdy_out : OUT STD_LOGIC;
do_out : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
dclk_in : IN STD_LOGIC;
vp_in : IN STD_LOGIC;
vn_in : IN STD_LOGIC;
reset_in : IN STD_LOGIC;
------------------------------------
vauxp6 : IN STD_LOGIC;
vauxn6 : IN STD_LOGIC;
vauxp7 : IN STD_LOGIC;
vauxn7 : IN STD_LOGIC;
vauxp14 : IN STD_LOGIC;
vauxn14 : IN STD_LOGIC;
vauxp15 : IN STD_LOGIC;
vauxn15 : IN STD_LOGIC;
------------------------------------
channel_out : OUT STD_LOGIC_VECTOR(4 DOWNTO 0);
eoc_out : OUT STD_LOGIC;
alarm_out : OUT STD_LOGIC;
eos_out : OUT STD_LOGIC;
busy_out : OUT STD_LOGIC
);
END COMPONENT;
type pmod_addresses is array (0 to 3) of std_logic_vector(6 downto 0);
constant adress_pmod : pmod_addresses :=("0010110","0010111","0011110","0011111"); -- 6/7/14/15 -> PORTS XADC --
signal DataValid : STD_LOGIC; -- DATA IN VALID
signal DataReady : STD_LOGIC; -- DATA READY (FOR FFT)
signal index : INTEGER := 0; -- INDEX FOR ADC
signal DataOut : STD_LOGIC_VECTOR(15 DOWNTO 0); -- DATA ADC OUT
signal nr_adc : STD_LOGIC_VECTOR(6 downto 0) := adress_pmod(0);
-- PORT MAPS --
-- ADC --
XADC_PORT_MAP: XADC_block_input
PORT MAP (
di_in => X"0000",
daddr_in => nr_adc,
den_in => DataValid,
dwe_in => '0',
drdy_out => DataReady,
do_out => DataOut,
dclk_in => CLK_128MHz,
vp_in => '0',
vn_in => '0',
reset_in => MASTER_RESET,
------------------------------------
vauxp6 => ADC_6P_J3,
vauxn6 => ADC_6N_K3,
vauxp7 => ADC_7P_M2,
vauxn7 => ADC_7N_M1,
vauxp14 => ADC_14P_L3,
vauxn14 => ADC_14N_M3,
vauxp15 => ADC_15P_N2,
vauxn15 => ADC_15N_N1,
------------------------------------
channel_out => open,
eoc_out => DataValid,
alarm_out => open,
eos_out => open,
busy_out => open
);
-- ADC DATA FORWARDING --
p_XADC_PORT_ADDRESING: process(CLK_128MHz)
begin
if(rising_edge(CLK_128MHz)) then
if(DataReady = '1') then
case nr_adc is
when adress_pmod(0) =>
XADC_1_FIR_1 <= DataOut ;
when adress_pmod(1) =>
XADC_2_FIR_2 <= DataOut ;
when adress_pmod(2) =>
XADC_3_FIR_3 <= DataOut ;
when adress_pmod(3) =>
XADC_4_FIR_4 <= DataOut ;
when others =>
XADC_1_FIR_1 <= (others=>'0');
XADC_2_FIR_2 <= (others=>'0');
XADC_3_FIR_3 <= (others=>'0');
XADC_4_FIR_4 <= (others=>'0');
end case;
if index = 0 then
index <= 1;
else
index <= 0;
end if;
nr_adc <= adress_pmod(index);
end if;
end if;
end process p_XADC_PORT_ADDRESING;
这是只有实体和测试台代码的超级主体。
entity supermain is
Port (
CLK : IN STD_LOGIC;
UART_TXD_pin : IN STD_LOGIC;
UART_RXD_pin : OUT STD_LOGIC
);
end supermain;
architecture Behavioral of supermain is
component top_main
Port (
CLK : IN STD_LOGIC;
UART_TXD_pin : IN STD_LOGIC;
UART_RXD_pin : OUT STD_LOGIC
);
end component;
begin
symulacja : top_main
PORT MAP (
CLK => CLK,
UART_TXD_pin => UART_TXD_pin,
UART_RXD_pin => UART_RXD_pin
);
end Behavioral;
entity supermain_tb is
end;
architecture bench of supermain_tb is
component supermain
Port (
CLK : IN STD_LOGIC;
UART_TXD_pin : IN STD_LOGIC;
UART_RXD_pin : OUT STD_LOGIC
);
end component;
signal CLK: STD_LOGIC;
signal UART_TXD_pin: STD_LOGIC;
signal UART_RXD_pin: STD_LOGIC ;
constant clock_period: time := 1 ms;
signal stop_the_clock: boolean;
begin
uut: supermain port map ( CLK => CLK,
UART_TXD_pin => UART_TXD_pin,
UART_RXD_pin => UART_RXD_pin );
stimulus: process
begin
UART_TXD_pin <= '1' after 100 ns, '0' after 100 ns;
-- Put initialisation code here
-- Put test bench stimulus code here
wait;
end process;
clocking: process
begin
while not stop_the_clock loop
CLK <= '0', '1' after clock_period / 2;
wait for clock_period;
end loop;
wait;
end process;
end;
能否请您告诉我如何在testbench中模拟ANALOG信号?因为目前还没有
答案 0 :(得分:1)
您不能不将模拟信号连接到该模型。
不知道如何生成模拟信号也没关系,因为即使 if 您也可以生成模拟信号,但是模型也无法接受
例如,要模拟模拟信号,可以使用real
类型的信号。
但是,要接受这样的模拟信号,模型将需要类型为real
的输入端口。
我怀疑选择了STD_LOGIC端口类型,因为综合工具不会接受类型为“ real”的端口。因此,在这一方面,模型存在缺陷。解决方案将是拥有两个模型:一个用于仿真,一个用于合成。
答案 1 :(得分:0)
要模拟模拟输入,您需要使用模拟激励文件。
在UG480 http://www.xilinx.com/support/documentation/user_guides/ug480_7Series_XADC.pdf中,有一个包含激励文件和测试台的示例。
SIM_MONITOR_FILE =>“ design.txt”-模拟模拟数据文件名
您还可以在Vivado语言模板中看到刺激文件的示例 Vivado Language Template