Prev Problem
Next Problem

67. Decoder

Back To All Submissions
Previous Submission
Next Submission

Solving Approach

How do you plan to solve it?

 

Code

/*Write your code here*/
module decoder3to8(
    input [2:0] s,
    output [7:0] y
);
integer i;
reg [7:0] temp;
always @* begin
    temp = 8'd0;
for(i = 0;i<8;i= i+1) begin
    if(s==i) temp[i] = 1'b1;
end

end
assign y = temp;
endmodule

 

Was this helpful?
Upvote
Downvote