Closed the 0ctf challenge
This commit is contained in:
parent
9e22bdef3b
commit
79e02c61ed
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
|||||||
$date
|
$date
|
||||||
Sat Dec 21 20:09:40 2024
|
Sun Dec 22 12:30:21 2024
|
||||||
$end
|
$end
|
||||||
$version
|
$version
|
||||||
Icarus Verilog
|
Icarus Verilog
|
||||||
@ -611,7 +611,7 @@ b10 1
|
|||||||
b1 0
|
b1 0
|
||||||
b0 /
|
b0 /
|
||||||
b101010 &
|
b101010 &
|
||||||
b110111100110000 %
|
b11000001101111 %
|
||||||
$end
|
$end
|
||||||
#0
|
#0
|
||||||
$dumpvars
|
$dumpvars
|
||||||
@ -1195,56 +1195,26 @@ b101000 (
|
|||||||
0t
|
0t
|
||||||
0'
|
0'
|
||||||
#85000000
|
#85000000
|
||||||
1r"
|
|
||||||
1j"
|
|
||||||
1b"
|
|
||||||
1Z"
|
|
||||||
14#
|
|
||||||
1,#
|
1,#
|
||||||
1p"
|
1$#
|
||||||
1h"
|
|
||||||
1`"
|
|
||||||
1X"
|
|
||||||
12#
|
|
||||||
1*#
|
1*#
|
||||||
b1111 y"
|
1"#
|
||||||
b1101111 _
|
b110000 _
|
||||||
b110 C#
|
b11 C#
|
||||||
1l
|
1g
|
||||||
b10 E"
|
b10 V"
|
||||||
1D"
|
1U"
|
||||||
1m
|
b11 D#
|
||||||
b10 A"
|
|
||||||
1@"
|
|
||||||
1n
|
|
||||||
b10 ="
|
|
||||||
1<"
|
|
||||||
b1111 z"
|
|
||||||
1o
|
|
||||||
b10 9"
|
|
||||||
18"
|
|
||||||
1h
|
1h
|
||||||
b10 R"
|
b10 R"
|
||||||
1Q"
|
1Q"
|
||||||
b110 D#
|
1~
|
||||||
1i
|
1}
|
||||||
b10 N"
|
b110000 r
|
||||||
1M"
|
|
||||||
1v
|
|
||||||
1u
|
|
||||||
1x
|
|
||||||
1w
|
|
||||||
1z
|
|
||||||
1y
|
|
||||||
1|
|
|
||||||
1{
|
|
||||||
1""
|
1""
|
||||||
1!"
|
1!"
|
||||||
b1101111 r
|
b110000 *
|
||||||
1$"
|
b110000 [
|
||||||
1#"
|
|
||||||
b1101111 *
|
|
||||||
b1101111 [
|
|
||||||
b101001 (
|
b101001 (
|
||||||
b100111 )
|
b100111 )
|
||||||
1s
|
1s
|
||||||
@ -1255,91 +1225,76 @@ b100111 )
|
|||||||
0t
|
0t
|
||||||
0'
|
0'
|
||||||
#87000000
|
#87000000
|
||||||
1<#
|
1r"
|
||||||
1b
|
1p"
|
||||||
1:#
|
1e
|
||||||
04#
|
1|"
|
||||||
1`
|
1d
|
||||||
1a
|
14#
|
||||||
02#
|
1$#
|
||||||
1,#
|
1c
|
||||||
1F#
|
1f
|
||||||
0Z"
|
0j"
|
||||||
1H#
|
0b"
|
||||||
1*#
|
1}"
|
||||||
b111 I#
|
12#
|
||||||
1G#
|
1"#
|
||||||
0X"
|
1~"
|
||||||
b1010 C#
|
b1111 !#
|
||||||
b10101110 _
|
1{"
|
||||||
b1110 y"
|
0h"
|
||||||
0l
|
0`"
|
||||||
b0 E"
|
b111 C#
|
||||||
0D"
|
b1111000 _
|
||||||
0@"
|
b1000 y"
|
||||||
0<"
|
1D"
|
||||||
08"
|
|
||||||
1U"
|
|
||||||
0M"
|
|
||||||
1i
|
|
||||||
b1 N"
|
|
||||||
1L"
|
|
||||||
1("
|
|
||||||
1'"
|
|
||||||
0g
|
|
||||||
b11 V"
|
|
||||||
1T"
|
|
||||||
1*"
|
|
||||||
1)"
|
|
||||||
1m
|
1m
|
||||||
b1 A"
|
b10 A"
|
||||||
1?"
|
1@"
|
||||||
1,"
|
1n
|
||||||
1+"
|
b10 ="
|
||||||
b111 B#
|
1<"
|
||||||
b100 D#
|
18"
|
||||||
0h
|
0g
|
||||||
b11 R"
|
b0 V"
|
||||||
1P"
|
0U"
|
||||||
1."
|
b110 D#
|
||||||
1-"
|
1i
|
||||||
1o
|
b10 N"
|
||||||
b1 9"
|
1M"
|
||||||
|
0l
|
||||||
|
b11 E"
|
||||||
|
1C"
|
||||||
|
10"
|
||||||
|
1/"
|
||||||
|
b1001 x"
|
||||||
|
b110 z"
|
||||||
|
0o
|
||||||
|
b11 9"
|
||||||
17"
|
17"
|
||||||
|
b110000 $
|
||||||
|
b110000 q
|
||||||
12"
|
12"
|
||||||
11"
|
11"
|
||||||
b1110 x"
|
1v
|
||||||
b1110 z"
|
1u
|
||||||
1n
|
1x
|
||||||
b1 ="
|
1w
|
||||||
1;"
|
1z
|
||||||
b1101111 $
|
1y
|
||||||
b1101111 q
|
1|
|
||||||
14"
|
1{
|
||||||
13"
|
0~
|
||||||
0v
|
0}
|
||||||
0u
|
b1101111 r
|
||||||
0x
|
1$"
|
||||||
0w
|
1#"
|
||||||
0z
|
1%#
|
||||||
0y
|
b110000 p
|
||||||
0|
|
|
||||||
0{
|
|
||||||
1~
|
|
||||||
1}
|
|
||||||
b110000 r
|
|
||||||
0$"
|
|
||||||
0#"
|
|
||||||
1["
|
|
||||||
1c"
|
|
||||||
1k"
|
|
||||||
1s"
|
|
||||||
1-#
|
1-#
|
||||||
b1101111 p
|
|
||||||
15#
|
|
||||||
b101000 )
|
b101000 )
|
||||||
b110000 *
|
b1101111 *
|
||||||
b110000 [
|
b1101111 [
|
||||||
b101010 (
|
b101010 (
|
||||||
1s
|
1s
|
||||||
1t
|
1t
|
||||||
@ -1349,70 +1304,83 @@ b101010 (
|
|||||||
0t
|
0t
|
||||||
0'
|
0'
|
||||||
#89000000
|
#89000000
|
||||||
0a
|
0$#
|
||||||
0`
|
0"#
|
||||||
0b
|
0f
|
||||||
0G#
|
1j"
|
||||||
0j"
|
0{"
|
||||||
1<#
|
0e
|
||||||
|
1h"
|
||||||
|
0c
|
||||||
|
0|"
|
||||||
|
0d
|
||||||
04#
|
04#
|
||||||
1,#
|
1r"
|
||||||
1$#
|
0b"
|
||||||
0H#
|
1Z"
|
||||||
0F#
|
0~"
|
||||||
0h"
|
b0 !#
|
||||||
1:#
|
0}"
|
||||||
02#
|
02#
|
||||||
1*#
|
1p"
|
||||||
1"#
|
0`"
|
||||||
b0 I#
|
1X"
|
||||||
0E#
|
b10 C#
|
||||||
b1010 y"
|
b101101 _
|
||||||
b10111010 _
|
b1101 y"
|
||||||
b1011 C#
|
1l
|
||||||
1g
|
b1 E"
|
||||||
b1 V"
|
0D"
|
||||||
0U"
|
0m
|
||||||
1h
|
b0 A"
|
||||||
b1 R"
|
0@"
|
||||||
|
0<"
|
||||||
|
1o
|
||||||
|
b1 9"
|
||||||
|
08"
|
||||||
0Q"
|
0Q"
|
||||||
b11 B#
|
|
||||||
0i
|
0i
|
||||||
b0 N"
|
b0 N"
|
||||||
0L"
|
0M"
|
||||||
0("
|
b10 B#
|
||||||
0'"
|
b10 D#
|
||||||
b1010 x"
|
1h
|
||||||
b1010 z"
|
b1 R"
|
||||||
0n
|
1P"
|
||||||
b0 ="
|
1."
|
||||||
0;"
|
1-"
|
||||||
04"
|
b1101 x"
|
||||||
03"
|
b1101 z"
|
||||||
b1011 D#
|
1n
|
||||||
1j
|
b1 ="
|
||||||
b1 J"
|
1;"
|
||||||
1H"
|
b1111000 $
|
||||||
b10101110 $
|
b1111000 q
|
||||||
b10101110 q
|
14"
|
||||||
16"
|
13"
|
||||||
15"
|
|
||||||
0K#
|
0K#
|
||||||
0~
|
0v
|
||||||
0}
|
0u
|
||||||
b0 r
|
0x
|
||||||
|
0w
|
||||||
|
0z
|
||||||
|
0y
|
||||||
|
0|
|
||||||
|
0{
|
||||||
0""
|
0""
|
||||||
0!"
|
0!"
|
||||||
0["
|
b0 r
|
||||||
05#
|
0$"
|
||||||
b10101110 p
|
0#"
|
||||||
1=#
|
1s"
|
||||||
|
b1111000 p
|
||||||
|
15#
|
||||||
0-
|
0-
|
||||||
0]
|
0]
|
||||||
0.
|
0.
|
||||||
b0 *
|
b0 *
|
||||||
b0 [
|
b0 [
|
||||||
b110111100000000 +
|
b11000000000000 +
|
||||||
b101001 )
|
b101001 )
|
||||||
1s
|
1s
|
||||||
1t
|
1t
|
||||||
@ -1424,7 +1392,7 @@ b101001 )
|
|||||||
#91000000
|
#91000000
|
||||||
0"
|
0"
|
||||||
0\
|
0\
|
||||||
b110111110101110 +
|
b11000001111000 +
|
||||||
b101010 )
|
b101010 )
|
||||||
1s
|
1s
|
||||||
1t
|
1t
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
`timescale 1us / 100ns
|
`timescale 1us / 100ns
|
||||||
|
|
||||||
module EzLogic_tb #(
|
module EzLogic_tb #(
|
||||||
parameter FLAG_TO_TEST = "o0",
|
parameter FLAG_TO_TEST = "0o",
|
||||||
parameter N = 42
|
parameter N = 42
|
||||||
)();
|
)();
|
||||||
reg clk;
|
reg clk;
|
||||||
|
|||||||
62
0ctf/EzLogic/run.py
Normal file
62
0ctf/EzLogic/run.py
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
import re
|
||||||
|
import math
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
def parse_time(ts):
|
||||||
|
microseconds = int((ts - ts.microsecond) * 1e6)
|
||||||
|
return datetime.now().timestamp() * 1e6 + microseconds
|
||||||
|
|
||||||
|
def read_vcd(filename, data_string):
|
||||||
|
with open(filename, 'r') as f:
|
||||||
|
lines = [line for line in f]
|
||||||
|
|
||||||
|
time_re = re.compile(r"(\d{3}):(\d{2}:(\d{2}.\d{6})|(\d{6}))")
|
||||||
|
times = []
|
||||||
|
data = {}
|
||||||
|
waveform = {}
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
match = time_re.match(line)
|
||||||
|
if not match:
|
||||||
|
continue
|
||||||
|
|
||||||
|
time = parse_time(datetime.strptime(match.group(1), "%H:%M:%S"))
|
||||||
|
times.append(time)
|
||||||
|
|
||||||
|
waveform_name = match.group(5) if match.group(5) else match.group(4)
|
||||||
|
data[waveform_name] = []
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
match = time_re.match(line)
|
||||||
|
if not match:
|
||||||
|
continue
|
||||||
|
|
||||||
|
time = parse_time(datetime.strptime(match.group(1), "%H:%M:%S"))
|
||||||
|
|
||||||
|
if time < min(times):
|
||||||
|
continue
|
||||||
|
|
||||||
|
waveform_name = match.group(5) if match.group(5) else match.group(4)
|
||||||
|
value = int(line.split()[2])
|
||||||
|
data[waveform_name].append((time, value))
|
||||||
|
|
||||||
|
# Extract the required data bits from the waveform
|
||||||
|
data_bits = []
|
||||||
|
for time, value in data["data_out"]:
|
||||||
|
if int(time) <= len(data_string) * 1e9:
|
||||||
|
data_bits.append(value)
|
||||||
|
|
||||||
|
# Reverse the order of the bits to match the hexadecimal string format
|
||||||
|
data_bits.reverse()
|
||||||
|
|
||||||
|
return times, data["data_out"], data_bits
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
filename = "shift_register.vcd"
|
||||||
|
data_string = "30789d5692f2fe23bb2c5d9e16406653b6cb217c952998ce17b7143788d949952680b4bce4c30a96c753"
|
||||||
|
times, data_out, data_bits = read_vcd(filename, data_string)
|
||||||
|
|
||||||
|
# Print the hexadecimal string and the corresponding waveform
|
||||||
|
print("Hexadecimal String:", data_string.upper())
|
||||||
|
for i in range(len(times)):
|
||||||
|
print("Time: {}\nData output: {}".format(datetime.fromtimestamp(times[i] / 1e6), " ".join(map(str, data_bits[i]))))
|
||||||
1519
0ctf/EzLogic/shift_register.vcd
Normal file
1519
0ctf/EzLogic/shift_register.vcd
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user