OpenCores
URL https://opencores.org/ocsvn/versatile_library/versatile_library/trunk

Subversion Repositories versatile_library

[/] [versatile_library/] [trunk/] [rtl/] [verilog/] [versatile_library_altera.v] - Diff between revs 33 and 34

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 33 Rev 34
Line 543... Line 543...
//// You should have received a copy of the GNU Lesser General    ////
//// You should have received a copy of the GNU Lesser General    ////
//// Public License along with this source; if not, download it   ////
//// Public License along with this source; if not, download it   ////
//// from http://www.opencores.org/lgpl.shtml                     ////
//// from http://www.opencores.org/lgpl.shtml                     ////
////                                                              ////
////                                                              ////
//////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////
 
module vl_mux2_andor ( a1, a0, sel, dout);
 
parameter width = 32;
 
parameter nr_of_ports = 2;
 
input [width-1:0] a1, a0;
 
input [nr_of_ports-1:0] sel;
 
output [width-1:0] dout;
 
wire [width-1:0] tmp [nr_of_ports-1:0];
 
integer i;
 
// and
 
assign tmp[0] = {width{sel[0]}} & a0;
 
assign tmp[1] = {width{sel[1]}} & a1;
 
// or
 
assign dout = tmp[1] | tmp[0];
 
endmodule
 
module vl_mux3_andor ( a2, a1, a0, sel, dout);
 
parameter width = 32;
 
parameter nr_of_ports = 3;
 
input [width-1:0] a2, a1, a0;
 
input [nr_of_ports-1:0] sel;
 
output [width-1:0] dout;
 
wire [width-1:0] tmp [nr_of_ports-1:0];
 
integer i;
 
// and
 
assign tmp[0] = {width{sel[0]}} & a0;
 
assign tmp[1] = {width{sel[1]}} & a1;
 
assign tmp[2] = {width{sel[2]}} & a2;
 
// or
 
assign dout = tmp[2] | tmp[1] | tmp[0];
 
endmodule
module vl_mux4_andor ( a3, a2, a1, a0, sel, dout);
module vl_mux4_andor ( a3, a2, a1, a0, sel, dout);
parameter width = 32;
parameter width = 32;
parameter nr_of_ports = 4;
parameter nr_of_ports = 4;
input [width-1:0] a3, a2, a1, a0;
input [width-1:0] a3, a2, a1, a0;
input [nr_of_ports-1:0] sel;
input [nr_of_ports-1:0] sel;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.