This project implements a Finite Impulse Response (FIR) filter in VHDL, interfaced with a host processor via an AXI4Lite bus. The system consists of a hardware design and a C test script that demonstrates how to interact with the hardware.
Implemented by Ioannis Danias and me on XILINX VIVADO 2018.3
- AXI4Lite Slave Interface: Handles communication with the host processor, mapping registers for input and output.
- FIR Filter Core: Implements the FIR logic using submodules:
control_unit: Manages control signals and address generation.mlab_ram: Stores input samples.mlab_rom: Stores filter coefficients.MAC: Performs multiply-accumulate operations.
-
Input Handling:
- The host writes input data and control signals (reset, valid) to the mapped AXI register (
slv_reg0). - The FIR core receives these signals and processes the input sample.
- The host writes input data and control signals (reset, valid) to the mapped AXI register (
-
Processing:
- On a valid input, the control unit resets counters and triggers a write to RAM.
- The RAM shifts in the new sample; the ROM provides the corresponding coefficient.
- The MAC unit multiplies the RAM and ROM outputs, accumulating the result.
-
Output Handling:
- When processing is complete, the output (
y_ip) and a valid flag (valid_out_ip) are packed into the output register (B_ip). - The host reads the result from the mapped AXI register.
- When processing is complete, the output (
- slv_reg0: Input register (data, valid, reset).
- B_ip: Output register (result, valid flag).
Demonstrates how to interact with the FIR hardware via memory-mapped AXI registers.
-
Initialization:
- Platform is initialized.
- The FIR core is reset by writing to the input register.
-
Input Loop:
- For each sample in the input array:
- Compose the input word (data, valid, reset).
- Write to the FIR input register.
- Poll the output register until the valid flag is set.
- Read and print the output.
- For each sample in the input array:
-
Bit Packing:
- Input word:
- Bits 0-7: Data sample
- Bit 8: Valid flag
- Bit 9: Reset flag
- Output word:
- Bits 0-16: FIR result
- Bit 17: Output valid flag
- Input word:
- Write:
Xil_Out32(MY_IP_BASEADDR+0x00, A_ip); - Read:
B_ip = Xil_In32(MY_IP_BASEADDR + 0x04); - Polling: Waits for the valid flag in the output register before reading the result.
- The host writes input data and control signals to the FIR core via AXI registers.
- The FIR core processes the data, using RAM for sample storage and ROM for coefficients.
- The MAC unit computes the FIR output.
- The result and a valid flag are made available to the host, which reads them after polling for completion.
- The design is synchronous and expects the host to manage valid and reset signals.
- The C script demonstrates a typical usage pattern: reset, input, poll for output, read result.
- The VHDL code is modular, allowing for easy adaptation of filter length and coefficients.