Jump to content

Four bit adder: Difference between revisions

Line 1,212:
 
=={{header|MyHDL}}==
 
 
 
{{Verbose Code}}
Line 1,219 ⟶ 1,217:
<lang MyHDL>PRINT "#!/usr/bin/env python
# -*- coding: utf8 -*-
 
""" http://rosettacode.org/wiki/Four_bit_adder
Demonstrate theoretical four bit adder simulation
using And, Or & Invert primitives
 
2011-03-18 Add logic_list2intbv to connect sum signals to bit vector bits
2011-03-10 simulation working - added @always_comb... into Adder4b_ST
2011-03-08 tidying - tryng for list-in, list-out
2011-03-08 remove carry in to 4b added - to match spec
2011-02-20 collect bits(gates)
"""
 
from myhdl import always_comb, ConcatSignal, delay, intbv, Signal, \
Line 1,393 ⟶ 1,380:
 
 
# declare I/OsO for a four-bit adder
N=4
a = Signal(intbv(0)[N:])
Line 1,424 ⟶ 1,411:
sim = Simulation(tb())
sim.run()
"</lang>
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.