2 Commity

Autor SHA1 Wiadomość Data
  manojkumar 5bdc494bef new apple 7 miesięcy temu
  manojkumar 197bc26f82 new scoreboard 7 miesięcy temu
2 zmienionych plików z 330 dodań i 0 usunięć
  1. +0
    -0
      apple
  2. +330
    -0
      axi_scoreboard.sv

+ 0
- 0
apple Wyświetl plik


+ 330
- 0
axi_scoreboard.sv Wyświetl plik

@@ -0,0 +1,330 @@
class scoreboard extends uvm_scoreboard;

`uvm_component_utils(scoreboard)
env_config m_cfg;

uvm_tlm_analysis_fifo #(master_xtn) mas_fifo[][];
uvm_tlm_analysis_fifo #(slave_xtn) slv_fifo[][];

master_xtn write_address;
slave_xtn write_address_1;
master_xtn write_address_1_1;

master_xtn write_data;
slave_xtn write_data_1;
master_xtn write_data_1_1;

slave_xtn write_response;
master_xtn write_response_1;
master_xtn write_response_1_1;

master_xtn read_address;
slave_xtn read_address_1;
master_xtn read_address_1_1;
master_xtn read_data_response;
slave_xtn read_data_response_1;
master_xtn read_data_response_1_1;
extern function new (string name = "scoreboard",uvm_component parent);
extern function void build_phase (uvm_phase phase);
extern task run_phase (uvm_phase phase);
extern task compare_write_address();
extern task compare_write_data();
extern task compare_write_response();
extern task compare_read_address();
extern task compare_read_data_response ();

extern function void report_phase (uvm_phase phase);
int success [bit [3:0]];

int channel_1;

endclass

////////////////////////////////////////// NEW FUNCTION

function scoreboard::new (string name = "scoreboard",uvm_component parent);

super.new (name,parent);
write_address_cov = new();
write_data_cov = new();
write_data_cov_2 = new();
write_response_cov = new();
read_address_cov = new();
read_data_response_cov = new();
read_data_response_cov_2 = new();

endfunction

//////////////////////////////////////////// BUILD PHASE

function void scoreboard::build_phase (uvm_phase phase);

super.build_phase(phase);

run_test19:
if(!uvm_config_db #(env_config)::get(this,"","env_config",m_cfg))
`uvm_fatal ("SCOREBOADR","\n\n\t\t\t\tGETTING DATABASE FAILED\n\n")

mas_fifo = new [m_cfg.no_of_mas_top_agts * m_cfg.no_of_mas_agts];
foreach(mas_fifo[i])
begin
mas_fifo[i] = new[5];
run_test19:
for (int j = 0;j < 5;j++)
mas_fifo[i][j] = new ($sformatf("mas_fifo[%0d][%0d]",i,j),this);
end
slv_fifo = new [m_cfg.no_of_slv_top_agts * m_cfg.no_of_slv_agts];
foreach(slv_fifo[i])
begin
slv_fifo[i] = new[5];
for (int j = 0;j < 5;j++)
slv_fifo[i][j] = new ($sformatf("slv_fifo[%0d][%0d]",i,j),this);
end
endfunction

////////////////////////////////////////////// RUN PHASE

task scoreboard::run_phase (uvm_phase phase);

fork
forever
begin
mas_fifo[0][0].get (write_address);
slv_fifo[0][0].get (write_address_1);
compare_write_address();
end

forever
run_test19:
begin
mas_fifo[0][1].get (write_data);
slv_fifo[0][1].get (write_data_1);
compare_write_data();
end

forever
begin
mas_fifo[0][2].get (write_response_1);
slv_fifo[0][2].get (write_response);
compare_write_response();
end

run_test19:
forever
begin
mas_fifo[0][3].get (read_address);
slv_fifo[0][3].get (read_address_1);
compare_read_address();
end

forever
begin
run_test19:
mas_fifo[0][4].get (read_data_response);
slv_fifo[0][4].get (read_data_response_1);
compare_read_data_response ();
end
join
endtask

////////////////////////////////////////////// COMPARE WRITE ADDRESS

task scoreboard::compare_write_address();

write_address_1_1 = master_xtn::type_id::create ("write_address_compare");

write_address_1_1.awid = write_address_1.awid;
write_address_1_1.awaddr = write_address_1.awaddr;
write_address_1_1.awlen = write_address_1.awlen;
write_address_1_1.awsize = write_address_1.awsize;
write_address_1_1.awburst = write_address_1.awburst;
write_address.control = 1;
`uvm_info("SCOREBOARD",$sformatf("WRITE ADDRESS fROM MASTER MONITOR \n %s",write_address.sprint),UVM_HIGH)

write_address_1_1.control = 1;
`uvm_info("SCOREBOARD",$sformatf("WRITE ADDRESS fROM SLAVE MONITOR \n %s",write_address_1_1.sprint),UVM_HIGH)
write_address_1_1.control_1 = 1;
if (write_address_1_1.compare (write_address))
begin
write_address_cov.sample();

success[write_address.awid][1:0] = 1;
end
else
success[write_address.awid][1:0] = 2;

endtask
////////////////////////////////////////////// COMPARE WRITE DATA

task scoreboard::compare_write_data();

write_data_1_1 = master_xtn::type_id::create ("write_data_compare");

write_data_1_1.wid = write_data_1.wid;

foreach (write_data_1.wdata[i])
write_data_1_1.wdata[i] = write_data_1.wdata[i];

foreach (write_data_1.wstrobe[i])
write_data_1_1.wstrobe[i] = write_data_1.wstrobe[i];
write_data.control = 2;
`uvm_info("SCOREBOARD",$sformatf("WRITE DATA fROM MASTER MONITOR \n %s",write_data.sprint),UVM_HIGH)

write_data_1_1.control = 2;
`uvm_info("SCOREBOARD",$sformatf("WRITE DATA fROM SLAVE MONITOR \n %s",write_data_1_1.sprint),UVM_HIGH)
write_data_1_1.control_1 = 2;
if (write_data_1_1.compare (write_data))
begin
write_data_cov.sample();
foreach (write_data.wstrobe[i])
write_data_cov_2.sample(i);
success[write_data.wid][3:2] = 1;
end
else
success[write_data.wid][3:2] = 2;

endtask

////////////////////////////////////////////// COMPARE WRITE RESPONSE

task scoreboard::compare_write_response();

write_response_1_1 = master_xtn::type_id::create ("write_response_compare");

write_response_1_1.bid = write_response.bid;
write_response_1_1.bresp = write_response.bresp;
write_response_1.control = 3;
`uvm_info("SCOREBOARD",$sformatf("WRITE RESPONSE fROM MASTER MONITOR \n %s",write_response_1.sprint),UVM_HIGH)

write_response_1_1.control = 3;
`uvm_info("SCOREBOARD",$sformatf("WRITE RESPONSE fROM SLAVE MONITOR \n %s",write_response_1_1.sprint),UVM_HIGH)
write_response_1.control_1 = 3;
if (write_response_1.compare (write_response_1_1))
begin
write_response_cov.sample();
success[write_response_1.bid][5:4] = 1;
end
else
success[write_response_1.bid][5:4] = 2;

endtask

////////////////////////////////////////////// COMPARE READ ADDRESS

task scoreboard::compare_read_address();

read_address_1_1 = master_xtn::type_id::create ("read_address_compare");

read_address_1_1.arid = read_address_1.arid;
read_address_1_1.araddr = read_address_1.araddr;
read_address_1_1.arlen = read_address_1.arlen;
read_address_1_1.arsize = read_address_1.arsize;
read_address_1_1.arburst = read_address_1.arburst;
read_address.control = 4;
`uvm_info("SCOREBOARD",$sformatf("READ ADDRESS fROM MASTER MONITOR \n %s",read_address.sprint),UVM_HIGH)

read_address_1_1.control = 4;
`uvm_info("SCOREBOARD",$sformatf("READ ADDRESS fROM SLAVE MONITOR \n %s",read_address_1_1.sprint),UVM_HIGH)
read_address_1_1.control_1 = 4;
if (read_address_1_1.compare (read_address))
begin

read_address_cov.sample();
success[read_address.arid][7:6] = 1;
end

else
success[read_address.arid][7:6] = 2;

endtask

////////////////////////////////////////////// COMPARE READ DATA AND RESPONSE

task scoreboard::compare_read_data_response ();

read_data_response_1_1 = master_xtn::type_id::create ("read_data_response_compare");

read_data_response_1_1.rid = read_data_response_1.rid;

foreach (read_data_response_1.rdata[i])
read_data_response_1_1.rdata[i] = read_data_response_1.rdata[i];

foreach (read_data_response_1.read_resp[i])
read_data_response_1_1.read_resp[i] = read_data_response_1.read_resp[i];
read_data_response.control = 6;
`uvm_info("SCOREBOARD",$sformatf("READ DATA AND RESPONSE fROM MASTER MONITOR \n %s",read_data_response.sprint),UVM_HIGH)

read_data_response_1_1.control = 6;
`uvm_info("SCOREBOARD",$sformatf("READ DATA AND RESPONSE fROM SLAVE MONITOR \n %s",read_data_response_1_1.sprint),UVM_HIGH)
read_data_response_1_1.control_1 = 5;
if (read_data_response_1_1.compare (read_data_response))
begin
read_data_response_cov.sample();
foreach (read_data_response.read_resp[i])
read_data_response_cov_2.sample(i);
success[read_data_response.rid][9:8] = 1;
end
else
success[read_data_response.rid][9:8] = 2;

endtask

//////////////////////////////////////////// REPORT PHASE

function void scoreboard::report_phase (uvm_phase phase);

channel_1 = $fopen("Report.txt","a");
$fdisplay (channel_1,"\n\n\t================================================================================================================================================");
$fdisplay (channel_1,"\t\t ID \t ADDRESS \t WRITE_DATA \t WRITE_RESPONSE \t READ_ADDRESS \t READ_DATA and RESPONSE \n");
foreach (success[i])
$fdisplay (channel_1,"\t\t %0d \t %0d \t\t %0d \t\t %0d \t\t\t %0d \t\t %0d \n",i,success[i][1:0],success[i][3:2],success[i][5:4],success[i][7:6],success[i][9:8]);

$fdisplay (channel_1,"\n\n\t===============================================================================================================================================");
$fclose(channel_1);


$display ("\n\n\t\t\t\t\t\t\t\t REPORT");
$display ("\n\n============================================================================================================================================");
$display ("\n\n\t\t\t\t\t\t 0 ==> TRANSACTION NOT RECIEVED (`~`) \n");
$display ("\t\t\t\t\t 1 ==> TRANSACTION COMPARED SUCCESSFULLY (`_`) \n");
$display ("\t\t\t\t\t 2 ==> TRANSACTION COMPARED BUT NOT MATCHING (-_-) \n");
$display ("\n============================================================================================================================================\n\n");

$display ("\t ID \t ADDRESS \t WRITE_DATA \t WRITE_RESPONSE \t READ_ADDRESS \t READ_DATA and RESPONSE \n");
foreach (success[i])
$display ("\t %0d \t %0d \t\t %0d \t\t %0d \t\t\t %0d \t\t %0d \n",i,success[i][1:0],success[i][3:2],success[i][5:4],success[i][7:6],success[i][9:8]);

$display ("\n\n============================================================================================================================================");

endfunction

Ładowanie…
Anuluj
Zapisz