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

Subversion Repositories gng

[/] [gng/] [trunk/] [rtl/] [gng_smul_16_18_sadd_37.v] - Blame information for rev 7

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 guangxi.li
//------------------------------------------------------------------------------
2
//
3
// gng_smul_16_18_sadd_37.v
4
//
5
// This file is part of the Gaussian Noise Generator IP Core
6
//
7
// Description
8
//     Signed multiplier 16-bit x 18-bit follows signed adder 37-bit,
9
// delay 3 cyclesĄŁ
10
//
11
//------------------------------------------------------------------------------
12
//
13
// Copyright (C) 2014, Guangxi Liu <guangxi.liu@opencores.org>
14
//
15
// This source file may be used and distributed without restriction provided
16
// that this copyright statement is not removed from the file and that any
17
// derivative work contains the original copyright notice and the associated
18
// disclaimer.
19
//
20
// This source file is free software; you can redistribute it and/or modify it
21
// under the terms of the GNU Lesser General Public License as published by
22
// the Free Software Foundation; either version 2.1 of the License,
23
// or (at your option) any later version.
24
//
25
// This source is distributed in the hope that it will be useful, but
26
// WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27
// or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
28
// License for more details.
29
//
30
// You should have received a copy of the GNU Lesser General Public License
31
// along with this source; if not, download it from
32
// http://www.opencores.org/lgpl.shtml
33
//
34
//------------------------------------------------------------------------------
35
 
36
 
37
`timescale 1 ns / 1 ps
38
 
39
 
40
module gng_smul_16_18_sadd_37 (
41
    // System signals
42
    input clk,                  // system clock
43
 
44
    // Data interface
45
    input [15:0] a,             // multiplicand
46
    input [17:0] b,             // multiplicator
47
    input [36:0] c,             // adder
48
    output [37:0] p             // result
49
);
50
 
51
// Behavioral model
52
reg signed [15:0] a_reg;
53
reg signed [17:0] b_reg;
54
reg signed [36:0] c_reg;
55
reg signed [33:0] prod;
56
wire signed [37:0] sum;
57
reg [37:0] result;
58
 
59
always @ (posedge clk) begin
60
    a_reg <= a;
61
    b_reg <= b;
62
    c_reg <= c;
63
end
64
 
65
always @ (posedge clk) begin
66
    prod <= a_reg * b_reg;
67
end
68
 
69
assign sum = c_reg + prod;
70
 
71
always @ (posedge clk) begin
72
    result <= sum;
73
end
74
 
75
assign p = result;
76
 
77
 
78
endmodule

powered by: WebSVN 2.1.0

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