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

Ansa mb test #84

Open
wants to merge 106 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
106 commits
Select commit Hold shift + click to select a range
8928bfc
change to fsdb
ansaschmulbach May 3, 2024
399ebcd
update sb raw tx
ansaschmulbach May 3, 2024
ad50bfd
update sb raw rx
ansaschmulbach May 3, 2024
9bcf715
update sb raw rx
ansaschmulbach May 3, 2024
e545d8e
update sb raw rx
ansaschmulbach May 3, 2024
dee4b27
delay sb rx clock
ansaschmulbach May 3, 2024
20f8f90
delay sb rx clock
ansaschmulbach May 3, 2024
0af0db2
questionable clock hack attempt 1
ansaschmulbach May 3, 2024
209f927
questionable clock hack attempt 1
ansaschmulbach May 3, 2024
663c3dc
correct msg source
ansaschmulbach May 3, 2024
c0768f2
correct msg source
ansaschmulbach May 3, 2024
9cfa8db
correct msg source
ansaschmulbach May 3, 2024
d80a451
correct msg source
ansaschmulbach May 3, 2024
e83da09
unsure -- sb timing issue
ansaschmulbach May 3, 2024
22c1fcb
add async fifo
ansaschmulbach May 3, 2024
68ea5b6
weird clock hacks pt 2
ansaschmulbach May 3, 2024
368a950
clock mux?
ansaschmulbach May 3, 2024
0b8838a
clock mux?
ansaschmulbach May 3, 2024
0b0bc44
mux clocks
ansaschmulbach May 3, 2024
f95d872
mux clocks
ansaschmulbach May 3, 2024
ab3fe15
update test reset
ansaschmulbach May 3, 2024
5761196
clock mux
ansaschmulbach May 3, 2024
13a7554
async reset
ansaschmulbach May 3, 2024
3c689b8
make own counter
ansaschmulbach May 3, 2024
3afae52
make own counter
ansaschmulbach May 3, 2024
ce91b17
make own counter
ansaschmulbach May 3, 2024
052b07f
counter reset value hacks
ansaschmulbach May 4, 2024
c273448
counter reset value hacks
ansaschmulbach May 4, 2024
386ae40
move data inside clock block
ansaschmulbach May 4, 2024
4389f3c
use negedge clock
ansaschmulbach May 4, 2024
7ae41c5
negedge??
ansaschmulbach May 4, 2024
6068bf2
negedge??
ansaschmulbach May 4, 2024
6f4e7be
attempt black box resource
ansaschmulbach May 4, 2024
3517b09
attempt black box resource
ansaschmulbach May 4, 2024
bf68913
attempt black box resource
ansaschmulbach May 4, 2024
a5acb20
attempt black box resource
ansaschmulbach May 4, 2024
986f4c8
attempt black box resource
ansaschmulbach May 4, 2024
27eb7d7
attempt black box resource
ansaschmulbach May 4, 2024
e54aeb4
attempt black box resource
ansaschmulbach May 4, 2024
4e7b9c8
attempt black box resource
ansaschmulbach May 4, 2024
7335895
system clock test
ansaschmulbach May 4, 2024
6de79dd
system clock test
ansaschmulbach May 4, 2024
43d2a9e
system clock test
ansaschmulbach May 4, 2024
a448fdf
revert system clock test
ansaschmulbach May 4, 2024
58541b4
undelayed clock test
ansaschmulbach May 4, 2024
21a271c
sb serializer negedge?
ansaschmulbach May 6, 2024
ced1979
undo un-delay in afe loopback
ansaschmulbach May 6, 2024
430522d
negedge afe loopback test
ansaschmulbach May 6, 2024
78e1a87
hacky serializer cycle delay fix
ansaschmulbach May 6, 2024
1d26025
hacky serializer cycle delay fix
ansaschmulbach May 6, 2024
c0a06e9
hacky serializer cycle delay fix
ansaschmulbach May 6, 2024
e8da256
hacky serializer cycle delay fix
ansaschmulbach May 6, 2024
e4fc256
hacky serializer cycle delay fix
ansaschmulbach May 6, 2024
7b4b87b
add one cycle delay after latching data
ansaschmulbach May 6, 2024
a741c36
add one cycle delay after latching data
ansaschmulbach May 6, 2024
a36c462
add back counter disable?
ansaschmulbach May 6, 2024
c06d406
add back counter disable?
ansaschmulbach May 6, 2024
fd8c8ef
counter disable reset
ansaschmulbach May 6, 2024
1fd615a
remove myid from phy params
ansaschmulbach May 6, 2024
cf2fc37
remove myid from phy params
ansaschmulbach May 6, 2024
8cc8bb5
make clog2
ansaschmulbach May 6, 2024
7ea7829
make clog2
ansaschmulbach May 6, 2024
4418d62
increase test timeout
ansaschmulbach May 6, 2024
cc1bfad
update inbandpres
ansaschmulbach May 6, 2024
1d0b9db
update inbandpres
ansaschmulbach May 6, 2024
6f1e8c8
fix rdi bringup fsm
ansaschmulbach May 6, 2024
03ec156
ignore logphy test
ansaschmulbach May 8, 2024
8445778
try no async fifo
ansaschmulbach May 8, 2024
d690f16
fix logphy test
ansaschmulbach May 8, 2024
87f982e
compilation bug
ansaschmulbach May 8, 2024
e69956d
fixed the handshake
vikramjain236 May 8, 2024
b70fdf9
first pass mb serdes
vikramjain236 May 8, 2024
ae99f9e
adding mbafe
vikramjain236 May 9, 2024
eae32e2
pll lock set to true
ansaschmulbach May 9, 2024
a97d0e0
correct byte ordering mapping
ansaschmulbach May 9, 2024
82d020f
remove async fifo afe
ansaschmulbach May 9, 2024
bd042fa
remove async fifo afe
ansaschmulbach May 9, 2024
d1a66ce
remove async fifo afe
ansaschmulbach May 9, 2024
5118990
update hasData
ansaschmulbach May 9, 2024
1fa8adf
update mb serializer
ansaschmulbach May 9, 2024
ce12523
update mb serializer
ansaschmulbach May 9, 2024
ed3d728
no clock parking
ansaschmulbach May 9, 2024
0bea641
serialize lsb first
ansaschmulbach May 9, 2024
80f6343
remove async fifo rx
ansaschmulbach May 9, 2024
c9a93ac
change lane update
ansaschmulbach May 9, 2024
a0d6aa5
reverse bit direction rx
ansaschmulbach May 9, 2024
002d012
update out_valid to have cycle delay
ansaschmulbach May 9, 2024
c98cc19
try increase timeout
ansaschmulbach May 9, 2024
dafd44c
fixing the pl_trdy
vikramjain236 May 9, 2024
bfdf0c6
fix IO directions
ansaschmulbach May 9, 2024
e73ea77
update IO in UCI top
ansaschmulbach May 9, 2024
9ffc634
fix AFE loopback tests IOs
ansaschmulbach May 9, 2024
4eb2cf5
update reset type
ansaschmulbach May 9, 2024
8cd052d
update reset type
ansaschmulbach May 9, 2024
9f045e0
convert clock types
ansaschmulbach May 9, 2024
a4f86a5
connect tx signals correctly
ansaschmulbach May 9, 2024
b378315
loopback afe IO directions
ansaschmulbach May 9, 2024
e2fae7d
bool to clock
ansaschmulbach May 9, 2024
40771af
connect full logphy AFE
ansaschmulbach May 9, 2024
12bf863
initialize pll lock
ansaschmulbach May 9, 2024
3a8eb93
remove fifoparams from sb afe
ansaschmulbach May 9, 2024
2314775
lock PLL
ansaschmulbach May 9, 2024
b4c16ba
get rid of clock mux
ansaschmulbach May 9, 2024
95faa61
get rid of clock mux
ansaschmulbach May 9, 2024
db8a7c2
only resent msg in init
ansaschmulbach May 10, 2024
558c184
only resent msg in init
ansaschmulbach May 10, 2024
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
200 changes: 200 additions & 0 deletions src/main/resources/vsrc/AsyncFifoCustomCore.sv
Original file line number Diff line number Diff line change
@@ -0,0 +1,200 @@
// Code your design here
module AsyncFifoCustomCore #(
parameter DEPTH = 16,
parameter WIDTH = 8
)(
input rst,

input clk_w,
input valid_w,
output ready_w,
input [WIDTH-1:0] data_w,

input clk_r,
output valid_r,
input ready_r,
output [WIDTH-1:0] data_r
);
localparam PTR_WIDTH = $clog2(DEPTH);


wire [PTR_WIDTH:0] b_wptr;
wire [PTR_WIDTH:0] b_rptr;
wire [PTR_WIDTH:0] g_wptr;
wire [PTR_WIDTH:0] g_rptr;
wire [PTR_WIDTH:0] g_wptr_sync;
wire [PTR_WIDTH:0] g_rptr_sync;
wire full, empty;

Sync2Flop #(PTR_WIDTH + 1) wptrSync (.clk(clk_w), .rst(rst), .in(g_wptr), .out(g_wptr_sync));
Sync2Flop #(PTR_WIDTH + 1) rptrSync (.clk(clk_r), .rst(rst), .in(g_rptr), .out(g_rptr_sync));
WptrHandler #(PTR_WIDTH) wptrHandler (.clk(clk_w), .rst(rst), .en(valid_w), .g_rptr_sync(g_rptr_sync),
.g_wptr(g_wptr), .b_wptr(b_wptr), .full(full));
RptrHandler #(PTR_WIDTH) rptrHandler (.clk(clk_r), .rst(rst), .en(ready_r), .g_wptr_sync(g_wptr_sync),
.g_rptr(g_rptr), .b_rptr(b_rptr), .empty(empty));
Fifo #(PTR_WIDTH, WIDTH) fifo (.rst(rst),
.clk_w(clk_w), .en_w(valid_w), .data_w(data_w), .b_wptr(b_wptr), .full(full),
.clk_r(clk_r), .en_r(ready_r), .data_r(data_r), .b_rptr(b_rptr), .empty(empty));
assign valid_r = ~empty;
assign ready_w = ~full;

endmodule

module Sync2Flop #(
parameter PTR_WIDTH = 8
)(
input clk,
input rst,
input [PTR_WIDTH-1:0] in,
output reg [PTR_WIDTH-1:0] out
);
reg [PTR_WIDTH-1:0] mid;
always_ff @(posedge clk, negedge rst) begin
if (~rst) begin
out <= '0;
mid <= '0;
end else begin
out <= mid;
mid <= in;
end
end
endmodule

module WptrHandler #(
parameter PTR_WIDTH = 8
)(
input clk,
input rst,
input en,
input [PTR_WIDTH:0] g_rptr_sync,
output reg [PTR_WIDTH:0] g_wptr, b_wptr,
output reg full
);
wire [PTR_WIDTH:0] g_wptr_next;
wire [PTR_WIDTH:0] b_wptr_next;
wire full_next;

assign b_wptr_next = b_wptr + (en & ~full);
assign g_wptr_next = b_wptr_next ^ (b_wptr_next >> 1);
assign full_next = g_wptr_next == {~g_rptr_sync[PTR_WIDTH:PTR_WIDTH-1], g_rptr_sync[PTR_WIDTH-2:0]};

always_ff @(posedge clk, negedge rst) begin
if(~rst) begin
g_wptr <= '0;
b_wptr <= '0;
full <= '0;
// g_wptr <= g_wptr_next;
// b_wptr <= b_wptr_next;
// full <= full_next;
end else begin
g_wptr <= g_wptr_next;
b_wptr <= b_wptr_next;
full <= full_next;
end
end

endmodule

module RptrHandler #(
parameter PTR_WIDTH = 8
)(
input clk,
input rst,
input en,
input [PTR_WIDTH:0] g_wptr_sync,
output reg [PTR_WIDTH:0] g_rptr, b_rptr,
output reg empty
);
wire [PTR_WIDTH:0] g_rptr_next;
wire [PTR_WIDTH:0] b_rptr_next;
wire empty_next;

assign b_rptr_next = b_rptr + (en & ~empty);
assign g_rptr_next = b_rptr_next ^ (b_rptr_next >> 1);
assign empty_next = g_rptr_next == g_wptr_sync;

always_ff @(posedge clk, negedge rst) begin
if(~rst) begin
g_rptr <= '0;
b_rptr <= '0;
empty <= '1;
end else begin
g_rptr <= g_rptr_next;
b_rptr <= b_rptr_next;
empty <= empty_next;
end
end

endmodule

module Fifo #(
parameter PTR_WIDTH = 8,
parameter WIDTH = 8
)(
input rst,
// Write
input [WIDTH-1:0] data_w,
input clk_w,
input en_w,
input [PTR_WIDTH:0] b_wptr,
input full,
// Read
output reg [WIDTH-1:0] data_r,
input clk_r,
input en_r,
input [PTR_WIDTH:0] b_rptr,
input empty
);
localparam ENTRIES = 2**PTR_WIDTH;
integer i;
reg [WIDTH-1:0] fifoBank [0:ENTRIES-1];
always_ff @(posedge clk_w, negedge rst) begin
if(~rst) begin
for(i = 0; i < ENTRIES; i++) begin
fifoBank[i] <= 'b0;
end
end else if (en_w & ~full) begin
fifoBank[b_wptr[PTR_WIDTH-1:0]] <= data_w;
end else begin
for(i = 0; i < ENTRIES; i++) begin
fifoBank[i] <= fifoBank[i];
end
end
end

// always_ff @(posedge clk_r) begin
// if(en_r & ~empty) begin
// data_r <= fifoBank[b_rptr[PTR_WIDTH-1:0]];
// end
// end

assign data_r = fifoBank[b_rptr[PTR_WIDTH-1:0]];
endmodule

module BinaryToGray #(
parameter WIDTH = 8
)(
input [WIDTH-1:0] in,
output [WIDTH-1:0] out
);

genvar i;
assign out[WIDTH-1] = in[WIDTH - 1];
for(i = WIDTH - 2; i >= 0; i--) begin
assign out[i] = in[i] ^ in[i + 1];
end

endmodule

module GrayToBinary #(
parameter WIDTH = 8
)(
input [WIDTH-1:0] in,
output [WIDTH-1:0] out
);
genvar i;
assign out[WIDTH-1] = in[WIDTH - 1];
for(i = WIDTH - 2; i >= 0; i--) begin
assign out[i] = ^(in >> i);
end
endmodule
14 changes: 14 additions & 0 deletions src/main/resources/vsrc/ClockSelector.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
module ClockMux2 (
input clocksIn_0,
input clocksIn_1,
input sel,
output clockOut
);

// REPLACE ME WITH A CLOCK CELL IF DESIRED

// XXX be careful with this! You can get really nasty short edges if you
// don't switch carefully
assign clockOut = sel ? clocksIn_1 : clocksIn_0;

endmodule
45 changes: 45 additions & 0 deletions src/main/resources/vsrc/SBDeserializer.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
module SBDeserializerBlackBox #(
parameter WIDTH = 128,
parameter WIDTH_W = $clog2(WIDTH)
) (
input clk,
input rst,
input in_data,
output [WIDTH - 1:0] out_data,
output out_data_valid

);

reg [WIDTH_W-1:0] counter;
reg [WIDTH-1:0] data_reg;
reg receiving;
wire recvDone;

assign out_data = data_reg;
assign recvDone = counter == (WIDTH - 1);
assign out_data_valid = !receiving;

always @(negedge clk or posedge rst) begin
if (rst) begin
counter <= 0;
receiving <= 1'b1;
end else begin
if (recvDone) begin
counter <= 0;
receiving <= 1'b0;
end else begin
counter <= counter + 1'b1;
receiving <= 1'b1;
end

// if (out_data_valid && out_data_ready) begin
// receiving <= 1'b1;
// end

data_reg[counter] <= in_data;

end

end

endmodule
13 changes: 13 additions & 0 deletions src/main/resources/vsrc/SBSerializer.v
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
module SBSerializerBlackBox #(
parameter WIDTH = 128,
parameter WIDTH_W = $clog2(WIDTH)
) (

input clk,
input rst,
input [WIDTH - 1:0] in_data,
output out_data

);

endmodule
34 changes: 17 additions & 17 deletions src/main/scala/d2dadapter/D2DSidebandModule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,39 +65,39 @@ class D2DSidebandModule(val fdiParams: FdiParams, val sbParams: SidebandParams)
sideband_switch.io.inner.layer_to_node_above.bits := 0.U(sbParams.sbNodeMsgWidth.W)
sideband_switch.io.inner.layer_to_node_above.valid := false.B

sideband_switch.io.inner.node_to_layer_below.ready := false.B
sideband_switch.io.inner.node_to_layer_below.ready := true.B
sideband_switch.io.inner.node_to_layer_above.ready := true.B

when(sideband_switch.io.inner.node_to_layer_above.valid && sideband_switch.io.inner.node_to_layer_above.ready){
when(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_REQ_ACTIVE){
when(sideband_switch.io.inner.node_to_layer_below.valid && sideband_switch.io.inner.node_to_layer_below.ready){
when(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_REQ_ACTIVE){
io.sideband_rcv := SideBandMessage.REQ_ACTIVE
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_REQ_L1){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_REQ_L1){
io.sideband_rcv := SideBandMessage.REQ_L1
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_REQ_L2){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_REQ_L2){
io.sideband_rcv := SideBandMessage.REQ_L2
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_REQ_LINK_RESET){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_REQ_LINK_RESET){
io.sideband_rcv := SideBandMessage.REQ_LINKRESET
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_REQ_DISABLE){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_REQ_DISABLE){
io.sideband_rcv := SideBandMessage.REQ_DISABLED
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_RSP_ACTIVE){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_RSP_ACTIVE){
io.sideband_rcv := SideBandMessage.RSP_ACTIVE
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_RSP_PM_NAK){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_RSP_PM_NAK){
io.sideband_rcv := SideBandMessage.RSP_PMNAK
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_RSP_L1){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_RSP_L1){
io.sideband_rcv := SideBandMessage.RSP_L1
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_RSP_L2){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_RSP_L2){
io.sideband_rcv := SideBandMessage.RSP_L2
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_RSP_LINK_RESET){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_RSP_LINK_RESET){
io.sideband_rcv := SideBandMessage.RSP_LINKRESET
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.LINK_MGMT_ADAPTER0_RSP_DISABLE){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.LINK_MGMT_ADAPTER0_RSP_DISABLE){
io.sideband_rcv := SideBandMessage.RSP_DISABLED
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.PARITY_FEATURE_REQ){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.PARITY_FEATURE_REQ){
io.sideband_rcv := SideBandMessage.PARITY_FEATURE_REQ
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.PARITY_FEATURE_ACK){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.PARITY_FEATURE_ACK){
io.sideband_rcv := SideBandMessage.PARITY_FEATURE_ACK
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.PARITY_FEATURE_NAK){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.PARITY_FEATURE_NAK){
io.sideband_rcv := SideBandMessage.PARITY_FEATURE_NAK
}.elsewhen(sideband_switch.io.inner.node_to_layer_above.bits === SBM.ADV_CAP){
}.elsewhen(sideband_switch.io.inner.node_to_layer_below.bits === SBM.ADV_CAP){
io.sideband_rcv := SideBandMessage.ADV_CAP
}.otherwise{
io.sideband_rcv := SideBandMessage.NOP
Expand Down
8 changes: 8 additions & 0 deletions src/main/scala/d2dadapter/LinkInitSubmodule.scala
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ class LinkInitSubmodule() extends Module {
linkinit_state_reg := LinkInitState.INIT_DONE
}
}
}.elsewhen(io.link_state === PhyState.active){
io.active_entry := true.B
io.linkinit_fdi_pl_state_sts := PhyState.active
io.linkinit_fdi_pl_rxactive_req := true.B
io.linkinit_fdi_pl_inband_pres := true.B
io.linkinit_rdi_lp_state_req := PhyStateReq.active
io.linkinit_sb_snd := SideBandMessage.NOP
linkinit_state_reg := LinkInitState.INIT_DONE
}.otherwise{
linkinit_state_reg := LinkInitState.INIT_START
io.active_entry := false.B
Expand Down
Loading
Loading