| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- `timescale 1ns/1ps
- module bmc_ascii_snapshot_cocotb_top (
- input wire tick_1s_test,
- input wire rx_valid,
- input wire [7:0] rx_data,
- input wire rx_framing_error,
- input wire snapshot_lock,
- input wire snapshot_lock_bank,
- input wire [4:0] rd_index,
- output wire sys_clk,
- output reg rst_n_mon = 1'b0,
- output wire snapshot_commit,
- output wire parser_error,
- output wire [15:0] epoch,
- output wire [15:0] age_seconds,
- output wire stale,
- output wire active_bank,
- output wire [23:0] active_valid_mask,
- output wire [15:0] rd_raw,
- output wire rd_valid,
- output reg [15:0] commit_count_mon = 0,
- output reg [15:0] error_count_mon = 0
- );
- reg clk = 1'b0;
- reg [3:0] reset_count = 0;
- always #20 clk = ~clk;
- assign sys_clk = clk;
- always @(posedge clk) begin
- if (reset_count < 8) begin
- reset_count <= reset_count + 1'b1;
- rst_n_mon <= 1'b0;
- end else begin
- rst_n_mon <= 1'b1;
- end
- end
- bmc_ascii_snapshot #(
- .STALE_SECONDS(2),
- .INTER_BYTE_TIMEOUT_CLKS(64)
- ) u_dut (
- .clk(clk),
- .rst_n(rst_n_mon),
- .tick_1s(tick_1s_test),
- .rx_valid(rx_valid),
- .rx_data(rx_data),
- .rx_framing_error(rx_framing_error),
- .snapshot_lock(snapshot_lock),
- .snapshot_lock_bank(snapshot_lock_bank),
- .snapshot_commit(snapshot_commit),
- .parser_error(parser_error),
- .epoch(epoch),
- .age_seconds(age_seconds),
- .stale(stale),
- .active_bank(active_bank),
- .active_valid_mask(active_valid_mask),
- .control_bank(active_bank),
- .control_index(rd_index),
- .control_raw(rd_raw),
- .control_valid(rd_valid),
- .snapshot_bank(active_bank),
- .snapshot_index(5'd0),
- .snapshot_raw(),
- .snapshot_valid()
- );
- always @(posedge clk) begin
- if (!rst_n_mon) begin
- commit_count_mon <= 0;
- error_count_mon <= 0;
- end else begin
- if (snapshot_commit)
- commit_count_mon <= commit_count_mon + 1'b1;
- if (parser_error)
- error_count_mon <= error_count_mon + 1'b1;
- end
- end
- endmodule
|