libfst 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,69 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'libfst'
4
+
5
+ fst = LibFST::Writer.new 'out.fst'
6
+
7
+ fst.set_date_string 'Wed Apr 17 21:40:39 2024'
8
+ fst.set_version_string __FILE__
9
+ fst.set_comment 'This is a comment'
10
+ fst.set_file_type :vhdl
11
+ fst.set_time_scale :ns
12
+
13
+ fst.set_scope(:vcd_module, name: 'testbench')
14
+ clk = fst.create_variable('clk', type: :sv_logic)
15
+ fst.set_scope(:vcd_module, name: 'uart')
16
+ rx = fst.create_variable('rx', type: :sv_logic, direction: :input)
17
+ data = fst.create_variable('data', type: :sv_logic, direction: :output, length: 8)
18
+ fst.create_variable(alias_of: clk, direction: :input)
19
+ cnt = fst.create_variable('cnt', type: :vcd_integer)
20
+ fst.set_upscope
21
+ fst.set_scope(:vcd_module, name: 'analog')
22
+ ch0 = fst.create_variable('ch0', type: :vcd_real)
23
+ fst.set_upscope
24
+ fst.set_upscope
25
+
26
+ message = 'Hello, world!'.bytes
27
+ clk_period = 1000
28
+ time = 0
29
+ fst.emit_time_change(time)
30
+ clock = 0
31
+ clk.value = clock
32
+ rx.value = 1
33
+ cnt.value = 0
34
+ counter = 0
35
+ byte = nil
36
+ bit_cnt = -2
37
+
38
+
39
+ loop do
40
+ time += clk_period
41
+ fst.emit_time_change(time)
42
+ ch0.value = 1.65 + 1.25*(Math.sin(2*Math::PI*4*time/1400000) + 0.5*(rand()-0.5))
43
+
44
+ clock ^= 1
45
+ clk.value = clock
46
+
47
+ counter += 1
48
+ if counter >= 10 then
49
+ counter = 0
50
+ bit_cnt += 1
51
+ if bit_cnt == -1 then # start bit
52
+ rx.value = 0
53
+ byte = message.shift
54
+ elsif bit_cnt < 8 then
55
+ break if byte.nil?
56
+ rx.value = byte[bit_cnt]
57
+ elsif bit_cnt == 8 then # stop bit 1
58
+ rx.value = 1
59
+ data.value = byte
60
+ else # stop bit 2
61
+ bit_cnt = -2
62
+ end
63
+ end
64
+ cnt.value = counter
65
+ end
66
+
67
+
68
+ fst.close # The writer instance should not be used after it has been closed
69
+
Binary file
data/samples/out.gtkw ADDED
@@ -0,0 +1,46 @@
1
+ [*]
2
+ [*] GTKWave Analyzer v3.3.114 (w)1999-2023 BSI
3
+ [*] Wed Apr 17 21:16:36 2024
4
+ [*]
5
+ [dumpfile] "/home/theotime/Documents/gitlab/libfst.rb/samples/out.fst"
6
+ [dumpfile_mtime] "Wed Apr 17 21:12:00 2024"
7
+ [dumpfile_size] 12182
8
+ [savefile] "/home/theotime/Documents/gitlab/libfst.rb/samples/out.gtkw"
9
+ [timestart] 0
10
+ [size] 990 397
11
+ [pos] 351 815
12
+ *-19.029329 451000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
13
+ [treeopen] testbench.
14
+ [sst_width] 270
15
+ [signals_width] 148
16
+ [sst_expanded] 1
17
+ [sst_vpaned_height] 97
18
+ @10022
19
+ [color] 3
20
+ testbench.analog.ch0
21
+ @20000
22
+ -
23
+ -
24
+ -
25
+ @22
26
+ testbench.clk
27
+ @420
28
+ [color] 6
29
+ testbench.uart.cnt
30
+ @28
31
+ testbench.uart.rx
32
+ @c00820
33
+ testbench.uart.data[7:0]
34
+ @28
35
+ (0)testbench.uart.data[7:0]
36
+ (1)testbench.uart.data[7:0]
37
+ (2)testbench.uart.data[7:0]
38
+ (3)testbench.uart.data[7:0]
39
+ (4)testbench.uart.data[7:0]
40
+ (5)testbench.uart.data[7:0]
41
+ (6)testbench.uart.data[7:0]
42
+ (7)testbench.uart.data[7:0]
43
+ @1401200
44
+ -group_end
45
+ [pattern_trace] 1
46
+ [pattern_trace] 0
data/samples/read2.rb ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'libfst'
4
+
5
+ fst = LibFST::Reader.new 'skinny_rand.fst'
6
+
7
+ puts fst.root.tree
8
+
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'libfst'
4
+
5
+ fst = LibFST::Reader.new 'out.fst'
6
+
7
+ puts fst.root.tree
8
+
Binary file
@@ -0,0 +1,39 @@
1
+ [*]
2
+ [*] GTKWave Analyzer v3.3.116 (w)1999-2023 BSI
3
+ [*] Tue May 21 09:46:25 2024
4
+ [*]
5
+ [dumpfile] "/home/theotime/Documents/gitlab/libfst.rb/samples/transaction_filter_process/full_boot.fst"
6
+ [dumpfile_mtime] "Mon May 13 08:40:48 2024"
7
+ [dumpfile_size] 16822
8
+ [savefile] "/home/theotime/Documents/gitlab/libfst.rb/samples/transaction_filter_process/full_boot.gtkw"
9
+ [timestart] 39796500
10
+ [size] 3486 534
11
+ [pos] -1 -1
12
+ *-16.663563 40003820 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
13
+ [sst_width] 258
14
+ [signals_width] 329
15
+ [sst_expanded] 1
16
+ [sst_vpaned_height] 118
17
+ @28
18
+ clk
19
+ cmd
20
+ dat0
21
+ @10c00028
22
+ [transaction_args] ""
23
+ ^<1 /home/theotime/Documents/gitlab/libfst.rb/samples/transaction_filter_process/sdcard.rb
24
+ #{sdcard} clk cmd
25
+ @28
26
+ clk
27
+ cmd
28
+ @1401200
29
+ -group_end
30
+ @200
31
+ -
32
+ @28
33
+ uart
34
+ @10000028
35
+ [transaction_args] "baudrate = 115200"
36
+ ^<2 /home/theotime/Documents/gitlab/libfst.rb/samples/transaction_filter_process/uart.rb
37
+ +{uart_decode} uart
38
+ [pattern_trace] 1
39
+ [pattern_trace] 0