Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hw: Added fpga vregfile #17

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/verible.waiver
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,5 @@ waive --rule=interface-name-style --location="hw/ip/reqrsp_interface/src/reqrsp_
waive --rule=interface-name-style --location="hw/ip/tcdm_interface/src/tcdm_interface.sv"
# We have some long lines
waive --rule=line-length --location="hw/*"
# Some files are replaced by Bender thus do not respect the module-filename rule
waive --rule=module-filename --location="hw/ip/spatz/src/vregfile_fpga.sv"
7 changes: 6 additions & 1 deletion Bender.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,12 @@ sources:
# Level 2
- hw/ip/spatz/src/spatz_decoder.sv
- hw/ip/spatz/src/spatz_simd_lane.sv
- hw/ip/spatz/src/vregfile.sv
- target: fpga
files:
- hw/ip/spatz/src/vregfile_fpga.sv
- target: not(fpga)
files:
- hw/ip/spatz/src/vregfile.sv
# Level 3
- hw/ip/spatz/src/spatz_fpu_sequencer.sv
- hw/ip/spatz/src/spatz_ipu.sv
Expand Down
46 changes: 46 additions & 0 deletions hw/ip/spatz/src/vregfile_fpga.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright 2023 ETH Zurich and University of Bologna.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//
// Author: Cyril Koenig, ETH Zurich

module vregfile import spatz_pkg::*; #(
parameter int unsigned NrReadPorts = 0,
parameter int unsigned NrWords = NRVREG,
parameter int unsigned WordWidth = VRFWordWidth,
// Derived parameters. Do not change!
parameter type addr_t = logic[$clog2(NrWords)-1:0],
parameter type data_t = logic [WordWidth-1:0],
parameter type strb_t = logic [WordWidth/8-1:0]
) (
input logic clk_i,
input logic rst_ni,
input logic testmode_i,
// Write ports
input addr_t waddr_i,
input data_t wdata_i,
input logic we_i,
input strb_t wbe_i,
// Read ports
input addr_t [NrReadPorts-1:0] raddr_i,
output data_t [NrReadPorts-1:0] rdata_o
);

// Just reuse snitch_regfile that has a FPGA implementation

snitch_regfile #(
.DATA_WIDTH(WordWidth),
.NR_READ_PORTS(NrReadPorts),
.NR_WRITE_PORTS(1),
.ZERO_REG_ZERO(0),
.ADDR_WIDTH($bits(addr_t))
) i_snitch_regfile (
.clk_i,
.raddr_i,
.rdata_o,
.waddr_i,
.wdata_i,
.we_i
);

endmodule : vregfile
Loading