I need a verilog module code to support the conditional oper
I need a verilog module code to support the conditional operator of C(module just fot this) for the following given pseudo computer.
Instruction Set (ISA) . 19-bit Instructions [LSB is bit 0; MSB is bit 17] . 4-bit Opcodes: 16 instructions* this will expand in the future */ 32-entry Register File 32-bit data words; 18-bit instructions -- data: only natural integers for now (0 to 2**32 1); . no negative numbers or floating point Opcod Opcodee (4-bits) Mne- Operands OperandsSyntax SourceDesti-nation InstructionInstruction Instruction Meaning Fields moniC 17-15: opcode 14-10: Rsrc1 add Rsrcl, | Rsrc1, Rsrc2 RtgtRsrc1+ Rsre2 0000add Rtgt Rsrc2, Rtgt9-5: Rsrc2 sub Rsrc1, xor Rsrc1, 4-0: Rtgt Rsrc1, 0001subRsrc2 0010 xor Rsrc2 0011 mul2 Rsrc1 Rtgt Rsrc2, Rtgt Rtgt Rsrc2, Rtgt Rtgt RtgtSolution
Arithmetic Operators
 I There are two types of operators: binary and unary
 I Binary operators:
 I add(+), subtract(-), multiply(*), divide(/), power(**), modulus(%)
 //suppose that: a = 4\'b0011;
 // b = 4\'b0100;
 // d = 6; e = 4; f = 2;
 //then,
 a + b //add a and b; evaluates to 4\'b0111
 b - a //subtract a from b; evaluates to 4\'b0001
 a * b //multiply a and b; evaluates to 4\'b1100
 d / e //divide d by e, evaluates to 4\'b0001. Truncates fractional part
 e ** f //raises e to the power f, evaluates to 4\'b1111
 //power operator is most likely not synthesible
I The logic gate realization depends on several variables
 I coding style
 I synthesis tool used
 I synthesis constraints (more later on this)
 I So, when we say \"+\", is it a...
 I ripple-carry adder
 I look-ahead-carry adder (how many bits of lookahead to be used?)
 I carry-save adder
 When writing RTL code, keep in mind what will eventually be needed
 Continually thinking about structure, timing, size, power
 Verilog - Operators
 Arithmetic Operators (cont.)
 16-bit adder with loose constraints:
 set_max_delay 2 [get_ports sum*]
 max delay = 0.8ns, area = 472 = 85 gates
Logical Operators
 I Verilog Logical Operators
 I logical-and(&&) //binary operator
 I logical-or(jj) //binary operator
 I logical-not(!) //unary operator
 //suppose that: a = 3 and b = 0, then...
 (a && b) //evaluates to zero
 (b || a) //evaluates to one
 (!a) //evaluates to 0
 (!b) //evaluates to 1
 //with unknowns: a = 2\'b0x; b = 2\'b10;
 (a && b) // evaluates to x
 //with expressions...
 (a == 2) && (b == 3) //evaluates to 1 only if both comparisons are true
Equality Operators - \"LT\" is big and slow
 //8-bit less than detector
 //if a is less than b, output is logic one
 module less8(
 input [7:0] a,b,
 output z
 );
 assign z = (a < b) ? 1\'b1 : 1\'b0;//let a = 4, b = 3, and...
 //x = 4\'b1010, y = 4\'b1101,
 //z = 4\'b1xxz, m = 4\'b1xxz, n = 4\'b1xxx
 a == b //evaluates to logical 0
 x != y //evaluates to logical 1
 x == z //evaluates to x
 z === m //evaluates to logical 1
 z === n //evaluates to logical 0
 m !== n //evaluates to logical 1
 endmodule


