I've written a piece of code with inputs (left) and (right) and output (result), each of which operand is a single bit, which returns a logical one in (result) if (left) has the same value as (right), and returns a logical zero otherwise. My code is: [code] module ModGc ( result, left, right); output result; input left, right;
typedef enum { L_NOT, L_NAND, L_NOR } GateType;
typedef struct packed { GateType gateTp; integer out; integer inLow; integer inHigh; } LogGate;
localparam integer nmGates = 4; localparam integer poolSize = 6; localparam LogGate specs [ nmGates:1] wire pool [ poolSize:1]; genvar ix;
initial begin specs[ 1].gateTp = L_NOR ; specs[ 1].out = 4; specs[ 1].inLow = 2; specs[ 1].inHigh = 3; specs[ 2].gateTp = L_NOT ; specs[ 2].out = 5; specs[ 2].inLow = 4; specs[ 2].inHigh = 0; specs[ 3].gateTp = L_NAND; specs[ 3].out = 6; specs[ 3].inLow = 2; specs[ 3].inHigh = 3; specs[ 4].gateTp = L_NOR ; specs[ 4].out = 1; specs[ 4].inLow = 5; specs[ 4].inHigh = 6; end assign pool[ 2] = left; assign pool[ 3] = right; for (ix = 1; ix