John Griner

Greenhorn
+ Follow
since Dec 30, 2022
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by John Griner

Absolutely, I will when I get a break from work, John
1 year ago
I did see this when researching my question " the 8085 moy with it's 14 bit address is capable of addressing 2^14 = 16, 384 memory location. However, after reading your question I can see that it is much more involved.
1 year ago
Hey I just posted something similar for CMa assembly help. I am not sure if we are allowed to leave comments like these, but I looked at your question and although interesting, I am lost on my own CMa assembly code question.
1 year ago
Last question of a 4 question assignment. Here is the question: " Execute CMa code assuming that prior execution of the values of SP = 0. What does the given code compute when the memory allocation with address 3 is given? ". Here is Part A instructions: loadc 0, loadc 1, loadc 13, loadc 1, le, jumpzA. Here is Part B: loada 3, loada 2, geq, jumpzB, loada 3, loada 2, geq, jumpz B, loada 3, loada 2, geq, jumpz B, loada 3, loadc 2, geq, jumpz B, loada 1, loadc 1, add, storea 1, pop, loadc 2, loada 2, mul, storea 2, pop, jumpz A, halt.                                   OK, here is my approach and it would help if someone pointed any misconception or erroneous attempts before I try this. Basically it seems like I need to translate store, load, add into a bunch of 0's and 1's using a things like Oppcode, Assembly language instruction, etc, where, store --> 0 1 1, load --> 0 1 0, and add --> 0 0 0 with mapping Mnemonic to Oppcode is also used where A  is 0 0, B is 0 1, C is 1 0, and D is 1 1. Also part of the tools would be ABC, CDA, DBA, and ADC all with add the have associated different 16 two part 8 digit strings of 0's and 1's. Now, using 3 bit Oppcode allows the processer to map 2'3 Mnemonic there are 8 instructions (this I completely don't understand). However I do get if you increase the Oppcode to 2'8, you then have 256 instructions and I see the relationship of the # of bit operator to instruction. Other but of info I got was a load's source is a memory address, not a register, and the source field is uneeded and must be zeroed out.               OK. I am lost in respect to where I start, how the Mnemonics work to use the store, load, etc that specify the 3 digit Oppcode and how the assembly language instruction is produced to give a ABC --> 16 digit (0, 1), and in what order to do all this. Furthermore, I am not sure how to "execute" CMa code "assuming" that prior execution of the values of SP = 0 and what the given aforementioned code (A and B) computers to when the memory location with address 3 is given as the input. Any help is greatly appreciated, John
1 year ago
Tim, thanks. What I meant by weird symbol is from this line:

if(¬(x=y))z←z+1;

It is the 3rd one after the if(    ¬

This line in the problem was taken directly from the textbook, not sure if it is a typo, or what it means.

John
2 years ago
Iam having issues understanding what I am supposed to do to generate code for 2 separate Loops.

The 1st one is:

While (x>y) {
    if (2 dot y >x) y <--- y+x;
    else x<--- x- y;
}

The and one is:

for (x <--- 0; x < 42; x<---x+z)
    if (weird symbol (x=y)) z <--- z+1;

Now, for both Loops, the target is address is:  p = {x--->2, y--->3, z--->5)

Any help or advice is greatly appreciate, John
2 years ago
Tim, again, thanks. Ya, I just started a course where it looks like I am learning C++. The course is called Compiler Design and Virtual Machine. For whatever reason, C++ seems odd to me and not as straight forward as Python. However, it is pretty cool. Ya, thanks for clearing that up for me. I am currently working out the 2nd question for my assignment. I am in an online program and the prof and everyone else is very "hands off."

For the problem I am working through, I have to make a code for the following 2 loops:

While (x>y) {
If (2·y>x) y←y+x;
else x←x−y;
}
For (x←0; x<42;x←x+z)
if( ¬(x=y))z←z+1;
Use the following address environment:
ρ={x→2,y→3,z→5}

Ya, I am, among other things, working this one out. I got the first one right. This is going to be so cool.

Again, thanks for your help, John
2 years ago
Thanks, i will reply properly when i get home, john
2 years ago
New to C++ but love it.

When doing my assignments I see things like: a←2

Shouldn't the arrow go the other way.

Yes, I understand that the arrow operator does.
2 years ago
Ritchie, thanks a million. Ya, it makes more sense now.

By saying "That is a good way", do you mean that I may have actually written a code that translates the expression?

Again, thanks, John

2 years ago
Closed. This question needs details or clarity. It is not currently accepting answers.
Add details and clarify the problem you’re solving. This will help others answer the question. You can edit the question or post a new one.

Closed 13 hours ago.

Ok. Just starting to learn C in a Compiler design course and after a week decided it is pretty cool. Here is half of my first problem:

Code generation for expressions
Generate CMA code for the following expressions:

a←2·(c+(b−3)) is that the same thing as this
a = 2 *(c+(b-3)) which to me means, a equals 2 times (c + (b - 3))

Thus, am I even reading it correctly? Just started a couple days ago, getting used to it; C is somewhat strange to me, but cool.

I just did the following:

r1 = b -3;
r2 = c + r1;
a = 2 * r2
Am I at least on the right track. Any help is always greatly appreciated, John
2 years ago