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

Subversion Repositories psg16

[/] [psg16/] [trunk/] [rtl/] [verilog/] [mux4to1.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 robfinch
// (C) 2007,2012  Robert T Finch
2
// robfinch<remove>@opencores.org
3
// All Rights Reserved.
4
//
5
// This source file is free software: you can redistribute it and/or modify 
6
// it under the terms of the GNU Lesser General Public License as published 
7
// by the Free Software Foundation, either version 3 of the License, or     
8
// (at your option) any later version.                                      
9
//                                                                          
10
// This source file is distributed in the hope that it will be useful,      
11
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
12
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
13
// GNU General Public License for more details.                             
14
//                                                                          
15
// You should have received a copy of the GNU General Public License        
16
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
17
//
18
// Verilog 1995
19
//
20
// Webpack 9.1i  xc3s1000-4ft256
21
//  slices /  LUTs / MHz
22
 
23
module mux4to1(e, s, i0, i1, i2, i3, z);
24
parameter WID=4;
25
input e;
26
input [1:0] s;
27
input [WID:1] i0;
28
input [WID:1] i1;
29
input [WID:1] i2;
30
input [WID:1] i3;
31
output [WID:1] z;
32
reg [WID:1] z;
33
 
34
always @(e or s or i0 or i1 or i2 or i3)
35
        if (!e)
36
                z <= {WID{1'b0}};
37
        else begin
38
                case(s)
39
                2'b00:  z <= i0;
40
                2'b01:  z <= i1;
41
                2'b10:  z <= i2;
42
                2'b11:  z <= i3;
43
                endcase
44
        end
45
 
46
endmodule

powered by: WebSVN 2.1.0

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