FPGA study notes _ROM core call and debugging

FPGA study notes

ROM core call and debugging

1. ROM存储器IP核的使用
2. 创建.mif文件
3. In system memory content editor内存查看工具的使用
4. Signal tapII工具使用
5. Verilog 代码
6. Modelsim仿真
7. FPGA板级验证

ROM core call and debugging

  • Goal: call the ROM core provided in the Quartus software and perform system design
  • Phenomenon: A set of data (triangular waveform table) is stored in the on-chip rom built with the IP core in the FPGA. After the development board is powered on, the system starts to read data from the rom and outputs the data directly through the parallel port. Capture the data of the parallel port in real time through the signal tap II software and display it (triangular waveform). Then use the in system memory content editor tool provided in the quartus software to change the data (sine waveform) in the rom online, and then observe the waveform data captured by the signal tapII tool again
  • Knowledge points:
  1. Use of ROM memory IP core
    Create .mif file
  2. Use of In system memory content editor memory viewing tool
  3. The Signal tapII tool uses
    an embedded logic analyzer/on-chip logic analyzer, which can directly capture chip node data or external IO port data, and connect to the PC through the JTAG port. The quaturs software on the PC provides the signal tap II software, which communicates with the on-chip logic analyzer through the JTAG line, and sends the node information in the design captured by the on-chip logic analyzer to the PC in real time, and the PC uses the singal Tap II The software displays the data.

Insert picture description here

1. The use of ROM memory IP core

  • (1). IP Catalog, search for ROM, double-click ROM: 1-port, set data width, rom memory and other information according to requirements, click next

Insert picture description here

  • (2). Select the register port according to your needs, click next

Insert picture description here

  • (3). Select the .mif file and click next

Insert picture description here

  • (4). Click next

Insert picture description here

  • (5). Click finish

Insert picture description here

  • (6). Generate .qip file, right click, set as top level entity, analysis and synthesis

Insert picture description here

  • (7). Writing testbench, simulation verification function

2. Create .mif file

  • (1). Create a new file, select memory initialization file, and click OK

Insert picture description here

  • (2). Set the bit width and memory depth, click OK to generate the following file

Insert picture description here
Insert picture description here

  • (3). After changing the memory value as required, click file, save as, set the name, save the .mif file in the project folder, and the .mif file setting is complete

Insert picture description here
Insert picture description here


3. Use of in system memory content editor memory viewing tool

  • (1). tool–>in system memory content editor

Insert picture description here

  • (2). The following interface is displayed, click read to read the data in the rom

Insert picture description here

  • (3). Right click on rom and select import data from file

Insert picture description here

  • (4). Select the edited .mif file and click open

Insert picture description here

  • (5). Click Write, the data in the file will be written into the rom

Insert picture description here

  • (6). The written data is displayed in signal tapII

Insert picture description here


4. Use signal tapII tool

  • (1). To create a new file, click signal tap logic analyzer file

Insert picture description here

  • (2). Add clk signals in order

Insert picture description here

  • (3). Add signals to be observed in order

Insert picture description here

  • (4). After the setting is completed, click file, after setting the name and path, save

Insert picture description here

  • (5). According to the design, set the depth of the storage area and generate the .stp file

Insert picture description here

  • The logic analyzer ensures that the sampling clock is higher than the rate of the signal to be sampled
  • Sample depth: The depth of the
    memory. The captured data is equivalent to an internal memory. Continuous capture requires observation data. Because the speed is very fast, all the data to be observed must be stored in the memory first, and then from the memory Send it to the computer via the JTAG cable for real-time display; otherwise, because the JTAG itself is not very high speed, it is impossible to transmit 50MHz directly sampled data, use this storage method to reduce the speed

Insert picture description here

  • (6). Run the logic analyzer in the following order

Insert picture description here

  • (7). Continuous real-time detection data

Insert picture description here

  • (8). Set the real-time data format to line graph display, the shape is as follows

Insert picture description here
Insert picture description here


5. Verilog code

//----top---------------------------------------
module rom_top(

	input clk,
	input rst_n,
	output [7:0] q
);

	reg [7:0] addr;

rom uut(
		.address(addr),
		.clock(clk),
		.q(q)
	);

	always@(posedge clk or negedge rst_n)
		if(!rst_n)
			addr <= 8'd0;
		else
			addr <= addr + 8'd1;
endmodule

//----testbench------------------------------
`timescale 1ns/1ns
`define clock_period 20

module tb_rom;
	reg clk;
	reg [7:0] addr;
	wire [7:0] q;

	rom uut(
		.address(addr),
		.clock(clk),
		.q(q)
	);
	integer i;
	initial clk = 1;
	always #(`clock_period/2) clk = ~clk;
	
	initial begin
		addr =8'd0;
		for(i=0;i<2550; i=i+1)begin
		#(`clock_period);
		addr = addr + 8'd1;
		end
		#(`clock_period*50);
		$stop;
	end
endmodule


6. Modelsim simulation

  • Simulation waveform debugging
    Right-click the signal, select format–>analog (automatixc), and convert the signal value to an analog valueInsert picture description here

  • Triangle waveform

Insert picture description here

  • Sine wave

Insert picture description here

4. FPGA board-level verification

  • The waveform is converted from a triangle to a sine shape

Insert picture description here

Insert picture description here


[Note]: Personal study notes, if there are any mistakes, please feel free to enlighten me. This is polite~~~


Guess you like

Origin blog.csdn.net/weixin_50722839/article/details/109960391