Hardware interview practice
Generate opcode-bijection stimulus
Write an oracle and compact stimulus constructors for a checker that decides whether two opcode traces use one consistent one-to-one renaming.
Reviewed example
Work through one case
Input
len_a=len_b=4; trace A=[1,2,1,0]; trace B=[9,6,9,4]Expected output
request_error=0; cause=ISO_OK; isomorphic=1The consistent one-to-one renaming is 1->9, 2->6, and 0->4. Repeated source opcode 1 maps to 9 both times, and no destination is shared by two sources.
What to cover
Requirements
- Construct positive traces from a one-to-one mapping of only the source symbols actually used.
- Provide one exact constructor each for unequal length, forward conflict, and reverse conflict.
- Use fresh forward and reverse valid/value tables for every oracle call and ignore inactive suffix entries.
- Treat either length above 16 as request_error and zero the functional result.
- Identify length, repeated-symbol presence, opcode-zero participation, expected cause, and result as follow-up coverage dimensions.
