Saturday, October 27, 2018

Interview Question 29: Find the function of the module

 

This interview question is simple. You are asked to guess the functionality of this module. I think the question is very simple. It is designed to check your attitude and approach to solve a problem. It is checking your grit. Give it a try. 

module Guess (

   input   [3:0] data,

   output  [2:0] guess,

);

logic a,b,c,d;

assign {a,b,c,d} = data[3:0];

assign guess[0] = ^data;

assign guess[1] =  ((a ^ b) & (c | d)) |

                           ((a ^ c) & (b | d)) |

                           ((a ^ d) & (b | c)) |

                           ((b ^ c) & (a | d)) |

                           ((b ^ d) & (a | c)) |

                           ((c ^ d) & (a | b)) ;

assign guess[2] = &data;

endmodule