r/AskComputerScience • • Nov 07 '24

Making a 4 bit subtractor from a 4 bit adder

3 Upvotes

Hey guys, I'm using Logisim to create a 16 bit cpu and right now I'm making a 4 bit adder/subtractor. I've followed this picture but a problem I'm getting is that the carry is 1 for values that it should not be 1 for, like when both inputs are 0. How should I fix this?


r/AskComputerScience • • Nov 06 '24

How did you guys get so good at algorithms?

17 Upvotes

I really don't get how some people can just pick up algorithms like it's nothing

I'm in this algorithms and design class and its absolutely fucking me up. Trying to come up with recurrence relations, find out amortized costs using potential functions, and then needing to come up with a proof for everything too...

I can understand the algorithms like Knapsack and Bellman-Ford etc. when they're explained to me, but when it comes to deriving something original using these algorithms as a base, I'm just completely lost. Looking at our posted solutions to said problems as well just adds to my confusion. Maybe I just need more practice, but it just feels so damn defeating to constantly be losing at this

If anyone out there is nutty with algorithms and proofs, how did you guys get so good? How do you think? Are there any good resources out there for this ?

Sorry if this kind of post isn't welcome here, I just wanted to let out little bit of steam


r/AskComputerScience • • Nov 05 '24

what is microcode and where is it located?

13 Upvotes

(Second-year CS major here) So, I’ve been looking into lower and lower level stuff recently, as I find it fascinating at how much stuff computers are doing under the hood. I’ve been told many times that machine code is the lowest level of abstraction in controlling the computer, but now I’m seeing that there is another layer of microcode beneath that, and that it can be updated. Where is the microcode stored and how can it be updated? Is the microcode the lowest level of abstraction for computers, or is there another level beneath that, or is machine code actually at the bottom of that hierarchy? Can programmers utilize microcode in their programs in the same way you can use assembly to have more control over their programs or to optimize them?


r/AskComputerScience • • Nov 05 '24

question about self attention in the paper "Hopfield Network is All You Need."

1 Upvotes

Hello, I'm having some difficulty with the paper "Hopfield Network is All You Need." I don’t understand a particular passage, and I’d be incredibly grateful to anyone who could help me make sense of it. The passage in question is here: "https://ml-jku.github.io/hopfield-layers/#update".

In this section, they refer to matrices WWW, which are projections of patterns into associative spaces. I don’t understand what that means. Likewise, I don’t really understand the concrete function of Equation 28 and Equation 30. For instance, I have a clear idea of what the update equation introduced earlier in the article does (it helps denoise a pattern), but here, for Equations 28 and 30, I don’t understand their purpose at all.

Thanks


r/AskComputerScience • • Nov 04 '24

Books about the history of computers.

10 Upvotes

Im trying to get into the history of computers. im looking for a book that goes into depth about the technologies and how they were made. i want to start at the beginning and work my way up to the present day.


r/AskComputerScience • • Nov 04 '24

Why does 6502 Assembly not have any opcodes ending in 3, 7, B, or F, and only one ending in 2? (A2 - LDX $xx)

2 Upvotes

This greatly confuses me.


r/AskComputerScience • • Nov 03 '24

Few questions on interpretation and evaluator ......

2 Upvotes

A program when is passed to the evaluator breaks it down to the simplest of instructions ... the primitive instructions... My question is does the primitive instruction directly get converted to the maschine code from there ? Like + is a primtive instrcution in a language so does the evaluator or the interpreter have a data structure storing these primitive instructions and thier respective maschine codes ..... or is it conversion happening at a later time ?

In normal order evaluation ... suppose i have defined a list of (1,2,3,4,(1 / 0)). Here the 5th element is an error.. so when I define the list and never use list[4] the program will run without an error or what ??

Ik in applicative order evaluation the moment u define it the evaluator program will evaluate the list and throw an error on the 5th element ... please correct me on this if I am wrong....

Any help would be appreciated. And sorry if this is the wrong sub ....


r/AskComputerScience • • Nov 03 '24

binary operators and sets

4 Upvotes

if we say that some operator is a binary operator to set S, does that necessarily mean that the set is closed relative to the operator?, the way the book talked about it seemed like both terms are referring to the same case.