Skip to content

Commit

Permalink
[usbdev] usbdev scoreboard PR
Browse files Browse the repository at this point in the history
This PR contains updated usbdev scoreboard

Signed-off-by: Saad Anees <[email protected]>
  • Loading branch information
Saad-Anees1 authored and jdonjdon committed Feb 8, 2024
1 parent 6174313 commit 4bbd1bc
Show file tree
Hide file tree
Showing 3 changed files with 115 additions and 26 deletions.
11 changes: 7 additions & 4 deletions hw/ip/usbdev/dv/env/usbdev_TransactionManager.sv
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ class usbdev_transaction_manager extends uvm_object;

task in_transaction(input bit d_pkt[], input bit h_pkt[]);
case (state)
0 : begin // address and endpoint sent to data_integrity
0 : begin // Address and endpoint sent to data_integrity
if (m_usbdev_packet_classifier.pid == PidTypeInToken) begin
pid = m_usbdev_packet_classifier.pid;
address = m_usbdev_packet_classifier.address;
Expand All @@ -110,15 +110,18 @@ class usbdev_transaction_manager extends uvm_object;
2 : begin
m_usbdev_packet_classifier.checkPacket(h_pkt);
if (m_usbdev_packet_classifier.pid == PidTypeAck) begin
`uvm_info(get_type_name(), "ACK Handshake", UVM_DEBUG);
pid = m_usbdev_packet_classifier.pid;
m_handshake_pkt.send_handshake_packet(pid);
state = 0;
end
else if (m_usbdev_packet_classifier.pid == PidTypeNak) begin
`uvm_info(get_type_name(), "NAK Handshake", UVM_DEBUG);
pid = m_usbdev_packet_classifier.pid;
m_handshake_pkt.send_handshake_packet(pid);
state = 0;
end
else if (m_usbdev_packet_classifier.pid == PidTypeStall) begin
`uvm_info(get_type_name(), "STALL Handshake", UVM_DEBUG);
pid = m_usbdev_packet_classifier.pid;
m_handshake_pkt.send_handshake_packet(pid);
state = 0;
end
end
Expand Down
1 change: 1 addition & 0 deletions hw/ip/usbdev/dv/env/usbdev_packet_classifier.sv
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class usbdev_packet_classifier extends uvm_object;
end
end
DATA_0, DATA_1: begin
data.delete();
for(int i = 8; i < pkt.size()-16; i++) begin
data = new[data.size() +1](data);
data[data.size() - 1] = pkt[i];
Expand Down
129 changes: 107 additions & 22 deletions hw/ip/usbdev/dv/env/usbdev_scoreboard.sv
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class usbdev_scoreboard extends cip_base_scoreboard #(
usbdev_expected_pkt();
item.pack(actual_pkt);
actual_pkt_q.push_back(actual_pkt);
`uvm_info(`gfn, $sformatf("received usb20 item :\n%0s", item.sprint()), UVM_DEBUG)
`uvm_info(`gfn, $sformatf("ACTUAL PACKET : %p", actual_pkt), UVM_DEBUG)
`uvm_info(`gfn, $sformatf("req port item :\n%0s", item.sprint()), UVM_DEBUG)
compare_usb20_pkt();
end
endtask

Expand All @@ -89,19 +89,21 @@ class usbdev_scoreboard extends cip_base_scoreboard #(
m_packetiser.handshake_pkt_arr);
m_pkt_manager.pop_packet(expected_pkt);
expected_pkt_q.push_back(expected_pkt);
`uvm_info(`gfn, $sformatf("EXPECTED PACKET : %p", expected_pkt), UVM_DEBUG)
endtask

// process_usb20_pkt task : Process queue
// and compare the actual pkt with expected pkt
// -------------------------------
virtual task process_usb20_pkt();
usb20_item item;
rsp_usb20_fifo.get(item);
usbdev_expected_pkt();
item.pack(expected_pkt);
actual_pkt_q.push_back(expected_pkt);
compare_usb20_pkt();
forever begin
rsp_usb20_fifo.get(item);
usbdev_expected_pkt();
item.pack(expected_pkt);
actual_pkt_q.push_back(expected_pkt);
`uvm_info(`gfn, $sformatf("rsp port item :\n%0s", item.sprint()), UVM_DEBUG)
compare_usb20_pkt();
end
endtask

// compare_usb20_pkt task : To check pkt transmission accuracy
Expand Down Expand Up @@ -197,47 +199,68 @@ class usbdev_scoreboard extends cip_base_scoreboard #(
// TODO
end
"ep_out_enable": begin
do_read_check = 1'b0;
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
ep_out_enable_reg = ral.ep_out_enable[0].get_mirrored_value();
foreach(ep_out_enable_reg[i]) begin
if (ep_out_enable_reg[i]==1'b1) begin
ep_out_enable = 1'b1;
endp_index = i;
break;
end
else ep_out_enable = 1'b0;
end
end
"ep_in_enable": begin
// TODO
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"usbstat": begin
do_read_check = 1'b0;
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"avbuffer": begin
// TODO
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"rxfifo": begin
do_read_check = 1'b0;
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"rxenable_setup": begin
do_read_check = 1'b0;
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
rx_enable_setup_reg = ral.rxenable_setup[0].get_mirrored_value();
if (rx_enable_setup_reg[endp_index]) begin
rx_enable_setup = 1'b1;
end
else rx_enable_setup = 1'b0;
end
"rxenable_out": begin
do_read_check = 1'b0;
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
rx_enable_out_reg = ral.rxenable_out[0].get_mirrored_value();
if (rx_enable_out_reg[endp_index]) begin
rx_enable_out = 1'b1;
end
else rx_enable_out = 1'b0;
end
"set_nak_out": begin
// TODO
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"in_sent": begin
// TODO
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"out_stall": begin
out_stall_reg = ral.out_stall[0].get_mirrored_value();
Expand All @@ -246,17 +269,79 @@ class usbdev_scoreboard extends cip_base_scoreboard #(
end
end
"in_stall": begin
// TODO
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_0": begin
// TODO
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_1": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_2": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_3": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_4": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_5": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_6": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_7": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_8": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_9": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_10": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"configin_11": begin
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"out_iso": begin
// TODO
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end
end
"in_iso": begin
// TODO
end
if (!write && channel == DataChannel) begin
do_read_check = 1'b0;
end end
"data_toggle_clear": begin
// TODO
end
Expand Down

0 comments on commit 4bbd1bc

Please sign in to comment.