Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- 8 to 3 Line Encoder using Task
- */
- module ENC8TO3TASK (
- input [7:0] in,
- output [2:0] out);
- always@(*)
- taskenc8to3(in, out);
- task taskenc8to3;
- input [7:0] IN;
- output reg [2:0] OUT;
- if(IN == 8'b0000_0001) OUT = 0;
- else if(IN == 8'b0000_0010) OUT = 1;
- else if(IN == 8'b0000_0100) OUT = 2;
- else if(IN == 8'b0000_1000) OUT = 3;
- else if(IN == 8'b0001_0000) OUT = 4;
- else if(IN == 8'b0010_0000) OUT = 5;
- else if(IN == 8'b0100_0000) OUT = 6;
- else if(IN == 8'b1000_0000) OUT = 7;
- endtask
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment