summary |
shortlog | log |
commit |
commitdiff |
tree
first ⋅ prev ⋅ next
Lukáš Jiřiště [Sun, 23 Feb 2025 19:34:59 +0000 (20:34 +0100)]
Add automatic refresh after simulation step (next)
Lukáš Jiřiště [Thu, 26 Dec 2024 21:26:02 +0000 (22:26 +0100)]
Merge overlapping segments after drawing
Lukáš Jiřiště [Sat, 21 Dec 2024 22:06:45 +0000 (23:06 +0100)]
Add wire (node) drawing to schema mode
Using the "c" key while in schema mode will start the drawing.
When it is started over an existing node, the node is extended, else new
node is created.
When ending on a node, the drawn node and the end node are merged
together.
To exit the mode use any other key than the movement keys (best use
"c"?).
To choose the correct symbol for a segment, the t_node_segment had to be
changed, and with that some functions (unrelated to wire drawing) had to
be changed also.
Lukáš Jiřiště [Sat, 21 Dec 2024 11:11:47 +0000 (12:11 +0100)]
Switch from pointers to IDs
Mosfets holding pointers to nodes (and nodes to mosfets) causes problems
when the nodes (or mosfets) vector reallocates. The reallocation
invalidates any pointers.
Holding the ID prevents the invalidation, but may cause performance
issues as the vector needs to be searched for the ID (binary search
would help and is applicable).
The IDs also make the code more networked, because the nodes and mosfets
vectors need to be passed to many more functions.
Lukáš Jiřiště [Sat, 21 Dec 2024 07:04:32 +0000 (08:04 +0100)]
Add tags to .gitignore
Lukáš Jiřiště [Fri, 20 Dec 2024 17:59:53 +0000 (18:59 +0100)]
Fix merge_nodes not transferring "gate mosfets"
Because mosfets were not listed in their gate nodes, they were bot
transferred during node merge.
This is fixed by adding a vector to node, that saves all mosfets
connected through gate.
The connected vector of node was not used, as the "gate mosfets" would
have to be filtered in simulation.
Lukáš Jiřiště [Fri, 20 Dec 2024 17:02:57 +0000 (18:02 +0100)]
Add some node graphics
When adding MOSFETs in the schema mode, a node is spawned for each of
the terminal. It is also bound and the terminal "position" is used for
its single segment.
I am not satisfied with how the position and symbol of this terminal
segment is obtained, but I cannot think about a more elegant way at this
time.
Lukáš Jiřiště [Thu, 19 Dec 2024 08:49:16 +0000 (09:49 +0100)]
Add refresh command
This command refreshes the schema window with new states of mosfets (and
nodes in future).
Lukáš Jiřiště [Thu, 19 Dec 2024 08:52:25 +0000 (09:52 +0100)]
Fix switch symbols for opening
I have swapped the vertical and horizontal line.
Lukáš Jiřiště [Wed, 18 Dec 2024 22:16:30 +0000 (23:16 +0100)]
Implement "graphical" way to add mosfets
Lukáš Jiřiště [Wed, 18 Dec 2024 14:53:21 +0000 (15:53 +0100)]
Prepare structures for graphics
Lukáš Jiřiště [Wed, 18 Dec 2024 12:22:10 +0000 (13:22 +0100)]
Fix connect command
The problem was in the merge_nodes function, where a level of
indirection was missed - the vector connected (mosfets) of a node holds
pointers to mosfets, hence the ft_vec_access return t_mosfet**.
Lukáš Jiřiště [Wed, 18 Dec 2024 12:14:36 +0000 (13:14 +0100)]
Update Libft, switch to using IDs for objects
The ft_vec_find functions were updated, which necessitated some changes
in the code.
So now the nodes and MOSFETs use unique IDs instead of just their index
in the main vectors. Some hardening was done while switching.
Some minor bugs might also be present in this commit.
Lukáš Jiřiště [Sun, 15 Dec 2024 22:42:04 +0000 (23:42 +0100)]
Implement switching to schematic mode and movement
Lukáš Jiřiště [Sun, 15 Dec 2024 17:57:20 +0000 (18:57 +0100)]
Swap functionality of p- and n-channel FETs
I probably got confused when assigning the functionality.
We can be generous and say I'm switching the MOSFETS from depletion mode
to enhancement mode.
Lukáš Jiřiště [Sun, 15 Dec 2024 15:46:39 +0000 (16:46 +0100)]
Add help for connect, make help more consistent
Lukáš Jiřiště [Sun, 15 Dec 2024 15:14:41 +0000 (16:14 +0100)]
Fix missing newline
Lukáš Jiřiště [Sun, 15 Dec 2024 15:07:52 +0000 (16:07 +0100)]
Group WINDOW* to a struct, add border
The structure makes manipulation of windows easier.
Lukáš Jiřiště [Sun, 15 Dec 2024 14:52:03 +0000 (15:52 +0100)]
Use 2 windows
One is used for the commands and the second one will be used for ASCII
representation of the circuitry.
Lukáš Jiřiště [Sun, 15 Dec 2024 14:01:49 +0000 (15:01 +0100)]
Change the default colors to the terminal default.
Lukáš Jiřiště [Sun, 15 Dec 2024 13:20:09 +0000 (14:20 +0100)]
Add connect command
This makes wiring up mosfets together noticeably easier.
The bind and addnode commands may be rendered somewhat useless by this.
Lukáš Jiřiště [Sun, 15 Dec 2024 13:19:36 +0000 (14:19 +0100)]
Harden find_connected against nullptr
Lukáš Jiřiště [Sun, 15 Dec 2024 07:20:33 +0000 (08:20 +0100)]
Use ncurses library
Every printing function had to be replaced.
Color is handled differently.
A function was commented out, because I did not want to think about how
to integrate it now.
Lukáš Jiřiště [Sun, 15 Dec 2024 07:30:30 +0000 (08:30 +0100)]
Update Libft and Makefile
Lukáš Jiřiště [Sat, 2 Mar 2024 18:33:30 +0000 (19:33 +0100)]
Implement alternate screen usage
This is an entry point to possible "graphics".
Lukáš Jiřiště [Wed, 21 Feb 2024 21:25:57 +0000 (22:25 +0100)]
Refactor cleanup from main function.
Lukáš Jiřiště [Mon, 19 Feb 2024 22:12:48 +0000 (23:12 +0100)]
Add indications for opening and closing FETs
Lukáš Jiřiště [Mon, 19 Feb 2024 21:40:29 +0000 (22:40 +0100)]
Add samples of logic gates
Lukáš Jiřiště [Mon, 19 Feb 2024 21:39:38 +0000 (22:39 +0100)]
Add visualization of whether a FET is opened or not
Lukáš Jiřiště [Mon, 19 Feb 2024 21:02:17 +0000 (22:02 +0100)]
Fix a leak caused by repeating command by no input
When no command is given, the previous action happens. But this action
did not clean the input string "\n", which caused a leak.
Lukáš Jiřiště [Mon, 19 Feb 2024 20:59:04 +0000 (21:59 +0100)]
Make FET_sim able to take input from a file
The first argument is taken as a filename which FET_sim reads as it
would read standard input. After EOF it switches to STDIN input.
Lukáš Jiřiště [Mon, 19 Feb 2024 20:51:15 +0000 (21:51 +0100)]
Remove usage of function like macro VEC_INIT
The macro has been removed from Libft because it has to conform to the
42 Norm, which forbids function like macros.
Lukáš Jiřiště [Fri, 16 Feb 2024 23:13:44 +0000 (00:13 +0100)]
Update Libft and use its feature to clean after gnl
Function get_next_line does not free all memory when reading from stdin
when it doesn't contain end of file. The new version of Libft makes it
possible to free the memory.
Lukáš Jiřiště [Fri, 16 Feb 2024 23:13:19 +0000 (00:13 +0100)]
Update TODO
Lukáš Jiřiště [Fri, 16 Feb 2024 22:21:53 +0000 (23:21 +0100)]
Patch text formatting.
Lukáš Jiřiště [Fri, 16 Feb 2024 22:20:24 +0000 (23:20 +0100)]
Repair addfet argument count enforcing.
Lukáš Jiřiště [Fri, 16 Feb 2024 22:00:58 +0000 (23:00 +0100)]
Add ID to t_node so that it can be drawn easily.
Lukáš Jiřiště [Fri, 16 Feb 2024 21:58:23 +0000 (22:58 +0100)]
Patch seg fault when simulating FET with NULL on gate
FETs with no connection on gate now default to closed.
Lukáš Jiřiště [Fri, 16 Feb 2024 19:59:00 +0000 (20:59 +0100)]
Change some text to better fit my taste
Lukáš Jiřiště [Fri, 16 Feb 2024 16:34:45 +0000 (17:34 +0100)]
Revert "Change t_mosfet to remember node id instead of ptr"
This reverts commit
d03a1205f99244550c784b4c8c2694ae643f0278.
The commit was not thought through as it should. In addition it contains
some minor changes that should be recommited - that's why I should do
small commits that tend to a single problem/feature.
Lukáš Jiřiště [Sun, 4 Feb 2024 13:01:48 +0000 (14:01 +0100)]
Change t_mosfet to remember node id instead of ptr
This prevents looking for node id when drawing.
Some changes were present when I started this change. I can't really
tell, what they were, but from the diffs it looks like just 2 or 3 minor
cosmetic changes. Sorry.
Lukáš Jiřiště [Sun, 14 Jan 2024 16:42:57 +0000 (17:42 +0100)]
Add Libft/Makefile as dependency for %.c compilation
Add Libft/Makefile as an order-only-prerequisite for %.c files so that
after cloning the repository the Libft submodule is downloaded. This is
needed because without the Libft headers some files cannot be compiled.
Lukáš Jiřiště [Sun, 14 Jan 2024 16:34:41 +0000 (17:34 +0100)]
Add basic commands and refactor the code
Implement parsing of basic commands (help, next, add...)
-Mostly (?) as wrapper around function from previous commit
-It should be possible to do it in a much better way
Give the project some structure
-split main.c
-create src and inc directories
Lukáš Jiřiště [Sat, 13 Jan 2024 11:57:51 +0000 (12:57 +0100)]
Add TODO text file
The TODO list is quite short and not detailed. But better have it when it
is not needed yet than not have it when ideas are abundant. The
maintanance of TODO is so low it is worth adding.
Lukáš Jiřiště [Sat, 13 Jan 2024 10:55:36 +0000 (11:55 +0100)]
Start this project for simulating FET based logic
Add a small project capable(?) of simulating FET logic. Implement basic
structs and logic for the simulation.
Implement depicting of the simulation state.
Add submodule Libft for use in place of (most of) standard library.
- I develop this project for other reasons.
- This is an added challenge for learning's sake.
Add basics of project management (Makefile, .gitignore).