Princeton-Cabernet / p4-projects

P4 codes for research projects
205 stars 56 forks source link

Important hash-related optimizations and cleanups: #6

Closed vgurevich closed 3 years ago

vgurevich commented 3 years ago
  1. Replaced hash-based 8-, 16- and 24-bit circular shifts (rotations) with the PHV ALU-based ones. As a result the hash unit usage has been significantly reduced, freeing them for other tasks.
  2. Replaced explicit Hash() extern instantiations and usage with @in_hash annotation (available in SDE-9.6.0 and later) to make the code more readable.
chenxiaoqino commented 3 years ago

Thanks a lot for simplifying the code!

The updated version produced the same hash value, tested under SDE 9.6.0 tofino_model.