dpmux4041.vmd 1.83 KB
/**************************************************************/
/*    Verilog module of datapath cell dpmux4041               */
/*    Designed by    Lin Yang    VLSI Technology  Nov. 2, 90  */
/*    Designed by    Linda J. Xu      August, 1992            */
/*                                                            */
/*    The following is the port description                   */
/*    Data ports                                              */
/*        I0   : the input port                               */
/*        I1   : the input port                               */
/*        I2   : the input port                               */
/*        I3   : the input port                               */
/*        Z    : the output port                              */
/*    Control ports                                           */
/*        INST  : the select input signal                     */
/*    Parameters                                              */
/*        WORDSIZE  : the word size of the datapath cell      */
/*        DELAY     : the delay time from input to output     */
/*        BF        : the  with/without buffer flag           */
/*                    0 for without buffer; 1 for with buffer */
/**************************************************************/
module dpmux4041(I0, I1, I2, I3, Z, INST);

  parameter WORDSIZE = 8, DELAY = 4, BF = 1;
  input  [WORDSIZE-1:0] I0, I1, I2, I3;
  output [WORDSIZE-1:0] Z;
  input  [3:0] INST;

  function [WORDSIZE-1:0] mux;
  input  [WORDSIZE-1:0] i0, i1, i2, i3;
  input  [3:0] sel;

  integer i;

    begin
      i = 0;

      while (i < WORDSIZE)
        begin
          mux[i] = (sel[0] & i0[i]) | (sel[1] & i1[i])
                   | (sel[2] & i2[i]) | (sel[3] & i3[i]);
          i = i + 1;
        end
    end
  endfunction

  assign #DELAY Z = mux(I0, I1, I2, I3, INST);

endmodule