Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module text2nibble (
- input [7:0] i,
- output reg[3:0] o
- );
- always @(*)
- if (48 <= i && i <= 57)
- o = i - 48;
- else
- o = 15;
- endmodule
- module text2nibble_tb;
- reg [7:0] i;
- wire [3:0] o;
- text2nibble text2nibble_i (.i(i), .o(o));
- integer k;
- initial begin
- $display("Time\ti\ti_chr\to");
- $monitor("%0t\t%b\t%c\t%b(%d)", $time, i, i, o, o);
- i = 0;
- for (k = 1; k < 256; k = k + 1)
- #10 i = k;
- end
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement