| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117 |
- //`timescale 1ns / 1ps
- //////////////////////////////////////////////////////////////////////////////////
- // Company:
- // Engineer:
- //
- // Create Date: 10:02:35 04/20/2020
- // Design Name:
- // Module Name: PulseGen
- // Project Name:
- // Target Devices:
- // Tool versions:
- // Description:
- //
- // Dependencies:
- //
- // Revision:
- // Revision 0.01 - File Created
- // Additional Comments:
- //
- //////////////////////////////////////////////////////////////////////////////////
- module PGenRstGenerator
- #(
- parameter PgenNum = 7
- )
- (
- input Rst_i,
- input Clk_i,
-
- input [PgenNum-1:0] PGenRst_i,
-
- output reg [PgenNum-1:0] PGenRst_o,
- output reg RstDone_o
- );
- //================================================================================
- // LOCALPARAM
- //================================================================================
- localparam IDLE = 2'h0;
- localparam RST = 2'h1;
- localparam DEL = 2'h2;
-
- //================================================================================
- // REG/WIRE
- //================================================================================
- reg [1:0] currState;
-
- reg [PgenNum-1:0] pGenRstReg;
-
- wire orPGenRstReg = |pGenRstReg;
- //================================================================================
- // ASSIGNMENTS
- //================================================================================
- //================================================================================
- // CODING
- //================================================================================
- always @(posedge Clk_i) begin
- if (!Rst_i) begin
- pGenRstReg <= PGenRst_i;
- end else begin
- pGenRstReg <= 0;
- end
- end
- always @(posedge Clk_i) begin
- if (!Rst_i) begin
- case(currState)
- IDLE : begin
- if (orPGenRstReg) begin
- currState <= RST;
- PGenRst_o <= pGenRstReg;
- RstDone_o <= 1'b1;
- end else begin
- currState <= IDLE;
- PGenRst_o <= 0;
- RstDone_o <= 0;
- end
- end
-
- RST : begin
- if (RstDone_o) begin
- PGenRst_o <= 0;
- RstDone_o <= 0;
- currState <= DEL;
- end else begin
- currState <= RST;
- PGenRst_o <= 0;
- RstDone_o <= 0;
- end
- end
-
- DEL : begin
- PGenRst_o <= 0;
- RstDone_o <= 0;
- currState <= IDLE;
- end
- endcase
- end else begin
- currState <= IDLE;
- PGenRst_o <= 0;
- RstDone_o <= 0;
- end
- end
- endmodule
|