Skip to content

Commit

Permalink
Add minitests for DSP verification
Browse files Browse the repository at this point in the history
Related to f4pga#1903

Add minitests for DSP verification in the `minitests` folder.

* **DSP Multiplier Minitests**
  - Add `Makefile` for DSP multiplier minitests in `minitests/dsp-multiplier/Makefile`.
  - Add `top.v` file for DSP multiplier minitests in `minitests/dsp-multiplier/top.v`.
  - Define a simple design using DSP as a pure multiplier.

* **DSP IO Registers Minitests**
  - Add `Makefile` for DSP IO registers minitests in `minitests/dsp-io-registers/Makefile`.
  - Add `top.v` file for DSP IO registers minitests in `minitests/dsp-io-registers/top.v`.
  - Define a simple design using DSP input/output internal registers.
  • Loading branch information
vishwamartur committed Nov 12, 2024
1 parent f2d2157 commit afb0ae7
Show file tree
Hide file tree
Showing 4 changed files with 138 additions and 0 deletions.
44 changes: 44 additions & 0 deletions minitests/dsp-io-registers/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Makefile for DSP IO registers minitests

# Define the top-level design file
TOP = top.v

# Define the build directory
BUILD_DIR = build

# Define the output bitstream file
BITSTREAM = $(BUILD_DIR)/design.bit

# Define the Vivado project name
PROJECT = design

# Define the part number
PART = xc7a35tcsg324-1

# Define the Xilinx Vivado toolchain path
VIVADO = vivado

# Define the synthesis and implementation scripts
SYNTH_SCRIPT = synth.tcl
IMPL_SCRIPT = impl.tcl

# Define the default target
all: $(BITSTREAM)

# Create the build directory
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)

# Synthesize the design
$(BUILD_DIR)/$(PROJECT).dcp: $(TOP) | $(BUILD_DIR)
$(VIVADO) -mode batch -source $(SYNTH_SCRIPT) -tclargs $(TOP) $(BUILD_DIR) $(PROJECT) $(PART)

# Implement the design
$(BITSTREAM): $(BUILD_DIR)/$(PROJECT).dcp
$(VIVADO) -mode batch -source $(IMPL_SCRIPT) -tclargs $(BUILD_DIR) $(PROJECT)

# Clean the build directory
clean:
rm -rf $(BUILD_DIR)

.PHONY: all clean
28 changes: 28 additions & 0 deletions minitests/dsp-io-registers/top.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
module top (
input wire clk,
input wire [17:0] a,
input wire [17:0] b,
output wire [35:0] p
);

// Instantiate the DSP48E1 primitive with input/output internal registers
DSP48E1 #(
.A_INPUT("DIRECT"),
.B_INPUT("DIRECT"),
.USE_DPORT("FALSE"),
.USE_MULT("MULTIPLY"),
.USE_SIMD("ONE48"),
.AREG(1),
.BREG(1),
.CREG(1),
.DREG(1),
.MREG(1),
.PREG(1)
) dsp48e1_inst (
.CLK(clk),
.A(a),
.B(b),
.P(p)
);

endmodule
44 changes: 44 additions & 0 deletions minitests/dsp-multiplier/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# Makefile for DSP multiplier minitests

# Define the top-level design file
TOP = top.v

# Define the build directory
BUILD_DIR = build

# Define the output bitstream file
BITSTREAM = $(BUILD_DIR)/design.bit

# Define the Vivado project name
PROJECT = design

# Define the part number
PART = xc7a35tcsg324-1

# Define the Xilinx Vivado toolchain path
VIVADO = vivado

# Define the synthesis and implementation scripts
SYNTH_SCRIPT = synth.tcl
IMPL_SCRIPT = impl.tcl

# Define the default target
all: $(BITSTREAM)

# Create the build directory
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)

# Synthesize the design
$(BUILD_DIR)/$(PROJECT).dcp: $(TOP) | $(BUILD_DIR)
$(VIVADO) -mode batch -source $(SYNTH_SCRIPT) -tclargs $(TOP) $(BUILD_DIR) $(PROJECT) $(PART)

# Implement the design
$(BITSTREAM): $(BUILD_DIR)/$(PROJECT).dcp
$(VIVADO) -mode batch -source $(IMPL_SCRIPT) -tclargs $(BUILD_DIR) $(PROJECT)

# Clean the build directory
clean:
rm -rf $(BUILD_DIR)

.PHONY: all clean
22 changes: 22 additions & 0 deletions minitests/dsp-multiplier/top.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
module top (
input wire clk,
input wire [17:0] a,
input wire [17:0] b,
output wire [35:0] p
);

// Instantiate the DSP48E1 primitive
DSP48E1 #(
.A_INPUT("DIRECT"),
.B_INPUT("DIRECT"),
.USE_DPORT("FALSE"),
.USE_MULT("MULTIPLY"),
.USE_SIMD("ONE48")
) dsp48e1_inst (
.CLK(clk),
.A(a),
.B(b),
.P(p)
);

endmodule

0 comments on commit afb0ae7

Please sign in to comment.