4 bit multiplication with a 4-bit adder - cpu-architecture

Im doing a homework problem for computer architecture and im stumped on using a 4-bit adder. Here is an example problem which I thought I understood, and after that is my attempt but im incorrect. Any idea why?
and heres my attempt at 0111x1101. I have done this correctly with an 8-bit adder.

On the step 2 line, the second part of the product isn't correct ( should be 1011, not 0111).

Related

Understanding a code for deep learning NOMA system in MATLAB

I'm trying very hard to understand this code about a Deep Learning-Based NOMA system based in MATLAB. I am really new to MATLAB coding but I really need to understand this entire code as it will help in my school project and I am struggling.
I think as of right now I do not need to know how the mathematical formulas work, but instead, the focus is on what the code is doing and its flow.
This is part of the code in the trainData.m file that I am struggling with right now
Why are the pilot symbols calculated and then replaced right after?
Why is the idx_sc (20) selected to be replaced? What is its significance? Is it the only subcarrier selected for the training of the DL model? Why only that?
This portion of the code in the picture is labeled "generate training data for each class". From my understanding, it is generating OFDM packets for each label, simulating the transmission and reception, and then getting the features and labels for each of the 16 classes. Is that correct?
The code and all relevant function files can be found in the link below.
Please help me understand the code!!! Please! Much thanks!
https://www.mathworks.com/matlabcentral/fileexchange/75478-deep-learning-for-signal-detection-in-noma-systems
To get you started, In lines 91 the code initializes the entire variable as 0. Subsequent lines (92-96) are just replacing pieces of the variable based on the indexing inside the “(…)”

Why should not a table size that's a power of 2 be used with the division hashing method?

I have seen many people use the following to answer this problem.
"This is equivalent to just keeping the lower N bits of the hash while throwing away the upper bits".
But I do not quite understand what it means. could somebody explain and make an example?

Is QAM the best way to do this?

Sorry about this noob question, because I never work with matlab and signal processing before.
Here is what I want to do: I have a fixed length of byte array X, now I want to encode it to a sound file, I also want this process to be reversible, which means the sound can be converted back to X with no error. I searched online, and found the following code:
M = 16;
x = randint(5000,1,M);
y=modulate(modem.qammod(M),x);
My question is that, is QAM the best way to do this? and how to use it? A little bit code example will be really appreciated, Thank you!
update#1: I tried to output y by sound(y), but matlab does not allow me to do so, it says I can only output floating numbers. How can I solve this? Thank you!
If you need to transmit over the air, you have quiet a lot of work in front of you I think. The most difficult problem to solve in a telecommunications system is often synchronization, meaning that your receiver will have to know where the QAM symbols are placed in time. This is not easy. If you choose to go ahead I agree with mtrw that you should try dsp.stackexchange.com.
Try for example to imaging a simple modulation scheme where each bit is converted to a short piece of sine with the frequency depending on whether the bit is one or zero. How would you go about decoding this on the receiver end? You need to detect the onset of the first bit and have some self maintaining clock running for synchronization on the receiver to find bits in case they do not change, aka a PLL (Phase Locked Loop). This could possibly be made easier by using manchester coding, but you would still have to do quite a lot to get it running.
As you see, there are no easy solutions when you leave the save Matlab harbor :-)
Best regards

Compare common value of a timeseries

I have timeseries that don't have the same start time and I would like to find the common part of them.
EX:
a=[ 0,1,2,3,4,5,6,7]
b=[ 2,3,4,5,6,7,8,9]
c=[-1,0,1,2,3,4,5,6]
result=[2,3,4,5,6]
Is there a matlab function to do that ?
EDIT:
I found an algorithm, but it is taking for ever and it is saturating my memory to analyse 6 timeseries of 100000 points. Is the algorithm not written properly or is it the way Longest common substring problem is?
The problem is called the Longest common substring problem.
http://en.wikipedia.org/wiki/Longest_common_substring_problem
It is not really hard to implement, and you you can probably also find Matlab code online. It is important to observe that if you know how to solve for 2 time series, you know how to solve for N, because: c(x,y,z) = c(x,c(y,z))

Magic Square Function Matlab

For a project i am supposed to write my own function that will do the same thing as the magic function in matlab. I am obviously not asking anyone to write out my problem but if somebody could give me any ideas of how i could start it or example code it would be much appreciated! I am completely lost on how to start this one...
This is often great advice:
If a problem is too hard, try solving an easier one to begin with.
Try to write code to generate a 2 by 2 magic square? Then try 3 by 3. Then 4 by 4. Can you see how to generalise?
I guess you already thought about it, but the usual good source of information is wikipedia:
https://en.wikipedia.org/wiki/Magic_square#Types_and_construction
It explains different ways of making magic squares.