본문 바로가기

하드웨어/Verilog-NN

Verilog-NN : Perceptron 퍼셉트론

반응형

간단한 퍼셉트론 모델

 

 

module Perceptron (
  input wire clk,                                // clock
  input wire reset,                            // reset
  input wire [3:0] x,                          // synaptic weight   
  output wire y                                 // output vector
);
  reg [3:0] w;                                    // weight
  reg bias;
  
  always @(posedge clk) begin
    if (reset) begin
      w <= 4'b0001;
      bias <= 1'b0;
    end
    else begin
      y <= (x & w) + bias >= 5;
    end
  end
endmodule

 

 

https://towardsdatascience.com/the-mostly-complete-chart-of-neural-networks-explained-3fb6f2367464

 

The mostly complete chart of Neural Networks, explained

The zoo of neural network types grows exponentially. One needs a map to navigate between many emerging architectures and approaches.

towardsdatascience.com

 

module Perceptron (input wire x1, input wire x2, output wire y);

parameter W1 = 1, W2 = 1, B = -1;

assign y = (x1 * W1 + x2 * W2 >= B);

endmodule

 

 

 

이 코드는 간단한 퍼셉트론 모델을 Verilog로 구현한 것입니다. x 입력 벡터는 각 뉴런의 가중치를 나타내고, w 레지스터는 가중치를 저장하는 곳입니다. bias 레지스터는 뉴런의 편향값을 저장합니다. 결과값은 y 출력 벡터에 저장됩니다.

위의 코드는 간단한 퍼셉트론 모델이며, 현재의 딥 러닝 모델을 구현하기에는 부족합니다. 각각의 레이어, 활성화 함수 등의 구현이 필요할 수 있습니다.

 

반응형