Finite State Machine Datapath Design, Optimization, and Implementation