2 * yosys -- Yosys Open SYnthesis Suite
4 * Copyright (C) 2022 Miodrag Milanovic <micko@yosyshq.com>
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
23 #include "kernel/yosys.h"
24 #include "libs/fst/fstapi.h"
28 typedef std::function
<void(uint64_t)> CallbackFunction
;
29 struct fst_end_of_data_exception
{ };
44 FstData(std::string filename
);
47 uint64_t getStartTime();
48 uint64_t getEndTime();
50 std::vector
<FstVar
>& getVars() { return vars
; };
52 void reconstruct_callback_attimes(uint64_t pnt_time
, fstHandle pnt_facidx
, const unsigned char *pnt_value
, uint32_t plen
);
53 void reconstructAllAtTimes(std::vector
<fstHandle
> &signal
, uint64_t start_time
, uint64_t end_time
, CallbackFunction cb
);
55 std::string
valueOf(fstHandle signal
);
56 fstHandle
getHandle(std::string name
);
57 dict
<int,fstHandle
> getMemoryHandles(std::string name
);
58 double getTimescale() { return timescale
; }
59 const char *getTimescaleString() { return timescale_str
.c_str(); }
61 void extractVarNames();
63 struct fstReaderContext
*ctx
;
64 std::vector
<FstVar
> vars
;
65 std::map
<fstHandle
, FstVar
> handle_to_var
;
66 std::map
<std::string
, fstHandle
> name_to_handle
;
67 std::map
<std::string
, dict
<int, fstHandle
>> memory_to_handle
;
68 std::map
<fstHandle
, std::string
> last_data
;
70 std::map
<fstHandle
, std::string
> past_data
;
73 std::string timescale_str
;
76 CallbackFunction callback
;
77 std::vector
<fstHandle
> clk_signals
;