Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

HELP ME PUT THIS IN A BEHAVIROL MODEL IN VERILOG CODE. `timescale 1ns / 1ps modu

ID: 2294176 • Letter: H

Question

HELP ME PUT THIS IN A BEHAVIROL MODEL IN VERILOG CODE.

`timescale 1ns / 1ps

module Ins_Decoder(

input [3:0] opcode,

output[13:0] control

);

and(control[13],A, B, C);

and(control[12],A,~C,D);

and(control[11], A,B,~D);

and(control[10],A,~B,D);

and(control[9], A,C,~D);

and(control[8],A,~B,~C);

and(control[7],~A,B,C,D);

and(control[6],B,C,~D);

and(control[5],~A,B,~C,D);

and(control[4],~A,B,~C,~D);

and(control[3],~ A,~B,C,D);

and(control[2],~ A,~B,C,~D);

and(control[1], ~B,~C,D);

and(control[0], ~A,~B,~C,~D);

endmodule

Explanation / Answer

`timescale 1ns / 1ps

module Ins_Decoder(

input [3:0] opcode,

reg output[13:0] control

);

always @(*)

begin

if (A=0 & B=0 & C=0 & D=0)

begin

control[0]<=1'b1;

else

control[0]<=1'b0;

end

if (B=0 & C=0 & D=1)

begin

control[1]<=1'b1;

else

control[1]<=1'b0;

end

if (A=0 & B=0 & C=1 & D=0)

begin

control[2]<=1'b1;

else

control[2]<=1'b0;

end

if (A=0 & B=0 & C=1 & D=1)

begin

control[3]<=1'b1;

else

control[3]<=1'b0;

end

if (A=0 & B=1 & C=0 & D=0)

begin

control[4]<=1'b1;

else

control[4]<=1'b0;

end

if (A=0 & B=1 & C=0 & D=1)

begin

control[5]<=1'b1;

else

control[5]<=1'b0;

end

if ( B=1 & C=1 & D=0)

begin

control[6]<=1'b1;

else

control[6]<=1'b0;

end

if (A=0 & B=1 & C=1 & D=1)

begin

control[7]<=1'b1;

else

control[7]<=1'b0;

end

if (A=1 & B=0 & C=0 )

begin

control[8]<=1'b1;

else

control[8]<=1'b0;

end

if (A=1 & C=1 & D=0)

begin

control[9]<=1'b1;

else

control[9]<=1'b0;

end

if (A=1 & B=0 & D=1)

begin

control[10]<=1'b1;

else

control[10]<=1'b0;

end

if (A=1 & B=1 & D=0)

begin

control[11]<=1'b1;

else

control[11]<=1'b0;

end

if (A=1 & C=0 & D=1)

begin

control[12]<=1'b1;

else

control[12]<=1'b0;

end

if (A=1 & B=1 & C=1)

begin

control[13]<=1'b1;

else

control[13]<=1'b0;

end

endmodule