hamming fix
This commit is contained in:
parent
1ec83b26a1
commit
7466f916d3
@ -1,5 +1,5 @@
|
|||||||
$date
|
$date
|
||||||
Tue Oct 8 14:33:58 2024
|
Wed Nov 6 15:42:14 2024
|
||||||
$end
|
$end
|
||||||
$version
|
$version
|
||||||
Icarus Verilog
|
Icarus Verilog
|
||||||
@ -8,25 +8,31 @@ $timescale
|
|||||||
1s
|
1s
|
||||||
$end
|
$end
|
||||||
$scope module htb $end
|
$scope module htb $end
|
||||||
$var reg 8 ! value1 [7:0] $end
|
$var wire 4 ! hammingValue [3:0] $end
|
||||||
$var reg 8 " value2 [7:0] $end
|
$var reg 8 " value1 [7:0] $end
|
||||||
|
$var reg 8 # value2 [7:0] $end
|
||||||
$scope module uut $end
|
$scope module uut $end
|
||||||
$var wire 8 # value1 [7:0] $end
|
$var wire 8 $ value1 [7:0] $end
|
||||||
$var wire 8 $ value2 [7:0] $end
|
$var wire 8 % value2 [7:0] $end
|
||||||
$var reg 4 % hammingValue [3:0] $end
|
$var reg 4 & hammingValue [3:0] $end
|
||||||
$var integer 32 & i [31:0] $end
|
$var integer 32 ' i [31:0] $end
|
||||||
$upscope $end
|
$upscope $end
|
||||||
$upscope $end
|
$upscope $end
|
||||||
$enddefinitions $end
|
$enddefinitions $end
|
||||||
#0
|
#0
|
||||||
$dumpvars
|
$dumpvars
|
||||||
b1000 &
|
b1000 '
|
||||||
b0 %
|
b100 &
|
||||||
bz $
|
b10111111 %
|
||||||
bz #
|
b10110000 $
|
||||||
b10111111 "
|
b10111111 #
|
||||||
b10110000 !
|
b10110000 "
|
||||||
|
b100 !
|
||||||
$end
|
$end
|
||||||
#10
|
#10
|
||||||
b10111111 !
|
b1000 '
|
||||||
|
b0 !
|
||||||
|
b0 &
|
||||||
|
b10111111 "
|
||||||
|
b10111111 $
|
||||||
#20
|
#20
|
||||||
|
@ -7,72 +7,72 @@
|
|||||||
:vpi_module "/usr/lib/x86_64-linux-gnu/ivl/vhdl_textio.vpi";
|
:vpi_module "/usr/lib/x86_64-linux-gnu/ivl/vhdl_textio.vpi";
|
||||||
:vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2005_math.vpi";
|
:vpi_module "/usr/lib/x86_64-linux-gnu/ivl/v2005_math.vpi";
|
||||||
:vpi_module "/usr/lib/x86_64-linux-gnu/ivl/va_math.vpi";
|
:vpi_module "/usr/lib/x86_64-linux-gnu/ivl/va_math.vpi";
|
||||||
S_0x555b2f00bc50 .scope module, "htb" "htb" 2 1;
|
S_0x55be1d5c3f90 .scope module, "htb" "htb" 2 1;
|
||||||
.timescale 0 0;
|
.timescale 0 0;
|
||||||
v0x555b2f01d190_0 .var "value1", 7 0;
|
v0x55be1d5d5ae0_0 .net "hammingValue", 3 0, v0x55be1d58ab00_0; 1 drivers
|
||||||
v0x555b2f01d270_0 .var "value2", 7 0;
|
v0x55be1d5d5bd0_0 .var "value1", 7 0;
|
||||||
S_0x555b2f00bde0 .scope module, "uut" "hamming" 2 7, 3 1 0, S_0x555b2f00bc50;
|
v0x55be1d5d5ca0_0 .var "value2", 7 0;
|
||||||
|
S_0x55be1d5c4120 .scope module, "uut" "hamming" 2 7, 3 1 0, S_0x55be1d5c3f90;
|
||||||
.timescale 0 0;
|
.timescale 0 0;
|
||||||
.port_info 0 /INPUT 8 "value1";
|
.port_info 0 /INPUT 8 "value1";
|
||||||
.port_info 1 /INPUT 8 "value2";
|
.port_info 1 /INPUT 8 "value2";
|
||||||
.port_info 2 /OUTPUT 4 "hammingValue";
|
.port_info 2 /OUTPUT 4 "hammingValue";
|
||||||
v0x555b2efd27f0_0 .var "hammingValue", 3 0;
|
v0x55be1d58ab00_0 .var "hammingValue", 3 0;
|
||||||
v0x555b2efd2c00_0 .var/i "i", 31 0;
|
v0x55be1d58af10_0 .var/i "i", 31 0;
|
||||||
o0x7f3f4267c078 .functor BUFZ 8, C4<zzzzzzzz>; HiZ drive
|
v0x55be1d5d58c0_0 .net "value1", 7 0, v0x55be1d5d5bd0_0; 1 drivers
|
||||||
v0x555b2f01cf70_0 .net "value1", 7 0, o0x7f3f4267c078; 0 drivers
|
v0x55be1d5d5980_0 .net "value2", 7 0, v0x55be1d5d5ca0_0; 1 drivers
|
||||||
o0x7f3f4267c0a8 .functor BUFZ 8, C4<zzzzzzzz>; HiZ drive
|
E_0x55be1d589690 .event edge, v0x55be1d5d58c0_0, v0x55be1d5d5980_0, v0x55be1d58ab00_0;
|
||||||
v0x555b2f01d030_0 .net "value2", 7 0, o0x7f3f4267c0a8; 0 drivers
|
.scope S_0x55be1d5c4120;
|
||||||
E_0x555b2f00a130 .event edge, v0x555b2f01cf70_0, v0x555b2f01d030_0, v0x555b2efd27f0_0;
|
|
||||||
.scope S_0x555b2f00bde0;
|
|
||||||
T_0 ;
|
T_0 ;
|
||||||
%pushi/vec4 0, 0, 32;
|
%pushi/vec4 0, 0, 32;
|
||||||
%store/vec4 v0x555b2efd2c00_0, 0, 32;
|
%store/vec4 v0x55be1d58af10_0, 0, 32;
|
||||||
%end;
|
%end;
|
||||||
.thread T_0;
|
.thread T_0;
|
||||||
.scope S_0x555b2f00bde0;
|
.scope S_0x55be1d5c4120;
|
||||||
T_1 ;
|
T_1 ;
|
||||||
%wait E_0x555b2f00a130;
|
%wait E_0x55be1d589690;
|
||||||
%pushi/vec4 0, 0, 4;
|
%pushi/vec4 0, 0, 4;
|
||||||
%store/vec4 v0x555b2efd27f0_0, 0, 4;
|
%store/vec4 v0x55be1d58ab00_0, 0, 4;
|
||||||
%pushi/vec4 0, 0, 32;
|
%pushi/vec4 0, 0, 32;
|
||||||
%store/vec4 v0x555b2efd2c00_0, 0, 32;
|
%store/vec4 v0x55be1d58af10_0, 0, 32;
|
||||||
T_1.0 ;
|
T_1.0 ;
|
||||||
%load/vec4 v0x555b2efd2c00_0;
|
%load/vec4 v0x55be1d58af10_0;
|
||||||
%cmpi/s 8, 0, 32;
|
%cmpi/s 8, 0, 32;
|
||||||
%jmp/0xz T_1.1, 5;
|
%jmp/0xz T_1.1, 5;
|
||||||
%load/vec4 v0x555b2f01cf70_0;
|
%load/vec4 v0x55be1d5d58c0_0;
|
||||||
%load/vec4 v0x555b2efd2c00_0;
|
%load/vec4 v0x55be1d58af10_0;
|
||||||
%part/s 1;
|
%part/s 1;
|
||||||
%load/vec4 v0x555b2f01d030_0;
|
%load/vec4 v0x55be1d5d5980_0;
|
||||||
%load/vec4 v0x555b2efd2c00_0;
|
%load/vec4 v0x55be1d58af10_0;
|
||||||
%part/s 1;
|
%part/s 1;
|
||||||
%cmp/e;
|
%cmp/ne;
|
||||||
%jmp/0xz T_1.2, 4;
|
%jmp/0xz T_1.2, 4;
|
||||||
%load/vec4 v0x555b2efd27f0_0;
|
%load/vec4 v0x55be1d58ab00_0;
|
||||||
%addi 1, 0, 4;
|
%addi 1, 0, 4;
|
||||||
%store/vec4 v0x555b2efd27f0_0, 0, 4;
|
%store/vec4 v0x55be1d58ab00_0, 0, 4;
|
||||||
T_1.2 ;
|
T_1.2 ;
|
||||||
%load/vec4 v0x555b2efd2c00_0;
|
%load/vec4 v0x55be1d58af10_0;
|
||||||
%addi 1, 0, 32;
|
%addi 1, 0, 32;
|
||||||
%store/vec4 v0x555b2efd2c00_0, 0, 32;
|
%store/vec4 v0x55be1d58af10_0, 0, 32;
|
||||||
%jmp T_1.0;
|
%jmp T_1.0;
|
||||||
T_1.1 ;
|
T_1.1 ;
|
||||||
%jmp T_1;
|
%jmp T_1;
|
||||||
.thread T_1, $push;
|
.thread T_1, $push;
|
||||||
.scope S_0x555b2f00bc50;
|
.scope S_0x55be1d5c3f90;
|
||||||
T_2 ;
|
T_2 ;
|
||||||
%vpi_call 2 12 "$dumpfile", "ham.vcd" {0 0 0};
|
%vpi_call 2 14 "$dumpfile", "ham.vcd" {0 0 0};
|
||||||
%vpi_call 2 13 "$dumpvars" {0 0 0};
|
%vpi_call 2 15 "$dumpvars" {0 0 0};
|
||||||
%pushi/vec4 176, 0, 8;
|
%pushi/vec4 176, 0, 8;
|
||||||
%store/vec4 v0x555b2f01d190_0, 0, 8;
|
%store/vec4 v0x55be1d5d5bd0_0, 0, 8;
|
||||||
%pushi/vec4 191, 0, 8;
|
%pushi/vec4 191, 0, 8;
|
||||||
%store/vec4 v0x555b2f01d270_0, 0, 8;
|
%store/vec4 v0x55be1d5d5ca0_0, 0, 8;
|
||||||
%delay 10, 0;
|
%delay 10, 0;
|
||||||
%pushi/vec4 191, 0, 8;
|
%pushi/vec4 191, 0, 8;
|
||||||
%store/vec4 v0x555b2f01d190_0, 0, 8;
|
%store/vec4 v0x55be1d5d5bd0_0, 0, 8;
|
||||||
%pushi/vec4 191, 0, 8;
|
%pushi/vec4 191, 0, 8;
|
||||||
%store/vec4 v0x555b2f01d270_0, 0, 8;
|
%store/vec4 v0x55be1d5d5ca0_0, 0, 8;
|
||||||
%delay 10, 0;
|
%delay 10, 0;
|
||||||
|
%vpi_call 2 18 "$display", v0x55be1d5d5ae0_0 {0 0 0};
|
||||||
%end;
|
%end;
|
||||||
.thread T_2;
|
.thread T_2;
|
||||||
# The file index is used to find the file name in the following table.
|
# The file index is used to find the file name in the following table.
|
||||||
|
@ -9,7 +9,7 @@ integer i = 0;
|
|||||||
always @(*) begin
|
always @(*) begin
|
||||||
hammingValue = 0;
|
hammingValue = 0;
|
||||||
for(i = 0; i < 8; i = i+1) begin
|
for(i = 0; i < 8; i = i+1) begin
|
||||||
if (value1[i] == value2[i]) begin
|
if (value1[i] != value2[i]) begin
|
||||||
hammingValue = hammingValue + 1;
|
hammingValue = hammingValue + 1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -15,5 +15,6 @@ initial begin
|
|||||||
$dumpvars;
|
$dumpvars;
|
||||||
value1 = 8'hB0; value2 = 8'hBF; #10;
|
value1 = 8'hB0; value2 = 8'hBF; #10;
|
||||||
value1 = 8'hBF; value2 = 8'hBF; #10;
|
value1 = 8'hBF; value2 = 8'hBF; #10;
|
||||||
|
$display(hammingValue);
|
||||||
end
|
end
|
||||||
endmodule
|
endmodule
|
Loading…
x
Reference in New Issue
Block a user