TSLexi
Newbie level 5
Hi guys,
I'm trying to implement my C++ perceptron in Verilog
Here's the bit file
And here's the C++ source code: https://forums.codeguru.com/showthread.php?543187-Do-you-have-any-ideas-how-to-extend-my-Perceptron
Thanks,
Lexi
I'm trying to implement my C++ perceptron in Verilog
Here's the bit file
Code:
module Perceptron(x, y, z, out, error)
input x, y, z
output out
wire x, y, z
wire out
wire error
reg bias
reg weight1
reg weight2
reg weight3
reg weight4
bias = 1;
weight1 = 1;
weight2 = -1;
weight3 = -1;
weight4 = -1;
always @(x, y, z)
begin
reg sum
sum = 0
sum = (x*weight1)
sum = (y*weight2)+sum
sum = (z*weight3)+sum
out = (bias*weight4)+sum
end
if (error !=(Z or 0))
begin
reg correction
correction = .001
weight1 = (x*error*correction)+weight1
weight2 = (y*error*correction)+weight2
weight3 = (z*error*correction)+weight3
weight4 = (bias*error*correction)+weight4
end
endmodule
And here's the C++ source code: https://forums.codeguru.com/showthread.php?543187-Do-you-have-any-ideas-how-to-extend-my-Perceptron
Thanks,
Lexi