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

Subversion Repositories theia_gpu

[/] [theia_gpu/] [branches/] [beta_1.1/] [rtl/] [Collaterals/] [Module_FixedPointAddtionSubstraction.v] - Blame information for rev 222

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

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

powered by: WebSVN 2.1.0

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