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 168

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
        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_SYNCRONOUS_RESET #(1) FFOutputReadyDelay2
43
(
44
        .Clock( Clock ),
45
        .Reset( Reset ),
46
        .Enable(1'b1 ),
47
        .D( iInputReady ),
48
        .Q( OutputReady )
49
);
50
 
51
 
52
//-------------------------------       
53
always @ (posedge Clock)
54
begin
55
 
56
if (iInputReady == 1)
57
begin
58
          R = ( A + wB );
59
end
60
else
61
begin
62
                R = 64'hFFFFFFFF;
63
 
64
end
65
 
66
end // always
67
 
68
endmodule

powered by: WebSVN 2.1.0

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