UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Visitor mohamad_7
Visitor
3,947 Views
Registered: ‎04-12-2008

read/write slave register in PPC405

I have 2 slave registers. I write into register (slv_reg0). This register is read by my IP ( it is just 2 DFF connected in series)  output from MY IP is stored in the other register (slv_reg1) ... my problem is i cant write in the slv_reg0 so my IP can read any input hence my slv_reg1 doesnt receive any input therefore it remains 0

 

my logic code is ....

 

 

 

component top is port(d, clk:in std_logic; q:out std_logic); end component; begin --USER logic implementation added here dff1 : top port map (q => slv_reg0(0), clk => clk_top, q => slv_reg1(0)); slv_reg_write_select <= Bus2IP_WrCE(0 to 1); slv_reg_read_select <= Bus2IP_RdCE(0 to 1); slv_write_ack <= Bus2IP_WrCE(0) or Bus2IP_WrCE(1); slv_read_ack <= Bus2IP_RdCE(0) or Bus2IP_RdCE(1); implement slave model register(s) SLAVE_REG_WRITE_PROC : process( Bus2IP_Clk ) is begin if Bus2IP_Clk'event and Bus2IP_Clk = '1' then if Bus2IP_Reset = '1' then slv_reg0 <= (others => '0'); -- slv_reg1 <= (others => '0'); else case slv_reg_write_select is when "10" => for byte_index in 0 to (C_DWIDTH/8)-1 loop if ( Bus2IP_BE(byte_index) = '1' ) then slv_reg0(byte_index*8 to byte_index*8+7) <= Bus2IP_Data(byte_index*8 to byte_index*8+7); end if; end loop; -- when "01" => -- for byte_index in 0 to (C_DWIDTH/8)-1 loop -- if ( Bus2IP_BE(byte_index) = '1' ) then -- slv_reg1(byte_index*8 to byte_index*8+7) <= Bus2IP_Data(byte_index*8 to byte_index*8+7); -- end if; -- end loop; when others => null; end case; end if; end if; end process SLAVE_REG_WRITE_PROC; -- implement slave model register read mux SLAVE_REG_READ_PROC : process( slv_reg_read_select, slv_reg0, slv_reg1 ) is begin case slv_reg_read_select is when "10" => slv_ip2bus_data <= slv_reg0; when "01" => slv_ip2bus_data <= slv_reg1; when others => slv_ip2bus_data <= (others => '0'); end case; end process SLAVE_REG_READ_PROC; **************************************** my C code is // Located in: ppc405_0/include/xparameters.h #include "xparameters.h" #include "dff.h" //==================================================== int main (void) { int j; for(j=0;j<10;j++) { DFF_mWriteSlaveReg0(XPAR_DFF_0_BASEADDR, 1); long d_s = DFF_mReadSlaveReg0(XPAR_DFF_0_BASEADDR); long q = DFF_mReadSlaveReg1(XPAR_DFF_0_BASEADDR); printf ("----------------- \n"); printf ("q = %x \n",q); printf ("d = %x \n",d_s); sleep(1); } return 0; }

 

 

 

0 Kudos
1 Reply
Visitor jralph
Visitor
3,745 Views
Registered: ‎12-03-2008

Re: read/write slave register in PPC405

How does is simulate for you? Or if you're jumping straight onto the chip without verification, if you change the reset value of slv_reg0/1 are you able to read the registers as you would expect? You should be able to use the C IDE's memory monitor and see the reset values and also read/modify registers with the monitor or C.

 

Are you connecting your IP up using XPS?  Not sure what automagic XPS is doing these days -- do you need the bus ports in your component def?  I would be sure to register all outputs.

 

To simplify things you could assume each register access is a 32bit aligned word.

0 Kudos