Ad-hoc HW/SW Architectures for DBMSs: a Co-Design Approach