Divisore binario, versione 1.0 Binary divider's release notes, version 1.0
Installation notes. User guide.Release notes.
The "Binary divider", developed using javascript / jQuery languages, can be used on both pc and smarthphone (Responsive) and it has the following functions:
$( document ).ready() | The code inside this function will be not but executed untill the page will not be full loaded. |
| - On DOM loading, keyup, click and keypress listener are activated. | |
$("#input").keyup() | Manages the input of the input field "Dividend" and "Divisor"; Check progressively characters typed, highlighting in red the margin of the input field in case of error regarding the range of the input; Update the register "Dividend" and/or "Divisor" in the graphic circuit representation with the values typed by the user; |
$(".button").click | Manages the click event on buttons, identified by the name attribute. Name="start" execute the checkDiv() function and if the check operation is positive, startDiv() is executed. Name="reset" execute the resetDiv() function. Name="restore" switch the modalities "With restore"/ "Without restore. Name="not-restore" switch the modalities "With restore"/ "Without restore". Name="next" execute the stepWithRestore() or stepWithoutRestore() function (it depends on the selected modality). Name="new-operation" execute the resetDiv() function, which allows to start a new operation. |
$(document).keypress | Set hotkeys for rapid-execution. "START" key = RETURN. "NEXT" key = RETURN. "RESET" key = r/R. "Modalities" key = s/S. |
| - As described, the events call the following functions: | |
checkDiv(dividend, divisor) | Check if there are errors in the input fields "Dividend" and "Divisor". It return "true" if the input values are correct, "false" if there are errors. |
startDiv() | Initialize all the registers and the variables used by Binary divisor. |
resetDiv() | Reset all values of all fields and registers. |
stepWithRestore(operation) | Execute one computational step of "With Restore" modality, if there aren't more operations availables a message will warn the user. |
stepWithoutRestore(operation) | Execute one computational step of "Without Restore" modality, if there aren't more operations availables a message will warn the user. |
restoreRest() | Restore the value of the rest (A register) if this is negative. (In "Without restore" modality) |
updateImage() | Update fields value (cells) of the image on each operation's execution. |
shifting() | Left-Shift of A and Q registers. |
setDividend() | Check the sing of A register and set the Q0 value to 0/1. |
complement(positive) | Execute the two's complement of a positive number passed as function parameter(positive). |
add(first, second) | Sum two binary numbers. |
sub(first, second) | Subtract two binary numbers. |
normalize(number, n) | Update the number (number) in n bit codify (if n is not specified, 4 bit codify will be done). |
info() | Show a message with the information and the characteristics of the project.. |
| - The "Help" link call the function | |
help() | Show a message which show suggestions regarding how to use the application and its hotkeys. |
Compilation:
The following project, as said first, is browser based and so doesn't need any compilation because is the browser which will interpret the code.
Testing and development:
Text editor: Sublime Text.
Framework: Twitter Bootstrap 3, jQuery
Tested and working on windows/linux OS with compatible browsers (see Installation notes).
Developers ideas:
Divisor and dividend bit extensions (actually the Binary divider work with 4 bit).
Date: 23 July 2014
Simulators of Architettura degli elaboratori (2013-2014, U. Catania, DMI)