Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
8 years ago

How to sned more than 32bits of data to HPS form FPGA custom ip

down votefavorite (http://stackoverflow.com/questions/43377035/read-data-from-the-fpga-ip-to-the-hps-in-altera-soc-fpga#)

I am trying to access data from hps via Avalon memory mapping interface. I have put together system in qsys and assigned base address. In below code the I got the count value in 1st 32 bit std_logic_vector data to the HPS. But I didn't get the data in second 32 bit std_logic_vector

library ieee;

use ieee.std_logic_1164.all;

USE ieee.numeric_std.ALL;

use IEEE.STD_LOGIC_ARITH.ALL;

use IEEE.STD_LOGIC_UNSIGNED.ALL;

entity en is

GENERIC(

max_pulse : INTEGER := 800; --pulses per revolution

res_bits : INTEGER := 16); --max count 2^res_bits

port(

--avlon slave inputsa and outputs

clk : in std_logic;

reset : in std_logic;

avs_s0_address : IN STD_LOGIC;

avs_s0_read : IN STD_LOGIC;

avs_s0_write : IN STD_LOGIC;

avs_s0_readdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);

avs_s0_writedata : IN STD_LOGIC_VECTOR(31 DOWNTO 0)

 );

end en;

architecture behavior of encorder is

----- avlon read

PROCESS(avs_s0_read)

BEGIN

IF avs_s0_read = '1' THEN

CASE(avs_s0_address) IS

WHEN '0' => avs_s0_readdata <= x"0f0ff0f0";

WHEN '1' => avs_s0_readdata <= x"0f0fffff";

WHEN others => avs_s0_readdata <= x"00000000";

END CASE;

ELSE avs_s0_readdata <= x"00000000";

END IF;

END PROCESS;

The way I access data from the HPS is as below,

# define COUNT 0xFF200020 //Avalon base Addrs +counter base Addrsint

main(void){

volatile int * Count_ptr = (int *) COUNT;

unsigned int cnt, ex;

while(1) {

cnt = *(Count_ptr);

ex = *(Count_ptr+1);

printf("count = %d \n",cnt);

printf("count = %d \n",ex );

}

}

0down votefavorite (http://stackoverflow.com/questions/43377035/read-data-from-the-fpga-ip-to-the-hps-in-altera-soc-fpga#)

I am trying to access data from hps via Avalon memory mapping interface. I have put together system in qsys and assigned base address. In below code the I got the count value in 1st 32 bit std_logic_vector (count) data to the HPS. But I didn't get the data in second 32 bit std_logic_vector (count_n)

No RepliesBe the first to reply