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

Subversion Repositories psg16

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//      (C) 2007,2012  Robert Finch
4
//      All rights reserved.
5
//      robfinch<remove>@opencores.org
6
//
7
//      PSGChannelSummer.v 
8
//              Sums the channel outputs.
9
//
10
//
11
// This source file is free software: you can redistribute it and/or modify 
12
// it under the terms of the GNU Lesser General Public License as published 
13
// by the Free Software Foundation, either version 3 of the License, or     
14
// (at your option) any later version.                                      
15
//                                                                          
16
// This source file is distributed in the hope that it will be useful,      
17
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
18
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
19
// GNU General Public License for more details.                             
20
//                                                                          
21
// You should have received a copy of the GNU General Public License        
22
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
23
//
24
//============================================================================
25
 
26
module PSGChannelSummer(clk_i, cnt, outctrl, tmc_i, o);
27
input clk_i;                    // master clock
28
input [7:0] cnt;         // select counter
29
input [3:0] outctrl;     // channel output enable control
30
input [19:0] tmc_i;              // time-multiplexed channel input
31
output [21:0] o;         // summed output
32
reg [21:0] o;
33
 
34
// channel select signal
35
wire [1:0] sel = cnt[1:0];
36
 
37
always @(posedge clk_i)
38
        if (cnt==8'd0)
39
                o <= 22'd0 + (tmc_i & {20{outctrl[sel]}});
40
        else if (cnt < 8'd4)
41
                o <= o + (tmc_i & {20{outctrl[sel]}});
42
 
43
endmodule

powered by: WebSVN 2.1.0

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