xTern: Energy-Efficient Ternary Neural Network Inference on RISC-V-Based Edge Systems (Full Report)