diff options
author | umarcor <unai.martinezcorral@ehu.eus> | 2021-01-05 22:34:14 +0100 |
---|---|---|
committer | umarcor <unai.martinezcorral@ehu.eus> | 2021-02-01 09:25:35 +0100 |
commit | 75ef931f4a7a0a4f3ddca1727d6f63ea6f4d2482 (patch) | |
tree | 3696139763213050943781d144a18272a24997c2 /doc/quick_start/simulation/adder/adder.vhdl | |
parent | 835eb73d7c567c3178f6f693153bea3243ecef53 (diff) | |
download | ghdl-75ef931f4a7a0a4f3ddca1727d6f63ea6f4d2482.tar.gz ghdl-75ef931f4a7a0a4f3ddca1727d6f63ea6f4d2482.tar.bz2 ghdl-75ef931f4a7a0a4f3ddca1727d6f63ea6f4d2482.zip |
doc: reorganise and update
Diffstat (limited to 'doc/quick_start/simulation/adder/adder.vhdl')
-rw-r--r-- | doc/quick_start/simulation/adder/adder.vhdl | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/doc/quick_start/simulation/adder/adder.vhdl b/doc/quick_start/simulation/adder/adder.vhdl new file mode 100644 index 000000000..cf60e8fbe --- /dev/null +++ b/doc/quick_start/simulation/adder/adder.vhdl @@ -0,0 +1,14 @@ +entity adder is + -- `i0`, `i1`, and the carry-in `ci` are inputs of the adder. + -- `s` is the sum output, `co` is the carry-out. + port (i0, i1 : in bit; ci : in bit; s : out bit; co : out bit); +end adder; + +architecture rtl of adder is +begin + -- This full-adder architecture contains two concurrent assignments. + -- Compute the sum. + s <= i0 xor i1 xor ci; + -- Compute the carry. + co <= (i0 and i1) or (i0 and ci) or (i1 and ci); +end rtl; |