-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNeuron.sv
More file actions
77 lines (58 loc) · 940 Bytes
/
Copy pathNeuron.sv
File metadata and controls
77 lines (58 loc) · 940 Bytes
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
`timescale 1ns / 1ps
module Neuron_Linear #(parameter N = 2, parameter B = 16)
(
input [N-1:0][B-1:0] x,
input [N-1:0][B-1:0] w,
input [B-1:0] b,
output [B-1:0] y
);
wire [15:0] x1w1, x2w2, out;
Multiplier M1(
.A(x[0]),
.B(w[0]),
.AB(x1w1)
);
Multiplier M2(
.A(x[1]),
.B(w[1]),
.AB(x2w2)
);
Adder A1(
.A(x1w1),
.B(x2w2),
.C(out)
);
assign y = out + b;
endmodule // Neuron_Linear
// module Neuron_Sigmoid(
// input [1:0][15:0] x,
// input [2:0][15:0] w,
// output [15:0] y
// );
// wire [15:0] z;
// Neuron_Linear ActVal(
// .x(x),
// .w(w),
// .y(z)
// );
// Sigmoid sigmoidActFunc(
// .x(z),
// .z(y)
// );
// endmodule // Neuron_Sigmoid
// module Neuron_ReLU(
// input [1:0][15:0] x,
// input [2:0][15:0] w,
// output [15:0] y
// );
// wire [15:0] z;
// Neuron_Linear ActVal(
// .x(x),
// .w(w),
// .y(z)
// );
// ReLU reluActFunc(
// .x(z),
// .z(y)
// );
// endmodule // Neuron_ReLU