Facebook Page
Twitter
RSS
Thanks Thanks:  0
+ Reply to Thread
Results 1 to 3 of 3
  1. MHB Master
    mathmari's Avatar
    Status
    Online
    Join Date
    Apr 2013
    Posts
    2,466
    Thanks
    1,958 time
    Thanked
    594 times
    Trophies
    1 Highscore
    Awards
    MHB Chat Room Award (2015)  

MHB Model User Award (2015)  

MHB LaTeX Award (2015)
    #1
    Hey!!

    We have that MIMA (Neumann MInimal MAchine) has the following commands:















    I want to write a MIMA program that takes the value $2^{23}-24=8.388.584$ to the memory $y$.
    We have to take attention at the number of the bits, that we need for the representation of the number in two's complement.

    How do exactly do we make the representation?

    The other part is the following, or not?



    Then I want to implement the Mima-command EQL adr (equal?) with the other Mima-commands.

    We have that for that command it holds the following: $$\text{Accu} \leftarrow \left\{\begin{matrix}
    -1 , &\text{ Accu }=M(adr)\\
    0 , &\text{otherwise}
    \end{matrix}\right.$$

    I have done the following:
    My idea is to compute -M(adr) and then to add it to Accu, and then to check if it i <0.
    And then to compute the inverse of the result and check if it is <0.
    Is it correct?



    Is the implementation correct? Could I improve something?
    Last edited by mathmari; December 20th, 2016 at 09:37.

  2. MHB Master
    mathmari's Avatar
    Status
    Online
    Join Date
    Apr 2013
    Posts
    2,466
    Thanks
    1,958 time
    Thanked
    594 times
    Trophies
    1 Highscore
    Awards
    MHB Chat Room Award (2015)  

MHB Model User Award (2015)  

MHB LaTeX Award (2015)
    #2 Thread Author
    We have also the following information about the bits:
    Address: 20 Bit and Values: 24 Bit

  3. MHB Master
    mathmari's Avatar
    Status
    Online
    Join Date
    Apr 2013
    Posts
    2,466
    Thanks
    1,958 time
    Thanked
    594 times
    Trophies
    1 Highscore
    Awards
    MHB Chat Room Award (2015)  

MHB Model User Award (2015)  

MHB LaTeX Award (2015)
    #3 Thread Author
    About the representation of the number in two's complement, I have done the following:

    We have that $2^{n+1}=2\cdot 2^n=2^n+2^n$.

    So, $$2^1=2^0+2^0=1+1 \\ 2^2=2^1+2^1=(1+1)+(1+1) \\ 2^3=2^2+2^2=[(1+1)+(1+1)]+[(1+1)+(1+1)] \\ \text{etc} $$

    And we have that $24=2^3\cdot 3=2^3+2^3+2^3$.

    We initialize the memory cell $y$ with $1$ and we repeat $23$ times to add the value of $y$ by itself and the result we put it at $y$.

    Then we have to subtract three times $2^3$.

    How do we do this? Do we have to compute again the $2^3$'s, then compute the inverse and add it to the value that is at $y$ ?

    But where do we do these operations? To calculate $2^3$ as above, we have to save the results at each step, or not? But where? Do we consider an other memory cell, say $a$, for that?

    Let $x$ be the memory cell where the representation of $23$ in two's complement is, and let $z$ be the memory cell where the representation of $3$ in two's complement is.

    I wrote the following code (about the part of $2^3$ I computed it in the way we compute $2^{23}$ and I subtracted it three times from $y$):




    Is this correct?

Similar Threads

  1. Need help with C++ program (Implement a PrintMenu() function)
    By elmessican in forum Computer Science
    Replies: 3
    Last Post: November 6th, 2016, 20:09
  2. Replies: 1
    Last Post: June 4th, 2016, 09:07
  3. How can we implement this sort?
    By mathmari in forum Computer Science
    Replies: 1
    Last Post: December 14th, 2014, 15:47
  4. Replies: 2
    Last Post: May 14th, 2013, 09:53
  5. Proving a continuous function in S1 is homotopic to a constant function in X
    By MikeD in forum Topology and Advanced Geometry
    Replies: 1
    Last Post: February 23rd, 2012, 09:34

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Math Help Boards