condition_mux.v 7.12 KB
Newer Older
1 2
/*******************************************************************************
 * Module: condition_mux
3 4
 * Date:2016-03-12  
 * Author: auto-generated file, see ahci_fsm_sequence_old.py
5 6 7 8 9 10 11
 * Description: Select condition
 *******************************************************************************/

`timescale 1ns/1ps

module condition_mux (
    input        clk,
12
    input        ce,  // enable recording all conditions
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
    input [ 7:0] sel,
    output       condition,
    input        ST_NB_ND,
    input        PXCI0_NOT_CMDTOISSUE,
    input        PCTI_CTBAR_XCZ,
    input        PCTI_XCZ,
    input        NST_D2HR,
    input        NPD_NCA,
    input        CHW_DMAA,
    input        SCTL_DET_CHANGED_TO_4,
    input        SCTL_DET_CHANGED_TO_1,
    input        PXSSTS_DET_NE_3,
    input        PXSSTS_DET_EQ_1,
    input        NPCMD_FRE,
    input        FIS_OK,
    input        FIS_ERR,
    input        FIS_FERR,
    input        FIS_EXTRA,
    input        FIS_FIRST_INVALID,
    input        FR_D2HR,
    input        FIS_DATA,
    input        FIS_ANY,
    input        NB_ND_D2HR_PIO,
    input        D2HR,
    input        SDB,
    input        DMA_ACT,
    input        DMA_SETUP,
    input        BIST_ACT_FE,
    input        BIST_ACT,
    input        PIO_SETUP,
    input        NB_ND,
    input        TFD_STS_ERR,
    input        FIS_I,
    input        PIO_I,
    input        NPD,
    input        PIOX,
    input        XFER0,
    input        PIOX_XFER0,
    input        CTBAA_CTBAP,
    input        CTBAP,
    input        CTBA_B,
    input        CTBA_C,
    input        TX_ERR,
    input        SYNCESC_ERR,
    input        DMA_PRD_IRQ_PEND,
    input        X_RDY_COLLISION);

60
    wire [44:0] masked;
61
    reg  [43:0] registered;
62 63 64 65
    reg  [ 5:0] cond_r;

    assign condition = |cond_r;

66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    assign masked[ 0] = registered[ 0]  && sel[ 2] && sel[ 1] && sel[ 0];
    assign masked[ 1] = registered[ 1]  && sel[ 3] && sel[ 1] && sel[ 0];
    assign masked[ 2] = registered[ 2]  && sel[ 4] && sel[ 1] && sel[ 0];
    assign masked[ 3] = registered[ 3]  && sel[ 5] && sel[ 1] && sel[ 0];
    assign masked[ 4] = registered[ 4]  && sel[ 6] && sel[ 1] && sel[ 0];
    assign masked[ 5] = registered[ 5]  && sel[ 7] && sel[ 1] && sel[ 0];
    assign masked[ 6] = registered[ 6]  && sel[ 3] && sel[ 2] && sel[ 0];
    assign masked[ 7] = registered[ 7]  && sel[ 4] && sel[ 2] && sel[ 0];
    assign masked[ 8] = registered[ 8]  && sel[ 5] && sel[ 2] && sel[ 0];
    assign masked[ 9] = registered[ 9]  && sel[ 6] && sel[ 2] && sel[ 0];
    assign masked[10] = registered[10]  && sel[ 7] && sel[ 2] && sel[ 0];
    assign masked[11] = registered[11]  && sel[ 4] && sel[ 3] && sel[ 0];
    assign masked[12] = registered[12]  && sel[ 5] && sel[ 3] && sel[ 0];
    assign masked[13] = registered[13]  && sel[ 6] && sel[ 3] && sel[ 0];
    assign masked[14] = registered[14]  && sel[ 7] && sel[ 3] && sel[ 0];
    assign masked[15] = registered[15]  && sel[ 5] && sel[ 4] && sel[ 0];
    assign masked[16] = registered[16]  && sel[ 6] && sel[ 4] && sel[ 0];
    assign masked[17] = registered[17]  && sel[ 7] && sel[ 4] && sel[ 0];
    assign masked[18] = registered[18]  && sel[ 6] && sel[ 5] && sel[ 0];
    assign masked[19] = registered[19]  && sel[ 7] && sel[ 5] && sel[ 0];
    assign masked[20] = registered[20]  && sel[ 7] && sel[ 6] && sel[ 0];
    assign masked[21] = registered[21]  && sel[ 3] && sel[ 2] && sel[ 1];
    assign masked[22] = registered[22]  && sel[ 4] && sel[ 2] && sel[ 1];
    assign masked[23] = registered[23]  && sel[ 5] && sel[ 2] && sel[ 1];
    assign masked[24] = registered[24]  && sel[ 6] && sel[ 2] && sel[ 1];
    assign masked[25] = registered[25]  && sel[ 7] && sel[ 2] && sel[ 1];
    assign masked[26] = registered[26]  && sel[ 4] && sel[ 3] && sel[ 1];
    assign masked[27] = registered[27]  && sel[ 5] && sel[ 3] && sel[ 1];
    assign masked[28] = registered[28]  && sel[ 6] && sel[ 3] && sel[ 1];
    assign masked[29] = registered[29]  && sel[ 7] && sel[ 3] && sel[ 1];
    assign masked[30] = registered[30]  && sel[ 5] && sel[ 4] && sel[ 1];
    assign masked[31] = registered[31]  && sel[ 6] && sel[ 4] && sel[ 1];
    assign masked[32] = registered[32]  && sel[ 7] && sel[ 4] && sel[ 1];
    assign masked[33] = registered[33]  && sel[ 6] && sel[ 5] && sel[ 1];
    assign masked[34] = registered[34]  && sel[ 7] && sel[ 5] && sel[ 1];
    assign masked[35] = registered[35]  && sel[ 7] && sel[ 6] && sel[ 1];
    assign masked[36] = registered[36]  && sel[ 4] && sel[ 3] && sel[ 2];
    assign masked[37] = registered[37]  && sel[ 5] && sel[ 3] && sel[ 2];
    assign masked[38] = registered[38]  && sel[ 6] && sel[ 3] && sel[ 2];
    assign masked[39] = registered[39]  && sel[ 7] && sel[ 3] && sel[ 2];
    assign masked[40] = registered[40]  && sel[ 5] && sel[ 4] && sel[ 2];
    assign masked[41] = registered[41]  && sel[ 6] && sel[ 4] && sel[ 2];
    assign masked[42] = registered[42]  && sel[ 7] && sel[ 4] && sel[ 2];
    assign masked[43] = registered[43]  && sel[ 6] && sel[ 5] && sel[ 2];
110
    assign masked[44] = !(|sel); // always TRUE condition (sel ==0)
111 112

    always @(posedge clk) begin
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158
        if (ce) begin
            registered[ 0] <= ST_NB_ND;
            registered[ 1] <= PXCI0_NOT_CMDTOISSUE;
            registered[ 2] <= PCTI_CTBAR_XCZ;
            registered[ 3] <= PCTI_XCZ;
            registered[ 4] <= NST_D2HR;
            registered[ 5] <= NPD_NCA;
            registered[ 6] <= CHW_DMAA;
            registered[ 7] <= SCTL_DET_CHANGED_TO_4;
            registered[ 8] <= SCTL_DET_CHANGED_TO_1;
            registered[ 9] <= PXSSTS_DET_NE_3;
            registered[10] <= PXSSTS_DET_EQ_1;
            registered[11] <= NPCMD_FRE;
            registered[12] <= FIS_OK;
            registered[13] <= FIS_ERR;
            registered[14] <= FIS_FERR;
            registered[15] <= FIS_EXTRA;
            registered[16] <= FIS_FIRST_INVALID;
            registered[17] <= FR_D2HR;
            registered[18] <= FIS_DATA;
            registered[19] <= FIS_ANY;
            registered[20] <= NB_ND_D2HR_PIO;
            registered[21] <= D2HR;
            registered[22] <= SDB;
            registered[23] <= DMA_ACT;
            registered[24] <= DMA_SETUP;
            registered[25] <= BIST_ACT_FE;
            registered[26] <= BIST_ACT;
            registered[27] <= PIO_SETUP;
            registered[28] <= NB_ND;
            registered[29] <= TFD_STS_ERR;
            registered[30] <= FIS_I;
            registered[31] <= PIO_I;
            registered[32] <= NPD;
            registered[33] <= PIOX;
            registered[34] <= XFER0;
            registered[35] <= PIOX_XFER0;
            registered[36] <= CTBAA_CTBAP;
            registered[37] <= CTBAP;
            registered[38] <= CTBA_B;
            registered[39] <= CTBA_C;
            registered[40] <= TX_ERR;
            registered[41] <= SYNCESC_ERR;
            registered[42] <= DMA_PRD_IRQ_PEND;
            registered[43] <= X_RDY_COLLISION;
        end
159 160 161 162 163
        cond_r[ 0] <= |masked[ 7: 0];
        cond_r[ 1] <= |masked[15: 8];
        cond_r[ 2] <= |masked[23:16];
        cond_r[ 3] <= |masked[31:24];
        cond_r[ 4] <= |masked[39:32];
164
        cond_r[ 5] <= |masked[44:40];
165 166
    end
endmodule