Forum Discussion
VHDL-Code with Avalon Bus Interface-/ and VHDL-Video-System-Interface-Ports
Hello
I provided the following ENTITY. Can I actually provide a IP, which some haven connectivity with the Avalon bus, as well as haven as down descriptive for the VHDL_Detector, which is not connected with the Avalon bus, but with the video system, which was evenly not provided in SopC? We provide as it were 2 different systems, the Video_System as own symbol and the SopC system also as own symbol. These 2 different systems can communicate however by the VHDL_Detector via Avalon bus with one another. -- VHDL_Detector Clock interface iVGA_CLK : in std_logic; iRST_N : in std_logic; -- VHDL_Detector of In-haven iVGA_R : in std_logic_vector (9 downto 0); iVGA_VS : in std_logic; This haven are connected with the video system. -- Avalon Clock interface csi_clock : in std_logic; csi_reset : in std_logic; -- Avalon mm of interfaces/Slave haven avs_write : in std_logic; avs_writedata : in std_logic_vector (31 downto 0); avs_read : in std_logic; avs_readdata : out std_logic; avs_dataavailable : out std_logic; avs_byteenable : in std_logic_vector (3 downto 0) This haven are connected with the SopC. ********************************************************************************** ENTITY ime_avalon_xy_detector IS PORT ( -- VHDL_Detector Clock Interface iVGA_CLK : in std_logic; iRST_N : in std_logic; -- VHDL_Detector IN-Ports iVGA_R : in std_logic_vector(9 downto 0); iVGA_VS : in std_logic; -- Avalon Clock Interface csi_clock : in std_logic; csi_reset : in std_logic; -- Avalon-MM Interface / Slave Port avs_write : in std_logic; avs_writedata : in std_logic_vector(31 downto 0); avs_read : in std_logic; avs_readdata : out std_logic; avs_dataavailable : out std_logic; avs_byteenable : in std_logic_vector(3 downto 0) ); END ENTITY ime_avalon_xy_detector;15 Replies
- Altera_Forum
Honored Contributor
>> -- VHDL_Detector Clock interface
>> iVGA_CLK : in std_logic; >> iRST_N : in std_logic; >> -- VHDL_Detector of In-haven >> iVGA_R : in std_logic_vector (9 downto 0); >> iVGA_VS : in std_logic; >> >> This haven are connected with the video system. or can I declare this ports as conduit-ports and make a connection from the SopC-Symbol to the Video-System-Symbol? The goal to make this connectivity, is to send a xy-cordinate from a object-detection to a steppmotor controller via SPI in SopC. Thanks for any answer..... :) - Altera_Forum
Honored Contributor
- Altera_Forum
Honored Contributor
In general, you have part of your component that attaches to the sopc system via some avalon style bus, and then you have the other part that are defined in the *_hw.tcl file as conduits. Just define everything you want to connect not in the sopc system as conduits and hook them up outside of the sopc generated block. Give it a try and see what happens.
- Altera_Forum
Honored Contributor
Hello,
Thans for the answer. I realize a IP, you see this in the .zip-file below. In the NiosII I have write a simply test-code for send any data via avalon-slave bus and after read the data again. In the example I send the data= 0xF0F0F0F0, but I receive the follow: Der gelesene Wert ist: -252645136 The code in NiosII is: # include "NiosII_Camera_Tracking.h" int main(void) { alt_u32 daten= 0xF0F0F0F0; IOWR_IME_AVALON_XY_DETECTOR_DATA(XY_DETECTOR_BASE, daten); printf("Der gelesene Wert ist: %i\n", IORD_IME_AVALON_XY_DETECTOR_DATA(XY_DETECTOR_BASE)); } Could you test the IP-Block and say me what is the problem? Thank you... - Altera_Forum
Honored Contributor
change the print statement to :
printf("Der gelesene Wert ist: %x\n", IORD_IME_AVALON_XY_DETECTOR_DATA(XY_DETECTOR_BASE) ); you were reading an unsigned int as a signed int. -252645136 is equal to 0xF0F0F0F0; Kevin - Altera_Forum
Honored Contributor
thanks a lot, it works well now...
:D:D:D:D - Altera_Forum
Honored Contributor
I have another question:
I would like read the xy-coordinate only when a new frame is coming and the vhdl-hardware have calculate the new coordinate. I think to make this as follow: I implement a avs_dataavailable in the ip-block, when a new calulation is down, a set the avs_dataavailable to H. But how is the syntax in NiosII to make this if-statment? Thanks for any tipps.... - Altera_Forum
Honored Contributor
you don't want to use the avs_dataavailable signal. Either create an interrupt that is triggered on the new state, or create a register you can read/poll that has the status of the new coordinate state that can be cleared when you read it. i have never used the dataavailable signal, but if you were to use the avalone bus to indicate when data was ready to read you would have to issue a read and the bus would hang until the new coordinate was present, which is most likely not what you want.
Kevin - Altera_Forum
Honored Contributor
do you mean so for example:
dataavailable = IORD_IME_AVALON_XY_DETECTOR_CONTROL(XY_DETECTOR_BASE, 1) if(dataavailable) { coordinate= IORD_IME_AVALON_XY_DETECTOR_DATA(XY_DETECTOR_BASE, 0) } and the reg.h: # define IOADDR_IME_AVALON_XY_DETECTOR_DATA(base, offset) __IO_CALC_ADDRESS_NATIVE(base, 0) # define IOWR_IME_AVALON_XY_DETECTOR_DATA(base, offset, data) IOWR(base, 0, data) # define IORD_IME_AVALON_XY_DETECTOR_DATA(base, offset) IORD(base, 0) # define IOADDR_IME_AVALON_XY_DETECTOR_CONTROL(base, offset) __IO_CALC_ADDRESS_NATIVE(base, 1) # define IOWR_IME_AVALON_XY_DETECTOR_CONTROL(base, offset, data) IOWR(base, 1, data) # define IORD_IME_AVALON_XY_DETECTOR_CONTROL(base, offset) IORD(base, 1) . . . here MSK and any OFST . . . Antonio - Altera_Forum
Honored Contributor
another question:
How I can differentiate in the vhdl-file in where Signal I wont write or read, when I use two register for DATA and CONTROL specificate in the reg.h? I have only a avs_writedata in the vhdl-file....:confused: