Course: Computer Architectures
Results: Lab 02 - Neural Computation and Amdahl Law
Comparison: Lab 02 - Comparison with Alternate Implementation
These snapshots preserve the final instruction sequence measured on 12 October 2026. Comments and whitespace differ from the ASE editor; executable instructions and data match the verified source. The normal computation executes 268 machine instructions, excluding the protected End block.
Final program
# Lab 02 neuron computation
.section .data
i:
.rept 30
.float 1.0
.endr
w:
.rept 30
.float 1.0
.endr
b: .float 171.0
x: .float 0.0
y: .float 0.0
one: .float 1.0
.section .text
.globl _start
_start:
la t0, i
la t1, w
li t2, 30
fmv.w.x f0, zero
loop:
flw f1, 0(t0)
flw f2, 0(t1)
fmul.s f3, f1, f2
fadd.s f0, f0, f3
addi t0, t0, 4
addi t1, t1, 4
addi t2, t2, -1
bnez t2, loop
# Add bias after the complete dot product
la t5, b
flw f7, 0(t5)
fadd.s f0, f0, f7
la t5, x
fsw f0, 0(t5)
# In RV32 shifting out the sign detects both +0.0 and -0.0
fmv.x.w t3, f0
slli t4, t3, 1
beqz t4, set_zero
srli t3, t3, 23
andi t3, t3, 255
li t4, 0x7F
beq t3, t4, set_zero
la t5, one
flw f5, 0(t5)
fdiv.s f6, f5, f0
j store_y
set_zero:
fmv.w.x f6, zero
store_y:
la t5, y
fsw f6, 0(t5)
End:
li a0, 0
li a7, 93
ecallDiagnostic snapshots
- Zero activation diagnostic: only bias changes to -30.0; observed stored x = 0 and y = 0. Passed forwarding off and on.
- Exponent activation diagnostic: only bias changes to -29.0; observed stored x = 1 and y = 0. Passed forwarding on.
These sources reproduce the input changes used for the successful diagnostics. Do not use diagnostic instruction counts or cycles in the normal performance tables. No new diagnostic simulator runs were performed while preparing these repository snapshots.
Settings and measurement ledger
Machine-readable measurements and settings records every current experiment, the source hash, counts, conversion frequency, expected scope and evidence limits. It distinguishes retained exports from browser-only observations. Functional-unit settings are inputs recorded from the UI; the CSV itself is not an independent settings snapshot.
Retained pipeline exports
| Export | Experiment |
|---|---|
| [[Lab 02 Programs/evidence/lab_02_program_1-pipeline-cycle-720.csv | 720 cycles]] |
| [[Lab 02 Programs/evidence/lab_02_program_1-pipeline-cycle-574.csv | 574 cycles]] |
| [[Lab 02 Programs/evidence/lab_02_program_1-pipeline-cycle-575.csv | 575 cycles]] |
| [[Lab 02 Programs/evidence/lab_02_program_1-pipeline-cycle-514.csv | 514 cycles]] |
| [[Lab 02 Programs/evidence/lab_02_program_1-pipeline-cycle-554.csv | 554 cycles]] |
Count executed rows by the presence of an E stage; discarded fetched rows must not count toward 268. Exported stall cells can overlap across instructions and do not sum to elapsed stall cycles.
Verification
Run python "50 Labs/Computer Architectures/Lab 02 Programs/verify.py" from the repository root. This uses the Python standard library to check retained CSV totals and executed instruction counts, FP stage latencies, manual calculations, source hash, and diagnostic source differences. It validates recorded artifacts; it does not rerun the simulator.
Other variants and submission artifacts
The alternate 267-instruction program loads bias before the loop and retains the valid feq.s/bnez zero-test sequence. A transcription preserving its executable instructions is retained with its private reference report. It has not been independently rerun in this comparison.
The personalized final PDF, editable report, original assignment and prepared ZIP are in 40 Projects/Computer Architectures/Lab 02 Submission/, excluded from the public website. Source snapshots here are the repository’s study copies. The final ZIP contains lab_02.pdf and program_1/program_1.s.