-
Notifications
You must be signed in to change notification settings - Fork 1
/
sigma5.sv
executable file
·49 lines (46 loc) · 1.54 KB
/
sigma5.sv
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// SYNTHESIZABLE ADDER FOR N BIT SIGNED MAGNITUDE WITH F BITS OF FRACTION
// CREATED BY MEHDI SAFAEE, WINTER 2018-2019
`include "config.svh"
module sigma5
//##############################################################################################
//##############################################################################################
// PARAMETERs-----------------------------------------------------------------------------------
// INPUT AND OUTPUTS----------------------------------------------------------------------------
(
input logic [`N-1:0] a[0:4][1],
output logic [`N-1:0] c
);
// MODULES INSTANTIATIONS-----------------------------------------------------------------------
logic [`N-1:0] temp [0:2];
logic [`N-1:0] result;
adder adder0
(
.a(a[0][0]),
.b(a[1][0]),
.c(temp[0])
);
adder adder1
(
.a(a[2][0]),
.b(a[3][0]),
.c(temp[1])
);
adder adder2
(
.a(a[4]),
.b(temp[1]),
.c(temp[2])
);
adder adder3
(
.a(temp[0]),
.b(temp[2]),
.c(result)
);
// VARIABLES -----------------------------------------------------------------------------------
assign c = result;
// INITIALIZATIONS------------------------------------------------------------------------------
// MAIN-----------------------------------------------------------------------------------------
//##############################################################################################
//##############################################################################################
endmodule