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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [icarus_version/] [rtl/] [Module_FixedPointAddtionSubstraction.v] - Blame information for rev 211

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

Line No. Rev Author Line
1 158 diegovalve
`timescale 1ns / 1ps
2
`include "aDefinitions.v"
3
 
4
 
5
//-----------------------------------------------------------
6
module INCREMENT # ( parameter SIZE=`WIDTH )
7
(
8
input    wire                                   Clock,
9
input  wire                                     Reset,
10
input  wire[SIZE-1:0]    A,
11
output reg [SIZE-1:0]    R
12
);
13
always @ (posedge Clock)
14
begin
15 176 diegovalve
                R = A + 1;
16 158 diegovalve
end
17
 
18
 
19
endmodule
20
//-----------------------------------------------------------
21
module FixedAddSub
22
(
23 176 diegovalve
input  wire                                     Clock,
24 158 diegovalve
input  wire                                     Reset,
25 176 diegovalve
input  wire [`LONG_WIDTH-1:0]    A,
26
input  wire [`LONG_WIDTH-1:0]    B,
27 175 diegovalve
output wire [`LONG_WIDTH-1:0]    R,
28 176 diegovalve
input  wire                                             iOperation,
29
input  wire                                     iInputReady,            //Is the input data valid?
30 158 diegovalve
output wire                                     OutputReady             //Our output data is ready!
31
);
32
 
33
reg MyOutputReady = 0;
34
 
35
wire [`LONG_WIDTH-1:0] wB;
36
 
37
assign wB = ( iOperation ) ? ~B + 1'b1 : B;
38
 
39
//Output ready just take 1 cycle
40
//assign OutputReady = iInputReady;
41
 
42
FFD_POSEDGE_SYNCRONOUS_RESET #(1) FFOutputReadyDelay2
43
(
44
        .Clock( Clock ),
45
        .Reset( Reset ),
46
        .Enable(1'b1 ),
47
        .D( iInputReady ),
48
        .Q( OutputReady )
49
);
50
 
51 176 diegovalve
 
52 175 diegovalve
assign R = ( A + wB );
53 158 diegovalve
 
54
endmodule

powered by: WebSVN 2.1.0

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