Questions tagged [circuit]

In a programming context, a circuit usually refers to a combination of logical operators to achieve a desired response. Use this tag to ask about basic logical implementations and loops you can't get your head around.

In a programming context, a circuit usually refers to a combination of logical operators to achieve a desired response. This could be implemented in hardware (see: electronic/electrical engineering) but in software the key issue is the logic.

Use this tag to ask about basic logical implementations and loops you can't get your head around.

Logical operators include AND, OR, NOT, NAND and NOR gates, and judicious combinations of these can be used to construct just about any possible structures.

289 questions
13
votes
7 answers

Steps to make a LED blink from a C/C++ program?

What are the easiest steps to make a small circuit with an LED flash from a C/C++ program? I would prefer the least number of dependencies and packages needed. What port would I connect something into? Which compiler would I use? How do I send…
Brian R. Bondy
  • 314,085
  • 114
  • 576
  • 619
13
votes
1 answer

How are shifts implemented on the hardware level?

How are bit shifts implemented at the hardware level when the number to shift by is unknown? I can't imagine that there would be a separate circuit for each number you can shift by (that would 64 shift circuits on a 64-bit machine), nor can I…
Matt
  • 17,895
  • 16
  • 55
  • 102
9
votes
2 answers

Implementing jump register control to single-cycle MIPS

I am trying to implement jr (jump register) instruction support to a single-cycle MIPS processor. In the following image, I've drawn a simple mux that allows selecting between the normal chain PC or the instruction (jr) address. How can I know…
user2509740
  • 93
  • 1
  • 1
  • 3
9
votes
3 answers

Why does a 4 bit adder/subtractor implement its overflow detection by looking at BOTH of the last two carry-outs?

This is the diagram we were given for class: Why wouldn't you just use C4 in this image? If C4 is 1, then the last addition resulted in an overflow, which is what we're wondering. Why do we need to look at C3?
Doug Smith
  • 27,683
  • 54
  • 189
  • 363
8
votes
1 answer

An ArrowCircuit instance for stream processors which could block

The Control.Arrow.Operations.ArrowCircuit class is for: An arrow type that can be used to interpret synchronous circuits. I want to know what synchronous means here. I looked it up on Wikipedia, where they are speaking of digital electronics. My…
8
votes
3 answers

Octal full adder How to

I have this project listen below and im not sure where to start maybe someone can give me a few pointers or perhaps point me in the right direction of starting this? Thanks!! Input: A, B = octal digits (see representation below); Cin = binary…
soniccool
  • 4,688
  • 19
  • 54
  • 89
7
votes
1 answer

How to handle loops in a digital logic simulator?

I'm developing a digital logic simulator to build my own CPU in it later (so it's a long term project). Everything works great for circuits with no loops, for example a fulladder. Then there are circuits like an SR latch, where one of the inputs of…
emre23
  • 113
  • 5
6
votes
3 answers

Circuit that counts the number of set bits in 15-bit input

How to build an area-efficient circuit that counts the number of set bits in 15-bit input using 4-input LUTs (look-up tables). The output is obviously 4-bit (counts 0-15). Some claim that it's possible to do using 9 LUTs.
OutputLogic
  • 726
  • 4
  • 11
6
votes
2 answers

HTML5 - Render simple electrical circuits

I have a set of relatively simple electrical circuits. Small ones involving just resistors, capacitors, inductors, and trimmers/trimpots (ie: three-terminal variable resistors). I am trying to find a simple way to render these circuits from the…
Cloud
  • 17,212
  • 12
  • 64
  • 137
5
votes
3 answers

Verilog to GDSII compiler (open-source)

May be this question a bit not for StackOverflow, but both compilers and Verilog (which can be considered as programming language) are related to this project. Where can I find a open-source (or downloadable and free-to-noncommercial-use) compiler…
osgx
  • 80,853
  • 42
  • 303
  • 470
4
votes
2 answers

Digital Logic - Karnaugh Map

The initial problem starts like this. There are 6 states. At each state when w=1 move to the next state, when w=0 then stay at the current state. At each state display a number using a standard 7 led display (BCD). Those numbers are 8 -> 1 -> 9 -> 4…
CMacDady
  • 217
  • 2
  • 8
4
votes
2 answers

How to think about digital circuit design

How does one go about thinking about designing digital logic chips in an abstract way? I'm currently working through "The Elements of Computing Systems" I'm in the first chapter, and I've implemented the following gates, starting from…
hraesvelgr
  • 3,961
  • 2
  • 32
  • 58
4
votes
3 answers

VHDL port mapping problem

I'm relatively new to VHDL. I'm attempting to write code to do unsigned multiplication using a combination of full adders. When compiling it passes up to the port mapping. I've resolved the errors in the first map, but all of the others give me…
Buzkie
  • 819
  • 2
  • 11
  • 21
4
votes
2 answers

Analog circuit simulation library?

I'm working on a genetic programming tool and I'd like to evolve analog circuits. Can anyone suggest a library or tool or even a reference for hooking my GP code up? I just need some way to have something like SPICE evaluate the circuits that are…
alanc10n
  • 4,496
  • 6
  • 33
  • 40
4
votes
3 answers

How do I convert a number to two's complement in verilog?

I am trying to design a 4-bit adder subtracter in verilog. This is only the second thing I have ever written in verilog, and I don't know all the correct syntax yet. This is the module I have so far: module Question3(carryin, X, Y, Z, S, carryout,…
Zachary Wright
  • 20,532
  • 9
  • 40
  • 48
1
2 3
19 20