Skip to content

Commit

Permalink
WIP: Make queues parameterizable via registerchains
Browse files Browse the repository at this point in the history
  • Loading branch information
fhaus1 committed Nov 21, 2024
1 parent cab1f34 commit 60837fb
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 14 deletions.
6 changes: 5 additions & 1 deletion hw/newusb/new_usb_dmaoutputqueueED.sv
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,10 @@ package new_usb_dmaoutputqueueED_pkg;

endpackage

module new_usb_dmaoutputqueueED import new_usb_dmaoutputqueueED_pkg::*; (
module new_usb_dmaoutputqueueED import new_usb_dmaoutputqueueED_pkg::*; #(
parameter int unsigned AxiDataWidth = 0,
parameter int unsigned DmaOutputQueueStages = 0
)(
/// control
input logic clk_i,
input logic rst_ni,
Expand All @@ -58,6 +61,7 @@ module new_usb_dmaoutputqueueED import new_usb_dmaoutputqueueED_pkg::*; (
output endpoint_descriptor secondin,
output endpoint_descriptor firstin
);

Check warning on line 64 in hw/newusb/new_usb_dmaoutputqueueED.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/newusb/new_usb_dmaoutputqueueED.sv#L64

Remove trailing spaces. [Style: trailing-spaces] [no-trailing-spaces]
Raw output
message:"Remove trailing spaces. [Style: trailing-spaces] [no-trailing-spaces]" location:{path:"hw/newusb/new_usb_dmaoutputqueueED.sv" range:{start:{line:64 column:1}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"} suggestions:{range:{start:{line:64 column:1} end:{line:65}} text:"\n"}
endpoint_descriptor stash;
endpoint_descriptor secondinmux;

Expand Down
23 changes: 12 additions & 11 deletions hw/newusb/new_usb_ohci.sv
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,14 @@ package new_usb_ohci_pkg;
} store_type;

// OHCI supports between 1-15 ports
localparam int unsigned NumPhyPorts = 2;
localparam state_activate OverProtect = OFF; // no overcurrent protection implemented yet
localparam state_activate PowerSwitching = OFF; // no power switching implemented yet
localparam state_permit InterruptRouting = DISABLE; // no system management interrupt (SMI) implemented yet
localparam state_permit RemoteWakeup = DISABLE; // no remote wakeup implemented yet
localparam state_permit OwnershipChange = DISABLE; // no ownership change implemented yet
localparam int unsigned FifoDepthPort = 1024; // test value
localparam int unsigned DmaLength = 128; // test value
localparam int unsigned DmaDataWidth = 32; // 32|64|128 causes 4|2|1 stages in the dmaoutputqueueED
localparam int unsigned NumPhyPorts = 2;
localparam state_activate OverProtect = OFF; // no overcurrent protection implemented yet
localparam state_activate PowerSwitching = OFF; // no power switching implemented yet
localparam state_permit InterruptRouting = DISABLE; // no system management interrupt (SMI) implemented yet
localparam state_permit RemoteWakeup = DISABLE; // no remote wakeup implemented yet
localparam state_permit OwnershipChange = DISABLE; // no ownership change implemented yet
localparam int unsigned FifoDepthPort = 1024; // test value
localparam int unsigned DmaLength = 128; // test value

// Todo: Maybe Crc16 input Byte size parameter with selectable parallel/pipelined processing, lookup table?

Expand All @@ -55,7 +54,7 @@ module new_usb_ohci import new_usb_ohci_pkg::*; #(
/// DMA manager port parameters
parameter int unsigned AxiMaxReads = 0,
parameter int unsigned AxiAddrWidth = 0,
parameter int unsigned AxiDataWidth = 0,
parameter int unsigned AxiDataWidth = 0, // 32|64|128 causes 4|2|1 stages in the dmaoutputqueueED
parameter int unsigned AxiIdWidth = 0,
parameter int unsigned AxiUserWidth = 0,
/// Default User and ID presented on DMA manager AR, AW, W channels.
Expand Down Expand Up @@ -165,7 +164,9 @@ module new_usb_ohci import new_usb_ohci_pkg::*; #(

);

new_usb_unpackdescriptors i_new_usb_unpackdescriptors (
new_usb_unpackdescriptors #(
.AxiDataWidth(AxiDataWidth)
) i_new_usb_unpackdescriptors (
/// control
.clk_i,
.rst_ni,
Expand Down
28 changes: 28 additions & 0 deletions hw/newusb/new_usb_registerchain.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2024 ETH Zurich and University of Bologna.
// Solderpad Hardware License, Version 0.51, see LICENSE for details.
// SPDX-License-Identifier: SHL-0.51
//
// Fabian Hauser <[email protected]>
//
/// Register chain with variable width and stages

Check warning on line 7 in hw/newusb/new_usb_registerchain.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/newusb/new_usb_registerchain.sv#L7

Remove trailing spaces. [Style: trailing-spaces] [no-trailing-spaces]
Raw output
message:"Remove trailing spaces. [Style: trailing-spaces] [no-trailing-spaces]" location:{path:"hw/newusb/new_usb_registerchain.sv" range:{start:{line:7 column:50}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"} suggestions:{range:{start:{line:7 column:50} end:{line:8}} text:"/// Register chain with variable width and stages\n"}

module new_usb_registerchain #(
parameter int unsigned Width = 0,
parameter int unsigned Stages = 0,
parameter int unsigned Total = Width*Stages
)(
input logic clk_i,
input logic rst_ni,
input logic en,
input logic [Width-1:0] data_i,
output logic [Total-1:0] register
);
generate
genvar i;
for (i = 0; i < Total; i = i + Width) begin

Check warning on line 22 in hw/newusb/new_usb_registerchain.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/newusb/new_usb_registerchain.sv#L22

All generate block statements must have a label [Style: generate-statements] [generate-label]
Raw output
message:"All generate block statements must have a label [Style: generate-statements] [generate-label]" location:{path:"hw/newusb/new_usb_registerchain.sv" range:{start:{line:22 column:43}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"}
if(i == 0) `FFL(register[Width-1:0], data_i, en, '0)
else `FFL(register[Width+i-1:i], register[i-1:i-Width], en, '0)
end
endgenerate

endmodule

Check warning on line 28 in hw/newusb/new_usb_registerchain.sv

View workflow job for this annotation

GitHub Actions / verible-verilog-lint

[verible-verilog-lint] hw/newusb/new_usb_registerchain.sv#L28

File must end with a newline. [Style: posix-file-endings] [posix-eof]
Raw output
message:"File must end with a newline. [Style: posix-file-endings] [posix-eof]" location:{path:"hw/newusb/new_usb_registerchain.sv" range:{start:{line:28 column:10}}} severity:WARNING source:{name:"verible-verilog-lint" url:"https://github.com/chipsalliance/verible"} suggestions:{range:{start:{line:28 column:10} end:{line:29}} text:"endmodule\n"}
9 changes: 7 additions & 2 deletions hw/newusb/new_usb_unpackdescriptors.sv
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
// Todo: only one package flying
// Todo: TD management in ED, overwrite HeadP if servedTD, halted or toggle Carry?

module new_usb_unpackdescriptors import new_usb_ohci_pkg::*;(
module new_usb_unpackdescriptors import new_usb_ohci_pkg::*; #(
parameter int unsigned AxiDataWidth = 0
)(
/// control
input logic clk_i,
input logic rst_ni,
Expand All @@ -35,7 +37,7 @@ module new_usb_unpackdescriptors import new_usb_ohci_pkg::*;(
/// new currentED, updated after processed accessed it
output logic [27:0] newcurrentED_o,
output logic newcurrentED_valid_o,
/// dma data
/// id type
input logic [1:0] id_valid_i,
input logic [2:0] id_type_i,
/// dma data
Expand All @@ -48,6 +50,9 @@ module new_usb_unpackdescriptors import new_usb_ohci_pkg::*;(
/// head state
input logic sent_head_i
);

localparam int unsigned DmaOutputQueueStages = 128/AxiDataWidth; // dmaoutputqueueED stages

// nextis
assign nextis_ed_o = (id_type[2] && empty_secondin) || !id_type[2];
assign nextis_valid_o = !flying;
Expand Down

0 comments on commit 60837fb

Please sign in to comment.