微波EDA网,见证研发工程师的成长!
首页 > 研发问答 > 嵌入式设计讨论 > FPGA,CPLD和ASIC > 关于约翰逊译码器(johnson decoder)的疑问

关于约翰逊译码器(johnson decoder)的疑问

时间:10-02 整理:3721RD 点击:
以下是一个约翰逊译码器的verilog hdl代码,其功能是如何实现的呢?
module johnsondecoder(s,en,y);
parameter n=3;
input [0:n-1] s;
input en;
output [0:2*n-1] y;
reg [0:2*n-1] y;

reg [0:2*n-1] address;
integer j;
always @(s or en)
  if(en==1'b1)
   begin
    address=0;
   
    for(j=0;j<n;j=j+1)
     if(s[j])
      address=address+1;
   
    if(s[0])
     address=2*n-address;
   
    y='b0;
    y[address]='b1;
   end
  else if(en==1'b0)
    y='b0;
  else
    y='bx;
endmodule

find the truth table and understand it.  the code is straightforward.

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top