+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Member level 1
    Points: 409, Level: 4

    Join Date
    Jul 2017
    Posts
    38
    Helped
    0 / 0
    Points
    409
    Level
    4

    Altera Quartus: How to write and read the data into FIFO ?

    Hello,

    I am running 32-bit counter in Quartus. I have used the PIO to read the data but i am facing the problem, data is not in sequence in which PIO receiving the data slowly from FPGA. So, i think FIFO is best to store and read the data in NIOS.

    I am new to the altera, please anyone share the FIFO example design or else guide me in FIFO design.

    I have attached the Screenshot of the design in which i have used PIO.
    https://forums.intel.com/s/question/...mail=1&s1ext=0

    •   AltAdvertisment

        
       

  2. #2
    Advanced Member level 5
    Points: 12,806, Level: 27
    Achievements:
    7 years registered

    Join Date
    Aug 2011
    Posts
    2,577
    Helped
    300 / 300
    Points
    12,806
    Level
    27

    Re: Altera Quartus: How to write and read the data into FIFO ?

    What if the Nios is always slower (or faster) at reading the data compared to you supplying it with new data?
    Simply using a FIFO won't suffice in such a case.
    You'll also have to monitor the FIFOs flags...

    If the purpose of your project is simply to see things working - you don't have to design your own FIFO. Just generate one via the IP catalog wizard.



  3. #3
    Member level 5
    Points: 598, Level: 5
    Achievements:
    Created Blog entry

    Join Date
    Apr 2018
    Location
    Gdańsk, Poland
    Posts
    90
    Helped
    19 / 19
    Points
    598
    Level
    5
    Blog Entries
    3

    Re: Altera Quartus: How to write and read the data into FIFO ?

    I can tell you only what this should be done in Xilinx's software/chip.
    I would suggest to create AXI FIFO and connect it to the CPU (hard or soft CPU). Then export hardware to the SDK, where you should find .h, .c and test.c files in BSP (Board Support Package).
    Then the app in CPU depends on what you want to do.
    If you want to read FIFO content in CPU, then check for empty flag and read from FIFO all the time until empty='1'. The FPGA design is complementary for write.
    If you want to write to FIFO in CPU, then check for full flag and write to FIFO all the time until full='1'. The FPGA design is complementary for read.
    To encourage me to help more, click on "Helpful Post" if you feel that I've helped you.



  4. #4
    Advanced Member level 5
    Points: 36,811, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,717
    Helped
    1961 / 1961
    Points
    36,811
    Level
    46

    Re: Altera Quartus: How to write and read the data into FIFO ?

    Quote Originally Posted by niciki View Post
    I can tell you only what this should be done in Xilinx's software/chip.
    I would suggest to create AXI FIFO and connect it to the CPU (hard or soft CPU). Then export hardware to the SDK, where you should find .h, .c and test.c files in BSP (Board Support Package).
    Then the app in CPU depends on what you want to do.
    If you want to read FIFO content in CPU, then check for empty flag and read from FIFO all the time until empty='1'. The FPGA design is complementary for write.
    If you want to write to FIFO in CPU, then check for full flag and write to FIFO all the time until full='1'. The FPGA design is complementary for read.
    It should be similar for Altera, but using Avalon instead.



    •   AltAdvertisment

        
       

  5. #5
    Member level 1
    Points: 409, Level: 4

    Join Date
    Jul 2017
    Posts
    38
    Helped
    0 / 0
    Points
    409
    Level
    4

    Re: Altera Quartus: How to write and read the data into FIFO ?

    Counter Implementation: Using SOPC and NIOS,

    I am new to the Altera Quartus software tool.So Please anyone guide me to accomplish my task.

    Design Process involves:
    1. Need to compile 8-bit, or 32-bit or 64-bit counter in Quartus

    2. Interconnect the counter module with NIOS using SOPC

    3. Want to see counter result in NIOS console



    1. Need to compile 8-bit, or 32-bit or 64-bit counter in Quartus

    2. Interconnect the counter module with NIOS using SOPC

    3. Want to see counter result in NIOS console

    For above design, i Have followed the below step but in NIOS data is not printing in proper sequence (randomly printing). I dont know why ?
    VERILOG code
    Code:
    odule counter
     
    (
    	input clk, enable, rst_n,
    	output  reg[7:0] count
    );
     
    	always @ (posedge clk or negedge rst_n)
    	begin
    		if (~rst_n)
    			count <= 0;
    		else if (enable == 1'b1)
    			count <= count + 1;
    	end
     
    endmodule
    TOP MODULE
    Code:
     module Counter_Top_Level_design   
     (
    	input				clk,
    	input				rst_n,
    	output [7:0]	out
    	
    );
     
    wire counter_enable;
     
     
    counter counter_inst (
    		.clk			( clk ),
    		.rst_n		( rst_n ),
    		.enable		( counter_enable ),
    		.count		( out )
    	);
     
    // For simulation, use this instantiation:
    NIOS_SYSTEM niosii_system_inst (
    		.clk_clk           ( clk ),					//        clk.clk
    		.reset_reset_n     ( rst_n ),					//      reset.reset_n
    		.enable_external_connection_export ( counter_enable ),		// output_pio.export
    		.cout_export ( out )
    	);
    	
    endmodule
    I have uploaded Qsys design too. Enable : PIO 1-bit (Output) and cout_export : PIO 8-bit Input
    Click image for larger version. 

Name:	qsys.JPG 
Views:	1 
Size:	165.3 KB 
ID:	148895

    - - - Updated - - -

    How to write data into FIFO using Verilog module (verilog instantiation) by using ready and valid signals.



  6. #6
    Member level 5
    Points: 598, Level: 5
    Achievements:
    Created Blog entry

    Join Date
    Apr 2018
    Location
    Gdańsk, Poland
    Posts
    90
    Helped
    19 / 19
    Points
    598
    Level
    5
    Blog Entries
    3

    Re: Altera Quartus: How to write and read the data into FIFO ?

    Lazy, lazy lazy!
    Read the documentation of the FIFO, then you will know how to write data into it.
    Last edited by niciki; 7th September 2018 at 08:31.
    To encourage me to help more, click on "Helpful Post" if you feel that I've helped you.



  7. #7
    Member level 1
    Points: 409, Level: 4

    Join Date
    Jul 2017
    Posts
    38
    Helped
    0 / 0
    Points
    409
    Level
    4

    Re: Altera Quartus: How to write and read the data into FIFO ?

    Hello

    According to FIFO Memory document, i have added FIFO IP in QSYS and generated as block diagram.

    Please look over the Quartus block diagram , For FIFO_out_read how i can set constant value '0' or '1' , and what i need to assign to FIFO wait_request.

    Anyone please clarify me.



  8. #8
    Advanced Member level 5
    Points: 36,811, Level: 46
    Achievements:
    7 years registered

    Join Date
    Jun 2010
    Posts
    6,717
    Helped
    1961 / 1961
    Points
    36,811
    Level
    46

    Re: Altera Quartus: How to write and read the data into FIFO ?

    connect it to VCC



    •   AltAdvertisment

        
       

  9. #9
    Member level 1
    Points: 409, Level: 4

    Join Date
    Jul 2017
    Posts
    38
    Helped
    0 / 0
    Points
    409
    Level
    4

    Re: Altera Quartus: How to write and read the data into FIFO ?

    Quote Originally Posted by TrickyDicky View Post
    connect it to VCC
    ok.. what about wait request signal? where should I connect?



--[[ ]]--