Demo entry 6684117

a

   

Submitted by anonymous on Dec 14, 2017 at 12:16
Language: verilog. Code size: 3.7 kB.

    AES_ENC AES_ENC(
        .Din(Din),
        .Key(Key),
        .Dout(Dout_E),
        .Drdy(Drdy),
        .Krdy(Krdy),
        .RSTn(RSTn),
        .EN(EN_E),
        .CLK(S_AXI_ACLK),
        .BSY(BSY_E),
        .Dvld(Dvld_E)
    );
    AES_DEC AES_DEC(
        .Din(Din),
        .Key(Key),
        .Dout(Dout_D),
        .Drdy(Drdy),
        .Krdy(Krdy),
        .RSTn(RSTn),
        .EN(EN_D),
        .CLK(S_AXI_ACLK),
        .BSY(BSY_D),
        .Dvld(Dvld_D)
    );
    integer count = 0;
    always@(posedge S_AXI_ACLK)
        begin
            if(slv_reg12[0] == 1'b1 && slv_reg12[1] == 1'b0)
            begin
                if(count == 0)
                begin
                    EN_E <= 0;
                    RSTn <= 0;
                    Krdy <= 0;
                    Drdy <= 0;
                end
                else if(count == 1)
                begin
                    RSTn <= 1;
                    EN_E <= 1;
                    //Key  <= 128'h000102030405060708090a0b0c0d0e0f;
                    Key[127:96] <= slv_reg4;
                    Key[95:64] <= slv_reg5;
                    Key[63:32] <= slv_reg6;
                    Key[31:0] <= slv_reg7;
                    Krdy <= 1;
                end
                else if(count == 2)
                begin
                    Krdy <= 0;
                    //Din <= 128'h00112233445566778899aabbccddeeff;
                    Din[127:96] <= slv_reg0;
                    Din[95:64] <= slv_reg1;
                    Din[63:32] <= slv_reg2;
                    Din[31:0] <= slv_reg3;
                    Drdy <= 1;
                end
                else if(count == 3)
                begin
                    Drdy <= 0;
                end
                else if(count == 14)
                begin
                    slv_reg8 = Dout_E[127:96];
                    slv_reg9 = Dout_E[95:64];
                    slv_reg10 = Dout_E[63:32];
                    slv_reg11 = Dout_E[31:0];
                end
                count <= count + 1;
            end
            else if(slv_reg12[1] == 1'b1 && slv_reg12[0] == 1'b0)
            begin
                if(count == 0)
                begin
                    EN_D <= 0;
                    RSTn <= 0;
                    Krdy <= 0;
                    Drdy <= 0;
                end
                else if(count == 1)
                begin
                    RSTn <= 1;
                    EN_D <= 1;
                    //Key  <= 128'h13111d7fe3944a17f307a78b4d2b30c5;
                    Key[127:96] <= slv_reg4;
                    Key[95:64] <= slv_reg5;
                    Key[63:32] <= slv_reg6;
                    Key[31:0] <= slv_reg7;
                    Krdy <= 1;
                end
                else if(count == 2)
                begin
                    Krdy <= 0;
                    //Din <= 128'h69c4e0d86a7b0430d8cdb78070b4c55a;
                    Din[127:96] <= slv_reg0;
                    Din[95:64] <= slv_reg1;
                    Din[63:32] <= slv_reg2;
                    Din[31:0] <= slv_reg3;
                    Drdy <= 1;
                end
                else if(count == 3)
                begin
                    Drdy <= 0;
                end
                else if(count == 14)
                begin
                    slv_reg8 = Dout_D[127:96];
                    slv_reg9 = Dout_D[95:64];
                    slv_reg10 = Dout_D[63:32];
                    slv_reg11 = Dout_D[31:0];
                end
                count <= count + 1;
            end
        end

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).