⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 md5_comb.v

📁 MD5 算法在Xilinx FPGA上的实现
💻 V
📖 第 1 页 / 共 2 页
字号:
              XValue = FX(BlockIn, 10);
              TValue = T40;
            end 
            40 : begin
              Md5FuncValue = H(StateBReg, StateCReg, StateDReg);
              XValue = FX(BlockIn, 13);
              TValue = T41;
            end 
            41 : begin
              Md5FuncValue = H(StateAReg, StateBReg, StateCReg);
              XValue = FX(BlockIn, 0);
              TValue = T42;
            end 
            42 : begin
              Md5FuncValue = H(StateDReg, StateAReg, StateBReg);
              XValue = FX(BlockIn, 3);
              TValue = T43;
            end 
            43 : begin
              Md5FuncValue = H(StateCReg, StateDReg, StateAReg);
              XValue = FX(BlockIn, 6);
              TValue = T44;
            end 
            44 : begin
              Md5FuncValue = H(StateBReg, StateCReg, StateDReg);
              XValue = FX(BlockIn, 9);
              TValue = T45;
            end 
            45 : begin
              Md5FuncValue = H(StateAReg, StateBReg, StateCReg);
              XValue = FX(BlockIn, 12);
              TValue = T46;
            end 
            46 : begin
              Md5FuncValue = H(StateDReg, StateAReg, StateBReg);
              XValue = FX(BlockIn, 15);
              TValue = T47;
            end 
            47 : begin
              Md5FuncValue = H(StateCReg, StateDReg, StateAReg);
              XValue = FX(BlockIn, 2);
              TValue = T48;
            end 
            48 : begin
              Md5FuncValue = I(StateBReg, StateCReg, StateDReg);
              XValue = FX(BlockIn, 0);
              TValue = T49;
            end 
            49 : begin
              Md5FuncValue = I(StateAReg, StateBReg, StateCReg);
              XValue = FX(BlockIn, 7);
              TValue = T50;
            end 
            50 : begin
              Md5FuncValue = I(StateDReg, StateAReg, StateBReg);
              XValue = FX(BlockIn, 14);
              TValue = T51;
            end 
            51 : begin
              Md5FuncValue = I(StateCReg, StateDReg, StateAReg);
              XValue = FX(BlockIn, 5);
              TValue = T52;
            end 
            52 : begin
              Md5FuncValue = I(StateBReg, StateCReg, StateDReg);
              XValue = FX(BlockIn, 12);
              TValue = T53;
            end 
            53 : begin
              Md5FuncValue = I(StateAReg, StateBReg, StateCReg);
              XValue = FX(BlockIn, 3);
              TValue = T54;
            end 
            54 : begin
              Md5FuncValue = I(StateDReg, StateAReg, StateBReg);
              XValue = FX(BlockIn, 10);
              TValue = T55;
            end 
            55 : begin
              Md5FuncValue = I(StateCReg, StateDReg, StateAReg);
              XValue = FX(BlockIn, 1);
              TValue = T56;
            end 
            56 : begin
              Md5FuncValue = I(StateBReg, StateCReg, StateDReg);
              XValue = FX(BlockIn, 8);
              TValue = T57;
            end 
            57 : begin
              Md5FuncValue = I(StateAReg, StateBReg, StateCReg);
              XValue = FX(BlockIn, 15);
              TValue = T58;
            end 
            58 : begin
              Md5FuncValue = I(StateDReg, StateAReg, StateBReg);
              XValue = FX(BlockIn, 6);
              TValue = T59;
            end 
            59 : begin
              Md5FuncValue = I(StateCReg, StateDReg, StateAReg);
              XValue = FX(BlockIn, 13);
              TValue = T60;
            end 
            60 : begin
              Md5FuncValue = I(StateBReg, StateCReg, StateDReg);
              XValue = FX(BlockIn, 4);
              TValue = T61;
            end 
            61 : begin
              Md5FuncValue = I(StateAReg, StateBReg, StateCReg);
              XValue = FX(BlockIn, 11);
              TValue = T62;
            end 
            62 : begin
              Md5FuncValue = I(StateDReg, StateAReg, StateBReg);
              XValue = FX(BlockIn, 2);
              TValue = T63;
            end 
            63 : begin
              Md5FuncValue = I(StateCReg, StateDReg, StateAReg);
              XValue = FX(BlockIn, 9);
              TValue = T64;
            end 
            default: begin
              Md5FuncValue = 0;
              XValue = 0;
              TValue = 0;
            end
         endcase
       end 
       else begin
         Md5FuncValue = 0;
         XValue = 0;
         TValue = 0;
       end
    end

always @(AddRes1 or AddRes2 or StateAReg or
         StateBReg or StateCReg or StateDReg or
         RoundNum or DataVld)
    begin
      AddendState1 = 0;
      AddendState2 = 0;
      StateAComb = StateAReg;
      StateBComb = StateBReg;
      StateCComb = StateCReg;
      StateDComb = StateDReg;
      ShiftedAddend =  0;
      if (DataVld) begin
        casex(RoundNum) 
          6'b00XX00 : begin
             AddendState1 = StateAReg;
             AddendState2 = StateBReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S11);
             $display();
             StateAComb = AddRes2;
          end
          6'b00XX01 : begin
             AddendState1 = StateDReg;
             AddendState2 = StateAReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S12);
             $display();
             StateDComb = AddRes2;
          end
          6'b00XX10 : begin
             AddendState1 = StateCReg;
             AddendState2 = StateDReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S13);
             $display();
             StateCComb = AddRes2;
          end
          6'b00XX11 : begin
             AddendState1 = StateBReg;
             AddendState2 = StateCReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S14);
             $display();
             StateBComb = AddRes2;
          end
          6'b01XX00 : begin
             AddendState1 = StateAReg;
             AddendState2 = StateBReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S21);
             $display();
             StateAComb = AddRes2;
          end
          6'b01XX01 : begin
             AddendState1 = StateDReg;
             AddendState2 = StateAReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S22);
             $display();
             StateDComb = AddRes2;
          end
          6'b01XX10 : begin
             AddendState1 = StateCReg;
             AddendState2 = StateDReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S23);
             $display();
             StateCComb = AddRes2;
          end
          6'b01XX11 : begin
             AddendState1 = StateBReg;
             AddendState2 = StateCReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S24);
             $display();
             StateBComb = AddRes2;
          end
          6'b10XX00 : begin
             AddendState1 = StateAReg;
             AddendState2 = StateBReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S31);
             $display();
             StateAComb = AddRes2;
          end
          6'b10XX01 : begin
             AddendState1 = StateDReg;
             AddendState2 = StateAReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S32);
             $display();
             StateDComb = AddRes2;
          end
          6'b10XX10 : begin
             AddendState1 = StateCReg;
             AddendState2 = StateDReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S33);
             $display();
             StateCComb = AddRes2;
             end
          6'b10XX11 : begin
             AddendState1 = StateBReg;
             AddendState2 = StateCReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S34);
             $display();
             StateBComb = AddRes2;
          end
          6'b11XX00 : begin
             AddendState1 = StateAReg;
             AddendState2 = StateBReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S41);
             $display();
             StateAComb = AddRes2;
          end
          6'b11XX01 : begin
             AddendState1 = StateDReg;
             AddendState2 = StateAReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S42);
             $display();
             StateDComb = AddRes2;
          end
          6'b11XX10 : begin
             AddendState1 = StateCReg;
             AddendState2 = StateDReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S43);
             $display();
             StateCComb = AddRes2;
          end
          6'b11XX11 : begin
             AddendState1 = StateBReg;
             AddendState2 = StateCReg;
             ShiftedAddend =  ROTATE_LEFT(AddRes1, S44);
             $display();
             StateBComb = AddRes2;
          end
          default : begin
             AddendState1 = 0;
             AddendState2 = 0;
             ShiftedAddend = 0;
             StateAComb = StateAReg;
             StateBComb = StateBReg;
             StateCComb = StateCReg;
             StateDComb = StateDReg;
          end 
        endcase
      end
    end
endmodule

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -