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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [trunk/] [rtl/] [Module_FixedPointAddtionSubstraction.v] - Blame information for rev 224

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

Line No. Rev Author Line
1 152 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
        R = A + 1;
16
end
17
 
18
 
19
endmodule
20
//-----------------------------------------------------------
21
module FixedAddSub
22
(
23
input    wire                                   Clock,
24
input  wire                                     Reset,
25
input  wire[`LONG_WIDTH-1:0]     A,
26
input  wire[`LONG_WIDTH-1:0]     B,
27
output reg[`LONG_WIDTH-1:0]      R,
28
input   wire                                            iOperation,
29
input   wire                                    iInputReady,            //Is the input data valid?
30
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_ASYNC_RESET #(1) FFOutputReadyDelay2
43
(
44
        .Clock( Clock ),
45
        .Clear( Reset ),
46
        .D( iInputReady ),
47
        .Q( OutputReady )
48
);
49
 
50
 
51
//-------------------------------       
52
always @ (posedge Clock)
53
begin
54
 
55
if (iInputReady == 1)
56
begin
57
          R = ( A + wB );
58
end
59
else
60
begin
61
                R = 64'hFFFFFFFF;
62
 
63
end
64
 
65
end // always
66
 
67
endmodule

powered by: WebSVN 2.1.0

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