2022-06-17 12:56:46 -04:00
|
|
|
/*******************************************************************************
|
|
|
|
* Function: EMESH Transaction Monitor
|
|
|
|
* Author: Andreas Olofsson
|
|
|
|
* License: MIT (see LICENSE file in OH! repository)
|
|
|
|
*
|
|
|
|
******************************************************************************/
|
|
|
|
|
|
|
|
/* verilator lint_off STMTDLY */
|
|
|
|
module emesh_monitor
|
|
|
|
# (parameter PW = 104, // packet width
|
2022-06-18 08:51:24 -04:00
|
|
|
parameter FILENAME = "UNDEFINED", // filename
|
|
|
|
parameter ENABLE = 0 // enable block
|
2022-06-17 12:56:46 -04:00
|
|
|
)
|
|
|
|
(
|
|
|
|
//clock and reset
|
|
|
|
input clk,
|
|
|
|
input nreset,
|
|
|
|
//monitors transaction on the wire
|
|
|
|
input dut_valid,
|
|
|
|
input [PW-1:0] dut_packet,
|
|
|
|
input ready_in
|
|
|
|
);
|
|
|
|
|
2022-06-18 08:51:24 -04:00
|
|
|
generate
|
|
|
|
if(ENABLE)
|
|
|
|
begin
|
|
|
|
//core name for trace
|
|
|
|
reg [31:0] ftrace;
|
|
|
|
reg [255:0] tracefile;
|
2022-06-17 12:56:46 -04:00
|
|
|
|
2022-06-18 08:51:24 -04:00
|
|
|
initial
|
|
|
|
begin
|
|
|
|
#10
|
|
|
|
$sformat(tracefile,"%0s_%0h%s",FILENAME);
|
|
|
|
ftrace = $fopen({tracefile}, "w");
|
|
|
|
end
|
2022-06-17 12:56:46 -04:00
|
|
|
|
2022-06-18 08:51:24 -04:00
|
|
|
always @ (posedge clk)
|
|
|
|
if(nreset & dut_valid & ready_in)
|
|
|
|
if (PW==112) begin: p112
|
|
|
|
$fwrite(ftrace, "%h_%h_%h_%h\n",
|
|
|
|
dut_packet[110:80],
|
|
|
|
dut_packet[79:48],
|
|
|
|
dut_packet[47:16],
|
|
|
|
dut_packet[15:0]);
|
|
|
|
end
|
|
|
|
else if (PW==144) begin: p144
|
|
|
|
$fwrite(ftrace, "%h_%h_%h_%h\n",
|
|
|
|
dut_packet[143:112],
|
|
|
|
dut_packet[111:48],
|
|
|
|
dut_packet[47:16],
|
|
|
|
dut_packet[15:0]);
|
|
|
|
end
|
|
|
|
else if (PW==208) begin: p208
|
|
|
|
$fwrite(ftrace, "%h_%h_%h_%h_%h\n",
|
|
|
|
dut_packet[207:144],
|
|
|
|
dut_packet[143:112],
|
|
|
|
dut_packet[111:48],
|
|
|
|
dut_packet[47:16],
|
|
|
|
dut_packet[15:0]);
|
|
|
|
end
|
2022-06-17 12:56:46 -04:00
|
|
|
|
2022-06-18 08:51:24 -04:00
|
|
|
end
|
|
|
|
endgenerate
|
2022-06-17 12:56:46 -04:00
|
|
|
|
|
|
|
endmodule // emesh_monitor
|