- I used modelsim free edition that can be downloaded here
- Open project with MLP_Single.mpf
Simulation was conducted in ns.
defined variables
- Number of Layer (M) is 3
- Number of Neuron each layer (N) is 3
- Fixed-point resolution 32 bit (12 integer part, 20 fractional part)
- Actication function is ReLu (will take only positive value, negative value will become 0)
- X0 = 0.3
- X1 = 1.3
- X2 = 2.3
Weight data is generated automatically for just simulate the calculation. W0 is used for weight bias, where the bias always 1. W1-Wn are used for weight input data.
Weight data for hidden layer
- W0_0 = 1
- W1_0 = 1.1
- W2_0 = 1.2
- W3_0 = 1.3
- W0_1 = 2
- W1_2 = 2.1
- W2_1 = 2.2
- W3_1 = 2.3
- W0_2 = 3
- W1_2 = 3.1
- W2_2 = 3.2
- W3_2 = 3.3
- W0_0 = 11
- W1_0 = 11.1
- W2_0 = 11.2
- W3_0 = 11.3
- W0_1 = 12
- W1_2 = 12.1
- W2_1 = 12.2
- W3_1 = 12.3
- W0_2 = 13
- W1_2 = 13.1
- W2_2 = 13.2
- W3_2 = 13.3
Output from Hidden layer
- H0 = 5.88
- H1 = 10.78
- H2 = 15.68
- O0 = 374.188
- O1 = 407.528
- O2 = 440.868
the simulation waveform can be loaded from file wave.do above.
The simulation result is confirmed by manual calculation from excel file in directory above.