Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

hdl-js

Package Overview
Dependencies
Maintainers
1
Versions
72
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

hdl-js - npm Package Compare versions

Comparing version 0.0.23 to 0.0.24

2

package.json
{
"name": "hdl-js",
"version": "0.0.23",
"version": "0.0.24",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "Hardware definition language (HDL) and Hardware simulator",

@@ -789,8 +789,12 @@ # hdl-js

A clock operates on the [clock rate](https://en.wikipedia.org/wiki/Clock_rate), that is, _number of cycles per second_, measured in **Hz**. The hight the clock rate, the faster machine is.
A clock operates on the [clock rate](https://en.wikipedia.org/wiki/Clock_rate), that is, _number of cycles per second_, measured in **Hz**. The higher the clock rate, the faster machine is.
And a **clock cycle** consists of two parts: _rising edge_, and _falling edge_.
Clock's runtime consists of _cycles_, and _clock cycle_ has two phases: _rising edge_ (aka "tick"), and _falling edge_ (aka "tock").
As mentioned in the [memory chips](#memory-chips) section, all clocked gates can change their internal state _only on the rising edge_. And on the falling edge the _commit_ the value form the state to the output pins.
<p align="center">
<img src="http://dmitrysoshnikov.com/wp-content/uploads/2018/01/hdl-js-system-clock-1024x302.png" alt="Clock image" width="700" />
<p/>
As mentioned in the [memory chips](#memory-chips) section, all clocked gates can change their internal state _only on the rising edge_. And on the falling edge they _commit_ the value form the state to the output pins.
For example, running the:

@@ -926,3 +930,2 @@

/*

@@ -938,4 +941,44 @@

It is also possible to `start`, `stop`, and `reset` the clock:
```js
const hdl = require('hdl-js');
const {
emulator: {
Clock: {
SystemClock,
},
},
} = hdl;
// Reset the clock:
SystemClock.reset();
// Subscribe to the events:
SystemClock.on('tick', value => console.log('tick:', value));
SystemClock.on('tock', value => console.log('tock:', value));
// Run it:
SystemClock.start();
/*
Output (every second):
tick: +0
tock: -1
tick: +1
tock: -2
tick: +2
tock: -3
...
*/
```
### Composite gates
TODO; WIP

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc