#!/bin/bash
set -e

rm -f pdp_sim pdp8.vcd sim.log

iverilog -g2012 -o pdp_sim \
  RAM.v \
  "74 series.v" \
  brg.v \
  uart.v \
  Teletype.v \
  blk_ram16kx12.v \
  Main_comps.v \
  Datapath.v \
  PDP_cpu.v \
  PDP_top.v \
  PDP_simulation.v

vvp pdp_sim | tee sim.log

echo
echo "Simulation completed."
echo "Log file:      sim.log"
echo "Waveform file: pdp8.vcd"
echo
echo "To open the waveform viewer:"
echo "  surfer pdp8.vcd"

# surfer pdp8.vcd