Closed Thread
Results 1 to 4 of 4

Thread: Flowchart for a subroutine

  1. #1
    Fredrik373 is offline Newbie
    Join Date
    Jan 2010
    Location
    Sweden
    Posts
    7
    Rep Power
    0

    Flowchart for a subroutine

    hello!

    First off I don't know if this is the right spot to put this post, but I'm new here so...

    My task is to draw a flowchart for a subroutine to convert a 4-bit hexadecimal value to the corresponding 7-bit ASCII-code.

    Specification:
    Input parameters: Only one, in register r4. The 4 least significant bits in register r4 specify a number, from 0 through 15. The values of all other bits in the input must be ignored.
    Return value: Only one, returned in register r2. The 7 least significant bits in register r2 must be an ASCII code as described below. All other bits in the output must be zero.
    Required action: Input values 0 through 9 must be converted to the ASCII codes for the digits '0' through '9', respectively. Input values 10 through 15 must be converted to the ASCII codes for the letters 'A' through 'F', respectively.
    Side effects: The values in registers r2 through r15 may be changed. All other registers must have unchanged values when the subroutine returns.

    I don't know how to begin...

    I would be glad if anyone could help me!
    Last edited by Fredrik373; 01-27-2010 at 04:55 AM.

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Location
    Advertising world
    Posts
    Many

     
  3. #2
    Join Date
    Jul 2006
    Posts
    16,475
    Blog Entries
    75
    Rep Power
    143

    Re: Flowchart for a subroutine

    Which part of it is the difficulty?

    Can you grab only the bits you care about?
    Can you convert them to an integer?
    Can you determine the ASCII codes?
    Programming is a branch of mathematics.
    My CodeCall Blog | My Personal Blog

  4. #3
    Fredrik373 is offline Newbie
    Join Date
    Jan 2010
    Location
    Sweden
    Posts
    7
    Rep Power
    0

    Re: Flowchart for a subroutine

    The part I needed help with was to just draw the flowchart, but I managed to do that..

    But now I am going to write this as assembly code for Nios II. My problem now is that I don't know how to begin writing the code..

    You can see my flowchart on attachments.

    I am going to convert that flowchart into assemblycode..

    Any suggestions how I should start? Im new to assembly.
    Attached Thumbnails Attached Thumbnails Flowchart for a subroutine-flowchart.png  

  5. #4
    Fredrik373 is offline Newbie
    Join Date
    Jan 2010
    Location
    Sweden
    Posts
    7
    Rep Power
    0

    Re: Flowchart for a subroutine

    I have made a new thread that is more easy to understand, so you do not need to reply to this one.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Converting a subroutine into a flowchart
    By tdo81 in forum Assembly
    Replies: 0
    Last Post: 09-25-2011, 02:32 AM
  2. Perl subroutine: Watch Remote Server
    By phpforfun in forum Tutorials
    Replies: 0
    Last Post: 03-27-2010, 02:50 PM
  3. Definition of Subroutine
    By Hunter100 in forum C and C++
    Replies: 4
    Last Post: 02-12-2010, 11:11 PM
  4. flowchart help
    By j0k3r5an in forum Python
    Replies: 3
    Last Post: 08-15-2009, 04:35 AM
  5. MIPS Custom Subroutine help
    By Epik in forum General Programming
    Replies: 1
    Last Post: 05-28-2007, 08:03 PM

Tags for this Thread

Bookmarks

Posting Permissions

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