5 ms·
Show HN: Architect – Hardware Description and Emulation JavaScript Library
- TD-Linux 10y agoFor reference, the 4-input AND gate from the third example in Verilog: module ForInpAndGate(a,b,c,d,o); input wire a,b,c,d; output reg o; always @(*) begin o <= a & b & c & d; end; endmodule;
- blackguardx 10y agoVHDL is really verbose compared to Verilog. Some people love that verbosity, but I prefer to see more "action" in a screen of code.
- mbad0la 10y agoTrue. I had VHDL in my 5th semester and it was easy to get started with it. Let's hope the community shows some interest in my efforts to make this library the best of both worlds - verbosity with action :P
- blackguardx 10y agoJust curious, why do you like verbosity?
- mbad0la 10y agoI think it's probably a clichéd Js Dev thing :p But one of the reasons might be because I would like the person going through my code to easily understand it without much problems. It's more about perspective I suppose and the requirements of the project.
- TD-Linux 10y agoThe equivalent VHDL is: entity ForInpAndGate is port( a: in std_logic; b: in std_logic; c: in std_logic; d: in std_logic; o: out std_logic; ); end ForInpAndGate; architecture behavioral of ForInpAndGate is begin process(a, b, c, d) begin o <= a & b & c & d; end process; end behavioral; I don't think it's too much worse, and I do like some features of VHDL, such as it being strongly typed and having typed enums.
- nameless912 10y agoSystemVerilog is even cleaner. And those built-in simulation primitives....damn, I loved my SV classes.
- mbad0la 10y agoI'm so clueless about a lot of things! :p Can you provide some reference link to systemVerilog?
- orbifold 10y agoHere is a link to the standard: http://standards.ieee.org/getieee/1800/download/1800-2012.pdf http://standards.ieee.org/getieee/1800/download/1800-2012.pd... There is an open source compiler which can compile the hardware description subset of system verilog to c++ called verilator: http://www.veripool.org/wiki/verilator http://www.veripool.org/wiki/verilator It was originally developed to verify processor designs at DEC (Alpha etc.). Unfortunately all the other features of system verilog are onl y implemented in commercial tools. I believe the Xilinx Vivado tools support most of it, the others are not really affordable if you are not at an academic institution (Modelsim/the Synopsis tools).
- mbad0la 10y agoHmm...let's hope that this open-source tool becomes a better alternative to other proprietary softwares. Would be amazing for the academic community. Thanks for the references though!
- e19293001 10y agoIn this website[0], you can compile and play with systemverilog using Synopsys' vcs. [0] - https://www.edaplayground.com/ https://www.edaplayground.com/
- mbad0la 10y agoCool! So we can implement a descriptive component doing something similar on the same lines. But I kind of thought of pushing more for a `functional behaviour`. Hence I used the existing AND-Gate to build the Four Input AND-Gate. I should probably put the descriptive component on the README as well
- voltagex_ 10y agoI'm not sure why the output is passed in at the start (I'm guessing it's like an out parameter in C#) and I don't understand what @(*) is, but that's surprisingly readable.
- mbad0la 10y agoYeah, I haven't had the opportunity to use Verilog but it does seem very readable! I want to kind of give this library a similar direction. It's in its infancy at the moment :P
- blackguardx 10y agoVerilog isn't a programming language. It is a hardware description language. It is used to describe the behavior of hardware. The output isn't "passed" out at the beginning. Rather, That line is indicates that there is an output and what it's name is. The @() indicates a sensitivity list. The block below is evaluated whenever the states of any signal in the sensitivity list are changed. The * is a wildcard character and signifies any signal in the block below. That feature was added in Verilog2001. Before that, you had to manually list any signal you wanted in the sensitivity list.
- e19293001 10y ago> Verilog isn't a programming language. It is a hardware description language. It is used to describe the behavior of hardware. In short, coding in verilog is like creating a schematic of the circuit.
- krupan 10y agoYou can write Verilog as schematic-like description, but there is a higher-level of modeling supported by synthesis tools that doesn't look quite so netlist like.
- krupan 10y agoNitpick: Verilog is a programming language (see especially testbenches) with syntax and a runtime geared towards modeling hardware. It allows simple creation of lightweight shared-everything threads (called processes, confusingly, and they are not OS threads or processes, they are local to the language runtime) which are used to model concurrent hardware. It has its own built-in scheduler that decides when to run each thread. It has numerous synchronization methods and events (wait, @, #12ns, etc.) in addition to plain-old shared memory that threads use to coordinate with each other, and block and trigger thread execution. When modeling digital circuits a single shared-memory variable, usually named clock or clk, is the one variable most of these threads synchronize to. Mostly hardware designers get away without thinking about all those above details in those terms, but sometimes you get bit by them (race-conditions between threads can occur, sadly) and it helps to understand it. All programming is modeling of some sort or another.
- e19293001 10y agoOr this: module FourInputAndGate(input [3:0] in, output out); assign out = ∈ endmodule Reference: http://www.asic-world.com/verilog/operators2.html http://www.asic-world.com/verilog/operators2.html Really. Hardware is very fascinating. Great job OP!
- mbad0la 10y agoThis is so cool!
- clusmore 10y agoThis may be confirmation bias but I feel like since the Megaprocessor thread[1] I'm noticing an increase in hardware-simulation related posts. Can't think of them all off the top of my head, but see also: * Nand2Tetris[2] [1] https://news.ycombinator.com/item?id=12317217 https://news.ycombinator.com/item?id=12317217 [2] https://news.ycombinator.com/item?id=5888705 https://news.ycombinator.com/item?id=5888705
- mbad0la 10y agoOh these were great! I didn't know about them though. My project's inspiration is due to the fact that I love JS and had a computer system architecture course wherein I learnt VHDL. I felt that the NodeJS Events API could probably help me simulate a `signal` driven system and thus, I started experimenting :)
- aceperry 10y agoSince nodejs is single threaded, you'll get the best results with synchronous logic. Even asynchronous systems are difficult to design in real life, so it's not a bad idea to use nodejs.
- mbad0la 10y agoYeah, using events do offer an amazing async behaviour. Thus,the I/O arguments of every hardware component are extensions to EventEmitter, resulting in quite an amazing simulation.
- aceperry 10y agoLooks like a cool project. And since it's based on javascript, it shouldn't be too difficult to add a graphical interface, so the system could be driven primarily by graphics instead of using text only. A graphical interface would vastly improve on productivity and open up hardware design to more than just hardware engineers. Heck, this might give FPGAs a boost in popularity.
- mbad0la 10y agoCouldn't agree more! Someone has already suggested me some cool libraries that I might be able to use. Visualisation is on the agenda definitely.