medium_read me.txt

来自「A code writing by Verilog which can find」· 文本 代码 · 共 40 行

TXT
40
字号

 ------find the medium value --------
 
 
    /////////////////change the value that can be compared ///////////////////////////
    
    assign dat1=(data1<127)?(data1+128):(data1-128);//if value is positive +128
    assign dat2=(data2<127)?(data2+128):(data2-128);//if value is negative -128
    assign dat3=(data3<127)?(data3+128):(data3-128);    
    
    ///////////////////////////////////////////////////////////////////////////////
    
    
    ///////////find the maximum value and minimum value//////////////////////////////
    
    assign temp1=(dat1>dat2)?dat1:dat2;
    assign temp2=(temp1>dat3)?temp1:dat3;//maximum value
    assign temp3=(dat1<dat2)?dat1:dat2;
    assign temp4=(temp3<dat3)?temp3:dat3;//minimum value
    
    /////////////////////////////////////////////////////////////////////////////////
    
    
    ////////////compare with the maximum and minimum value to get the medium value//////
    
    assign temp5=((temp2>dat1) && (temp4<dat1))?dat1://select the medium value
                 ((temp2>dat2) && (temp4<dat2))?dat2:
                 ((temp2>dat3) && (temp4<dat3))?dat3:
                 (dat1==dat2)?dat1:
                 (dat1==dat3)?dat1:
                 (dat2==dat3)?dat2:dat1;
   
    //////////////////////////////////////////////////////////////////////////////////////
    
    
    ////if temp5 is bigger than 128 means the value is positive so minus 128 to get the original value////
    assign mediumvalue=(temp5>128)?(temp5-128):(temp5+128);//if temp5>128 means it is positive value
				                                             		   //so -128 to get the original value.    

    /////////////////////////////////////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

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