博文

目前显示的是标签为“FPGA”的博文

How to burn jic files into FPGA?

图片
 A .jic file is most commonly an Intel/Altera Quartus “JTAG Indirect Configuration” image used to program the external configuration flash (EPCS/EPCQ/QSPI) through the FPGA’s JTAG , so the FPGA can boot from flash after reset/power-cycle. 0) Quick clarity: .SOF vs .JIC .sof → programs the FPGA directly (volatile). Works immediately, lost on power-off. .jic → programs the configuration flash (non-volatile). FPGA loads from flash on reboot. A) Program a .JIC into the flash (Quartus GUI) 1) Hardware + board setup Connect USB-Blaster / USB-Blaster II (or compatible) to the board’s JTAG header. Power the board. Set any board jumpers/switches to allow JTAG access (varies by board). 2) Open Quartus Programmer Tools → Programmer Click Hardware Setup… Select your cable (e.g., USB-Blaster ), then Close Set Mode = JTAG 3) Detect the JTAG chain Click Auto Detect Quartus should show your FPGA device in the chain. 4) Attach the flash de...

Detailed Discussion on IIC Communication Protocol of FPGA

图片
 “IIC” and “I²C” are the same 2-wire serial bus. In an FPGA you typically implement it as a bit-accurate state machine plus open-drain bidirectional I/O control . Below is a detailed, practical discussion (master + slave), with the stuff that usually trips people up. 1) I²C fundamentals (what the bus really is) Two wires, open-drain, “wired-AND” SCL = clock SDA = data Devices never drive a ‘1’ . They either: drive low (0) , or release the line (Z) so an external pull-up resistor makes it high. Because low is dominant, multiple devices can share the bus safely. Start/Stop are special conditions (not “bytes”) START (S): SDA goes 1→0 while SCL is high STOP (P): SDA goes 0→1 while SCL is high Repeated START (Sr): a START without a STOP in between (common for register reads) Data validity rule (the golden rule) SDA must be stable when SCL is high SDA is allowed to change only when SCL is low Receiver samples SDA on SCL rising edge...

What is FPGA XDC?

图片
 An FPGA XDC is a Xilinx Design Constraints file (extension .xdc ) used in Vivado to tell the tools how your design must be connected and timed . Think of it as the “rules + wiring map” for implementation. What an XDC file contains 1) Pin assignments (physical I/O mapping) Maps your top-level ports to FPGA package pins and sets I/O standards. Example: set_property PACKAGE_PIN W5 [get_ports {clk}] set_property IOSTANDARD LVCMOS33 [get_ports {clk}] 2) Timing constraints (so timing analysis is correct) Defines clocks and timing relationships. Example: create_clock -period 10.000 [get_ports clk] ;# 100 MHz You can also constrain: input/output delays ( set_input_delay , set_output_delay ) clock uncertainty, generated clocks, false paths, multicycle paths, etc. 3) I/O electrical constraints Sets things like: IOSTANDARD (LVCMOS33, LVDS, SSTL, etc.) drive strength ( DRIVE ) slew rate ( SLEW FAST/SLOW ) pullups/pulldowns ( PULLUP , PULLDOWN ) 4) Ot...

Verilog Functions and Task Usage in FPGA Development

图片
 In Verilog (and SystemVerilog), functions and tasks are both ways to package reusable logic—but they’re meant for different kinds of work. Getting this right matters in FPGA RTL because it affects synthesizability, timing, and code clarity . Functions vs Tasks (the core differences) Function Use a function when you want a pure calculation that: returns one value takes inputs does not consume time (no #delay , no @event , no wait ) is typically used inside expressions (RHS of assignments, conditions, parameters) Think: “combinational math / bit manipulations / encoding / decoding”. Task Use a task when you want a procedure that: may return multiple values via output/inout arguments is called from procedural code ( always , initial , etc.) in testbenches , can include time/event controls in synthesizable RTL , must still be zero-time (no delays/events) Think: “do these steps” (especially in testbenches), or “group repeated procedural c...

What format does a makefile have to be while uploading it on a FPGA board?

图片
Short answer: you don’t upload a Makefile to an FPGA at all. An FPGA never “sees” your Makefile—only the bitstream (or similar config file) that the tools generate from your HDL. What’s actually going on Makefile Plain text file for your PC, read by make (GNU make, nmake, etc.). It just tells the host tools what commands to run: synthesize HDL run place & route generate bitstream optionally call the programmer to flash the FPGA FPGA input The FPGA only gets a configuration file , typically something like: Xilinx : .bit , .bin , sometimes .mcs Intel/Altera : .sof , .pof , .rbf Lattice : .jed , .bit , etc. So there is no special “format” for the Makefile for the FPGA . The format requirement is simply: It must be a valid Makefile syntax for make on your PC. Stored as plain text (no Word, no PDF, etc.). Usually named Makefile or makefile so make finds it automatically. Typical flow You write Makefile with rules like: # ...

How to power on DE10 FPGA?

图片
 To power on a Terasic DE10 FPGA board , you mainly need the right power source and the correct switch/jumper settings. I’ll cover the common boards (DE10-Nano, DE10-Lite, DE10-Standard). The exact steps are very similar. 1. Identify which DE10 board you have Look at the silkscreen on the PCB: “DE10-Nano” (with HPS/ARM and RJ45 Ethernet) “DE10-Lite” (small, MAX 10 FPGA, usually used in courses) “DE10-Standard” (larger, Cyclone V , more connectors) If you’re not sure, follow the section that visually matches what you see. 2. DE10-Nano – how to power it on The DE10-Nano can be powered in two main ways : Option A: Via DC barrel jack (recommended for heavy loads) Use a 5V regulated DC adapter , usually 5V / 2A (check label on board or kit PSU). Plug the adapter into the DC jack on the board. Make sure the power select jumper (often labeled JP3 / PWR or similar) is set to DC IN / EXT (depends on revision). Slide the ON/OFF switch (if present) t...

How to set up a pull up pin to high and low in FPGA?

图片
 You don’t actually set the pull-up itself “high or low” — you either let the pull-up win (high) or override it by driving low . Let’s break it down in FPGA terms. 1. What a “pull-up pin” really is A pull-up (internal or external resistor to VCC) makes the pin: HIGH by default (when nothing is driving it), but still allows something to pull it LOW (switch, another device, or your FPGA output). So for a pull-up pin you usually have these modes: Input with pull-up → used for buttons, open-collector signals, etc. Open-drain / open-collector style output with pull-up → used for shared lines (I²C-like). You control HIGH/LOW by either: Releasing the pin (high-impedance Z ) → pull-up makes it HIGH Actively driving 0 → forces it LOW 2. HDL pattern: open-drain pin with pull-up Say you have an I/O pin io_line with a pull-up (internal or external). In Verilog: // Top-level port inout wire io_line; reg drive_low; // 1 = pull line low, 0 = releas...

How to generate sine wave in FPGA?

图片
 Here are the most practical ways to generate a sine wave on an FPGA —from “quick & clean” to “resource-lean.” I’ll give you design rules, formulas, and drop-in HDL. The main approaches (pick one) Method When to use Notes DDS/NCO + LUT Easiest, precise frequency control Phase accumulator → lookup table. Best with an external DAC or 1-bit ΣΔ + RC. CORDIC You want to save BRAM / make sin/cos on the fly Uses add/shift stages; needs scaling factor compensation. PWM or ΣΔ DAC No external DAC available Filter the pin with RC/active LPF. ΣΔ generally cleaner than plain PWM. 1) DDS / NCO + LUT (golden path) How it works Phase accumulator : phase <= phase + phase_inc; Top M bits of phase index a sine LUT (ROM/BRAM). Frequency : f out = phase_inc 2 N   f clk f_\text{out} = \frac{\text{phase\_inc}}{2^N}\,f_\text{clk} f out ​ = 2 N phase_inc ​ f clk ​ Resolution example (N=32, fclk=100 MHz): ~ 0.0233 Hz steps. Compute phase_inc : round(f_out * 2^N / f_clk) – ...