Problem communicating between IP and PPC virtex ml403

Discussion in 'Embedded Systems and Microcontrollers' started by khan990, Jan 4, 2014.

  1. khan990

    Thread Starter New Member

    Oct 27, 2009
    1
    0
    Hi Everyone!
    I am trying to simulate a chemical reaction in FPGA.

    My basic FPGA architecure consists of 3 processes:
    Code ( (Unknown Language)):
    1.  
    2. -- Synchronous Process
    3. --Purely Synchronous with asynchronous SET or RESET
    4. IGNITE : PROCESS(clk, reset)
    5. begin
    6. IF( reset = '1' ) THEN --Synchronous Reset
    7. Current_State <= ASSIGN_VARS;
    8. ELSIF (clk'event AND clk = '1') THEN --Rising edge of Clock
    9. Current_State <= Next_State;
    10. END IF;
    11. END PROCESS IGNITE;
    12.  
    13.  
    14. CIRCUIT : PROCESS(Current_State,
    15. -- And all other sensitivity list signals
    16. ) -- include the one read.
    17. BEGIN
    18. CASE Current_State IS
    19.         WHEN ASSIGN_VARS =>
    20.                    -- LONG 3000 lines of code here
    21.                    -- see the attached file
    22. END CASE;
    23. END PROCESS CIRCUIT;
    24.  
    25. --Purely Synchronous with asynchronous SET or RESET
    26. INITIALIZE : PROCESS(clk, reset)
    27. BEGIN
    28. IF(reset = '1') THEN
    29. glucose_reg <= zeros27;
    30. ATP_reg <= zeros27;
    31. glucose_6_phosphate_reg <= zeros27;
    32. ADP_reg <= zeros27;
    33. fructose_6_phosphate_reg <= zeros27;
    34. fructose_1_6_bisphosphate_reg <= zeros27;
    35. dihydroxyacetone_phosphate_reg <= zeros27;
    36. glyceraldehyde_3_phosphate_reg <= zeros27;
    37. bisphosphoglycerate_1_3_reg <= zeros27;
    38. phosphoglycerate_3_reg <= zeros27;
    39. phosphoglycerate_2_reg <= zeros27;
    40. phosphoenolpyruvate_reg <= zeros27;
    41. pyruvate_reg <= zeros27;
    42. Pi_reg <= zeros27;
    43. H2O_reg <= zeros27;
    44. NAD_reg <= zeros27;
    45. NADH_reg <= zeros27;
    46. H_reg <= zeros27;
    47. --BRAM
    48. ADDRESS_A_reg <= zeros10;
    49. DATA_IN_reg <= zeros27;
    50. --
    51. SAVE_DATA_reg <= zeros10;
    52. TEMP_reg <= zeros5;
    53. IN_REACTIONS_reg <= B"0";
    54. TEMP_STATE_reg <= ASSIGN_VARS;
    55. ELSIF(clk'event AND clk = '1') THEN
    56. glucose_reg <= glucose_sig;
    57. ATP_reg <= ATP_sig;
    58. glucose_6_phosphate_reg <= glucose_6_phosphate_sig;
    59. ADP_reg <= ADP_sig;
    60. fructose_6_phosphate_reg <= fructose_6_phosphate_sig;
    61. fructose_1_6_bisphosphate_reg <= fructose_1_6_bisphosphate_sig;
    62. dihydroxyacetone_phosphate_reg <= dihydroxyacetone_phosphate_sig;
    63. glyceraldehyde_3_phosphate_reg <= glyceraldehyde_3_phosphate_sig;
    64. bisphosphoglycerate_1_3_reg <= bisphosphoglycerate_1_3_sig;
    65. phosphoglycerate_3_reg <= phosphoglycerate_3_sig;
    66. phosphoglycerate_2_reg <= phosphoglycerate_2_sig;
    67. phosphoenolpyruvate_reg <= phosphoenolpyruvate_sig;
    68. pyruvate_reg <= pyruvate_sig;
    69. Pi_reg <= Pi_sig;
    70. H2O_reg <= H2O_sig;
    71. NAD_reg <= NAD_sig;
    72. NADH_reg <= NADH_sig;
    73. H_reg <= H_sig;
    74. --BRAM
    75. ADDRESS_A_reg <= ADDRESS_A_sig;
    76. DATA_IN_reg <= DATA_IN_sig;
    77. --
    78. SAVE_DATA_reg <= SAVE_DATA;
    79. TEMP_reg <= TEMP_sig;
    80. TEMP_STATE_reg <= TEMP_STATE_sig;
    81. IN_REACTIONS_reg <= IN_REACTIONS_sig;
    82. END IF;
    83. END PROCESS INITIALIZE;
    84.  
    I can communicate with this IP from PPC but in a very strange way.
    Code ( (Unknown Language)):
    1.  
    2. #include "xmk.h"
    3. #include "sys/init.h"
    4. #include "platform.h"
    5. #include <stdio.h>
    6. #include <string.h>
    7. #include "platform.h"
    8. #include "xparameters.h"
    9. #include "xbasic_types.h"
    10. #include "xstatus.h"
    11. #include "xgpio.h"
    12. #include "source.h"
    13. #include <sys/timer.h>
    14. #include "checkppc6.h"
    15.  
    16. #include <stdio.h>
    17. Xuint32 *baseaddr_p = (Xuint32 *)XPAR_CHECKPPC6_0_BASEADDR;
    18. int main()
    19. {
    20. init_platform();
    21. XASSERT_NONVOID(baseaddr_p != XNULL);
    22. baseaddr = (Xuint32)baseaddr_p;
    23. CHECKPPC6_mReset(baseaddr);
    24. CHECKPPC6_mResetReadFIFO(baseaddr);
    25. CHECKPPC6_mResetWriteFIFO(baseaddr);
    26.  
    27. CHECKPPC6_mWriteToFIFO(baseaddr, 0, 0xffffffff); // activate signal
    28.  
    29. DataFPGA = CHECKPPC6_mReadFromFIFO(baseaddr, 0);
    30.  
    31. }
    32.  
    I donot see the initial value from FPGA IP until I send an empty useless value to IP input (which is CHECKPPC6_mWriteToFIFO(baseaddr, 0, 0xffffffff); // activate signal). In my view a simple software reset (CHECKPPC6_mReset) should have initialized the IP and given me the output value I assign in ASSIGN_VARS case of my IP.

    My IP design is such that. IP asks the input of chemical molecules. then perform reaction and wait for ACK signal from PPC to continue with the next round.

    But the problems I face are. I have to (CHECKPPC6_mWriteToFIFO(baseaddr, 0, 0xffffffff); // activate signal) for no intuitive reason. Then when I provide ACK signal, IP doesnt move on to start Reaction again untill I provide another dummy input (CHECKPPC6_mWriteToFIFO(baseaddr, 0, 0xffffffff); // activate signal).

    I believe next_state doesnot get updated, which is why it happens, can you guys please help me with this and suggest a solution.

    please see attached files for more info.


    https://drive.google.com/file/d/0BxVHCJ7JxzSDa3lHb3YxdmhTLTA/edit?usp=sharing
     
Loading...