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

📄 medium_read me.txt.bak

📁 A code writing by Verilog which can find medium value. With a C file to see the simulation results.
💻 BAK
字号:

 ------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;
    
    //////////////////////////////////////////////////////////////////////////////////////
    
    
    ////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 + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -