11 lines
514 B
Systemverilog
11 lines
514 B
Systemverilog
module tb;
|
|
logic [7:0] value, bits; logic [3:0] hex_high, hex_low; logic [8:0] weighted_sum; string trace_file;
|
|
positional_encoding dut(.*);
|
|
initial begin
|
|
if ($value$plusargs("trace=%s", trace_file)) begin $dumpfile(trace_file); $dumpvars(0, tb); end
|
|
value = 8'hAD; #1;
|
|
if (bits !== 8'b10101101 || hex_high !== 4'hA || hex_low !== 4'hD || weighted_sum !== 9'd173) $fatal(1, "encoding mismatch");
|
|
$display("PASS task01 value=173 binary=10101101 hex=AD weighted=173"); $finish;
|
|
end
|
|
endmodule
|