circuit

What's the best way to learn how to build circuits [closed]

大兔子大兔子 提交于 2019-12-03 02:52:16
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . I've always wanted to have a better understanding of what is happening at the hardware level. As a practical level, anything after compile equals 'magic' and I'd like to remedy that. I'd like to investigate building circuits and then moving up to assembly programming on basic chip sets, both for my own sake and

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

别说谁变了你拦得住时间么 提交于 2019-12-02 20:54:19
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 data to that port? Do I need to have a micro-processor? If not I don't want to use one for this simple project. EDIT: Interested in any OS specific solutions. mwilliams Here's a tutorial on doing it with a parallel port . Though I would recommend an Arduino which can be purchased very cheaply and would only involve the following code: /* Blinking LED * -

Precendence vs short-circuiting in C [closed]

淺唱寂寞╮ 提交于 2019-12-02 13:44:44
int i=-3, j=2, k=0, m; m = ++i || ++j && ++k; printf("%d, %d, %d, %d\n", i, j, k, m); Since ++ has more precedence than || and && in C, they are evaluated first and therefore the expression becomes m = -2 || 3 && 1 . Now you can apply short circuiting but that produces incorrect answer. Why is that? Precedence ≠ order of evaluation. The short-circuiting behavior of || and && means that their left-hand sides are evaluated first, and If the LHS of || evaluates to true (nonzero), the RHS is not evaluated (because the expression will be true no matter what the RHS is) If the LHS of && evaluates to

When should I use reg instead of wire? [duplicate]

元气小坏坏 提交于 2019-12-02 10:58:58
This question already has an answer here: Using wire or reg with input or output in Verilog 5 answers I'm confused about reg and wire when I was doing my homework. I could not understand differences between reg and wire exactly. Can you explain shortly? Also, I wonder that what will happen when I use output q instead of output reg q ? In simulation , a Verilog wire behaves like a piece of metal, a track, a wire, whilst a Verilog reg is a variable, it is storage*. The difference between them in simulation can be illustrated by showing what happens if I assign to them from more than one place.

How are shifts implemented on the hardware level?

耗尽温柔 提交于 2019-12-01 02:56:48
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 imagine that it would be a loop of shifts by one (that would take up to 64 shift cycles on a 64-bit machine). Is it some sort of compromise between the two or is there some clever trick? The circuit is called a " barrel shifter " - it's a load of multiplexers basically. It has a layer per address-bit-of-shift-required, so an 8-bit barrel shifter needs

How are shifts implemented on the hardware level?

我与影子孤独终老i 提交于 2019-11-30 22:48:01
问题 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 imagine that it would be a loop of shifts by one (that would take up to 64 shift cycles on a 64-bit machine). Is it some sort of compromise between the two or is there some clever trick? 回答1: The circuit is called a "barrel shifter" - it's a load of