-
Notifications
You must be signed in to change notification settings - Fork 46
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP: new_usb added (empty shell): various parameter changes
- Loading branch information
Showing
6 changed files
with
927 additions
and
4,545 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
// Paul Scheffler <[email protected]> | ||
// Thomas Benz <[email protected]> | ||
// Alessandro Ottaviano <[email protected]> | ||
// Fabian Hauser <[email protected]> | ||
|
||
package cheshire_pkg; | ||
|
||
|
@@ -26,13 +27,16 @@ package cheshire_pkg; | |
localparam int unsigned MaxExtRegSlvWidth = 4; | ||
|
||
// Parameters defined by generated hardware (regenerate to adapt) | ||
localparam int unsigned SpihNumCs = spi_host_reg_pkg::NumCS - 1; // Last CS is dummy | ||
localparam int unsigned SlinkNumChan = serial_link_single_channel_reg_pkg::NumChannels; | ||
localparam int unsigned SlinkNumLanes = serial_link_single_channel_reg_pkg::NumBits/2; | ||
localparam int unsigned SlinkMaxClkDiv = 1 << serial_link_single_channel_reg_pkg::Log2MaxClkDiv; | ||
localparam int unsigned ClintNumCores = clint_reg_pkg::NumCores; | ||
localparam int unsigned UsbNumPorts = spinal_usb_ohci_pkg::NumPhyPorts; | ||
localparam int unsigned NewUsbNumPorts = new_usb_ohci_pkg::NumPhyPorts; | ||
localparam int unsigned SpihNumCs = spi_host_reg_pkg::NumCS - 1; // Last CS is dummy | ||
localparam int unsigned SlinkNumChan = serial_link_single_channel_reg_pkg::NumChannels; | ||
localparam int unsigned SlinkNumLanes = serial_link_single_channel_reg_pkg::NumBits/2; | ||
localparam int unsigned SlinkMaxClkDiv = 1 << serial_link_single_channel_reg_pkg::Log2MaxClkDiv; | ||
localparam int unsigned ClintNumCores = clint_reg_pkg::NumCores; | ||
localparam int unsigned NewUsbNumPorts = new_usb_ohci_pkg::NumPhyPorts; | ||
localparam int unsigned SpinalUsbNumPorts_max = spinal_usb_ohci_pkg::NumPhyPorts; //The available port number is fixed because the SpinalUSB is already generated | ||
Check warning on line 36 in hw/cheshire_pkg.sv GitHub Actions / verible-verilog-lint[verible-verilog-lint] hw/cheshire_pkg.sv#L36
Raw output
|
||
localparam int unsigned SpinalUsbNumPorts = 2; //Select how many of the SpinalUsbNumPorts_max ports you want to use. The rest is tied to zero. | ||
localparam int unsigned UsbNumPorts = NewUsbNumPorts + SpinalUsbNumPorts; | ||
|
||
|
||
// Default JTAG ID code type | ||
typedef struct packed { | ||
|
@@ -180,8 +184,8 @@ package cheshire_pkg; | |
dw_bt UsbDmaMaxReads; | ||
doub_bt UsbAddrMask; | ||
doub_bt UsbAddrDomain; | ||
// TODO: parameter for NewUsb (FIFO depth...) | ||
/// ... | ||
// Parameter for NewUsb | ||
dw_bt NewUsbDmaMaxReads; | ||
// Parameters for DMA | ||
dw_bt DmaConfMaxReadTxns; | ||
dw_bt DmaConfMaxWriteTxns; | ||
|
@@ -662,6 +666,8 @@ package cheshire_pkg; | |
UsbDmaMaxReads : 16, | ||
UsbAddrMask : 'hFFFF_FFFF, | ||
UsbAddrDomain : 'h0000_0000, | ||
// NewUSB config | ||
NewUsbDmaMaxReads : 16, | ||
// DMA config | ||
DmaConfMaxReadTxns : 4, | ||
DmaConfMaxWriteTxns : 4, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
// Paul Scheffler <[email protected]> | ||
// Thomas Benz <[email protected]> | ||
// Alessandro Ottaviano <[email protected]> | ||
// Fabian Hauser <[email protected]> | ||
|
||
module cheshire_soc import cheshire_pkg::*; #( | ||
// Cheshire config | ||
|
@@ -1694,22 +1695,22 @@ module cheshire_soc import cheshire_pkg::*; #( | |
.dma_req_o ( axi_in_req[AxiIn.usb] ), | ||
.dma_rsp_i ( axi_in_rsp[AxiIn.usb] ), | ||
.intr_o ( intr.intn.usb ), | ||
.phy_clk_i ( usb_clk_i ), | ||
.phy_rst_ni ( usb_rst_ni ), | ||
.phy_dm_i ( usb_dm_i ), | ||
.phy_dm_o ( usb_dm_o ), | ||
.phy_dm_oe_o ( usb_dm_oe_o ), | ||
.phy_dp_i ( usb_dp_i ), | ||
.phy_dp_o ( usb_dp_o ), | ||
.phy_dp_oe_o ( usb_dp_oe_o ) | ||
.phy_clk_i ( usb_clk_i ), | ||
.phy_rst_ni ( usb_rst_ni ), | ||
.phy_dm_i ( {(SpinalUsbNumPorts_max-SpinalUsbNumPorts)'b0, usb_dm_i [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] } ), | ||
.phy_dm_o ( {(SpinalUsbNumPorts_max-SpinalUsbNumPorts)'bX, usb_dm_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] } ), | ||
.phy_dm_oe_o ( {(SpinalUsbNumPorts_max-SpinalUsbNumPorts)'bX, usb_dm_oe_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] } ), | ||
.phy_dp_i ( {(SpinalUsbNumPorts_max-SpinalUsbNumPorts)'b0, usb_dp_i [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] } ), | ||
.phy_dp_o ( {(SpinalUsbNumPorts_max-SpinalUsbNumPorts)'bX, usb_dp_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] } ), | ||
.phy_dp_oe_o ( {(SpinalUsbNumPorts_max-SpinalUsbNumPorts)'bX, usb_dp_oe_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] } ) | ||
); | ||
|
||
end else begin : gen_no_usb | ||
|
||
assign usb_dm_o = '0; | ||
assign usb_dm_oe_o = '0; | ||
assign usb_dp_o = '0; | ||
assign usb_dp_oe_o = '0; | ||
assign usb_dm_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] = '0; | ||
assign usb_dm_oe_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] = '0; | ||
assign usb_dp_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] = '0; | ||
assign usb_dp_oe_o [UsbNumPorts-1:UsbNumPorts-SpinalUsbNumPorts] = '0; | ||
|
||
assign intr.intn.usb = 0; | ||
|
||
|
@@ -1723,6 +1724,10 @@ module cheshire_soc import cheshire_pkg::*; #( | |
|
||
// TODO: USB has no internal error handling, so it should have a bus error unit. | ||
|
||
// TODO: Test out different port numbers, | ||
// currently 4 phyports, (2,3) are connected to spinal (0,1), spinal (2,3) tied to zero | ||
// currently 4 phyports, (0,1) are connected to newusb (0,1) | ||
|
||
new_usb_ohci #( | ||
.AxiMaxReads ( Cfg.UsbDmaMaxReads ), | ||
.AxiAddrWidth ( Cfg.AddrWidth ), | ||
|
@@ -1731,8 +1736,6 @@ module cheshire_soc import cheshire_pkg::*; #( | |
.AxiUserWidth ( Cfg.AxiUserWidth ), | ||
.AxiId ( '0 ), | ||
.AxiUser ( Cfg.AxiUserDefault ), | ||
.AxiAddrDomain ( Cfg.UsbAddrDomain ), | ||
.AxiAddrMask ( Cfg.UsbAddrMask ), | ||
.reg_req_t ( reg_req_t ), | ||
.reg_rsp_t ( reg_rsp_t ), | ||
.axi_req_t ( axi_mst_req_t ), | ||
|
@@ -1745,56 +1748,27 @@ module cheshire_soc import cheshire_pkg::*; #( | |
.dma_req_o ( axi_in_req[AxiIn.new_usb] ), | ||
.dma_rsp_i ( axi_in_rsp[AxiIn.new_usb] ), | ||
.intr_o ( intr.intn.usb ), | ||
.phy_clk_i ( usb_clk_i ), | ||
.phy_rst_ni ( usb_rst_ni ), | ||
.phy_dm_i ( usb_dm_i ), | ||
.phy_dm_o ( usb_dm_o ), | ||
.phy_dm_oe_o ( usb_dm_oe_o ), | ||
.phy_dp_i ( usb_dp_i ), | ||
.phy_dp_o ( usb_dp_o ), | ||
.phy_dp_oe_o ( usb_dp_oe_o ) | ||
.phy_clk_i ( usb_clk_i ), | ||
.phy_rst_ni ( usb_rst_ni ), | ||
.phy_dm_i ( usb_dm_i [NewUsbNumPorts-1:0]), | ||
.phy_dm_o ( usb_dm_o [NewUsbNumPorts-1:0]), | ||
.phy_dm_oe_o ( usb_dm_oe_o [NewUsbNumPorts-1:0]), | ||
.phy_dp_i ( usb_dp_i [NewUsbNumPorts-1:0]), | ||
.phy_dp_o ( usb_dp_o [NewUsbNumPorts-1:0]), | ||
.phy_dp_oe_o ( usb_dp_oe_o [NewUsbNumPorts-1:0]) | ||
); | ||
|
||
end else begin : gen_no_new_usb | ||
|
||
assign usb_dm_o = '0; | ||
assign usb_dm_oe_o = '0; | ||
assign usb_dp_o = '0; | ||
assign usb_dp_oe_o = '0; | ||
assign usb_dm_o [NewUsbNumPorts-1:0] = '0; | ||
assign usb_dm_oe_o [NewUsbNumPorts-1:0] = '0; | ||
assign usb_dp_o [NewUsbNumPorts-1:0] = '0; | ||
assign usb_dp_oe_o [NewUsbNumPorts-1:0] = '0; | ||
|
||
assign intr.intn.new_usb = 0; | ||
|
||
end | ||
|
||
//if (Cfg.NewUsb) begin : gen_new_usb | ||
// | ||
// | ||
// newusb_reg_top #( | ||
// .reg_req_t ( reg_req_t ), | ||
// .reg_rsp_t ( reg_rsp_t ) | ||
// ) i_regs ( | ||
// .clk_i, | ||
// .rst_ni, | ||
// .reg_req_i ( reg_out_req[RegOut.new_usb] ), //SW HCD | ||
// .reg_rsp_o ( reg_out_rsp[RegOut.new_usb] ), //SW HCD | ||
// .reg2hw ( /* NC */ ), //HW HC | ||
// .hw2reg ( '0 ), //HW HC | ||
// .devmode_i ( 1'b1 ) | ||
// ); | ||
// | ||
// // DMA port tied-off | ||
// assign axi_in_req[AxiIn.new_usb] = '0; | ||
// | ||
// // IRQ tied-off | ||
// assign intr.intn.new_usb = '0; | ||
// | ||
//end else begin : gen_no_new_usb | ||
// | ||
// // tie-off other signals (USB PHY, IRQs) | ||
// assign intr.intn.new_usb = '0; | ||
// | ||
//end | ||
|
||
////////////////// | ||
// Assertions // | ||
////////////////// | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.