vgs
Junior Member level 1
hi all,
can anyone please help me?
I'm trying to add a custom IP to the EDK.Its just a comparison program, i.e., to compare the input with four values stored as four different signals and if the input is similar to any one of the input, then give the output as 00 or 01 or 10 or 11.
this is the Vhdl program for that:
library ieee;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity network is
port (clk:in std_logic;
input:in std_logic_vector(31 downto 0);
outputut std_logic_vector(1 downto 0));
end network;
architecture Behavioral of network is
signal t,r,c,s:std_logic_vector(31 downto 0);
begin
process(clk)
begin
s<="11111111000000001010101001010101";
t<="11111011111000000000100101100101";
r<="11111100000000000101011010101010";
c<="11101111001100000100011010011010";
if (clk'event and clk = '1') then
if(input=s) then
output<="00";
elsif(input=t) then
output<="01";
elsif(input=r) then
output<="10";
elsif(input=c) then
output<="11";
end if;
end if;
end process;
end Behavioral;
This program is added as an IP to the EDK with the name "my_network" using "create or import peripheral wizard" using "read/write FIFO".
After adding it as an IP, inorder to input the value and obtain the output,I wrote the application in SDK.
This is the code I've writtn in SDK:
#include "xparameters.h"
#include "xbasic_types.h"
#include "xstatus.h"
#include "my_network.h"
Xuint32 *baseaddr_p = (Xuint32 *)XPAR_MY_NETWORK_0_BASEADDR;
int main (void)
{
Xuint32 i;
Xuint32 temp,check;
Xuint32 baseaddr;
// Clear the screen
xil_printf("%c[2J",27);
// Check that the peripheral exists
XASSERT_NONVOID(baseaddr_p != XNULL);
baseaddr = (Xuint32) baseaddr_p;
xil_printf("Recognition Test\n\r");
// Reset read and write packet FIFOs to initial state
MY_NETWORK_mResetWriteFIFO(baseaddr);
MY_NETWORK_mResetReadFIFO(baseaddr);
// Push data to write packet FIFO
//temp=0xFC0056AA; //these are the four values which are given as input
temp=0xEF30469A;
//temp=0xfF00AA55;
//temp=0xFBE00965;
MY_NETWORK_mWriteToFIFO(baseaddr,0, temp);
xil_printf("Wrote: 0x%08x \n\r", temp);
// pop data out from read packet FIFO
temp = MY_NETWORK_mReadFromFIFO(baseaddr,0);
xil_printf("Read: 0x%08x \n\r", temp);
if (temp==02)
xil_printf("The given shape is Rectangle\n\r");
else if (temp==00)
xil_printf("The given shape is Square\n\r");
else if (temp==01)
xil_printf("The given shape is triangle\n\r");
else if (temp==03)
xil_printf("The given shape is circle\n\r");
// Reset the read and write FIFOs
MY_NETWORK_mResetWriteFIFO(baseaddr);
MY_NETWORK_mResetReadFIFO(baseaddr);
xil_printf("End of test\n\n\r");
}
but the problem is that, for all the values I'm getting only 00 as the output.
Can you please help me.Sorry if I'm disturbing you in your busy schedule
Thanks in advance
vgs
can anyone please help me?
I'm trying to add a custom IP to the EDK.Its just a comparison program, i.e., to compare the input with four values stored as four different signals and if the input is similar to any one of the input, then give the output as 00 or 01 or 10 or 11.
this is the Vhdl program for that:
library ieee;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
entity network is
port (clk:in std_logic;
input:in std_logic_vector(31 downto 0);
outputut std_logic_vector(1 downto 0));
end network;
architecture Behavioral of network is
signal t,r,c,s:std_logic_vector(31 downto 0);
begin
process(clk)
begin
s<="11111111000000001010101001010101";
t<="11111011111000000000100101100101";
r<="11111100000000000101011010101010";
c<="11101111001100000100011010011010";
if (clk'event and clk = '1') then
if(input=s) then
output<="00";
elsif(input=t) then
output<="01";
elsif(input=r) then
output<="10";
elsif(input=c) then
output<="11";
end if;
end if;
end process;
end Behavioral;
This program is added as an IP to the EDK with the name "my_network" using "create or import peripheral wizard" using "read/write FIFO".
After adding it as an IP, inorder to input the value and obtain the output,I wrote the application in SDK.
This is the code I've writtn in SDK:
#include "xparameters.h"
#include "xbasic_types.h"
#include "xstatus.h"
#include "my_network.h"
Xuint32 *baseaddr_p = (Xuint32 *)XPAR_MY_NETWORK_0_BASEADDR;
int main (void)
{
Xuint32 i;
Xuint32 temp,check;
Xuint32 baseaddr;
// Clear the screen
xil_printf("%c[2J",27);
// Check that the peripheral exists
XASSERT_NONVOID(baseaddr_p != XNULL);
baseaddr = (Xuint32) baseaddr_p;
xil_printf("Recognition Test\n\r");
// Reset read and write packet FIFOs to initial state
MY_NETWORK_mResetWriteFIFO(baseaddr);
MY_NETWORK_mResetReadFIFO(baseaddr);
// Push data to write packet FIFO
//temp=0xFC0056AA; //these are the four values which are given as input
temp=0xEF30469A;
//temp=0xfF00AA55;
//temp=0xFBE00965;
MY_NETWORK_mWriteToFIFO(baseaddr,0, temp);
xil_printf("Wrote: 0x%08x \n\r", temp);
// pop data out from read packet FIFO
temp = MY_NETWORK_mReadFromFIFO(baseaddr,0);
xil_printf("Read: 0x%08x \n\r", temp);
if (temp==02)
xil_printf("The given shape is Rectangle\n\r");
else if (temp==00)
xil_printf("The given shape is Square\n\r");
else if (temp==01)
xil_printf("The given shape is triangle\n\r");
else if (temp==03)
xil_printf("The given shape is circle\n\r");
// Reset the read and write FIFOs
MY_NETWORK_mResetWriteFIFO(baseaddr);
MY_NETWORK_mResetReadFIFO(baseaddr);
xil_printf("End of test\n\n\r");
}
but the problem is that, for all the values I'm getting only 00 as the output.
Can you please help me.Sorry if I'm disturbing you in your busy schedule
Thanks in advance
vgs