| 12345678910111213141516171819202122 |
- `timescale 1ns/1ps
- `ifndef MOTOR_CONTROL_HOLD_MONITOR_VH
- `define MOTOR_CONTROL_HOLD_MONITOR_VH
- module motor_control_hold_monitor(input wire clk,rst_n,valid,accept,
- input wire [2:0] op,input wire [15:0] mask,input wire [7:0] flags,input wire [31:0] value);
- held_payload_monitor #(.WIDTH(59)) check_hold(clk,rst_n,valid,accept,{op,mask,flags,value});
- endmodule
- module held_payload_monitor #(parameter integer WIDTH=32)(input wire clk,rst_n,valid,accept,
- input wire [WIDTH-1:0] data);
- reg pending=0;
- reg [WIDTH-1:0] held;
- always @(posedge clk)begin
- if(!rst_n)pending<=0;
- else begin
- if(pending && !accept && held!==data)
- $fatal(1,"held transaction context changed before acceptance");
- if(valid && !pending)begin held<=data;pending<=1;end
- if(accept)pending<=0;
- end
- end
- endmodule
- `endif
|