Knowledge

NAR 2

Source šŸ“

1439:
The question of treatment of "N" (immediate) flag in presence of I (indirect) flag is open as the situation is somewhat ambiguousā€”that is, whether or not to honour the flag value specified in the original instruction or the one in the indirectly specified (looked up) address leads to a conflict. The
1391:
addressing mode. The location is first chosen by "looking" at P (indexed) and R (relative to program counter) flags. Then, if I (indirect) flag is detected, a 32-bit word is loaded from the memory location calculated so far and the calculation is restarted (including all addressing mode flags, index
1448:
NAR 2 has instructions to initialize the value of particular index register ("PIR" mnemonic). However, it does not have special instructions to read values index registers. This is achieved by using indexed and immediate (P, N) addressing mode flags, such as:
384:
Fixed point) arithmetic. However, this is only true for addition, subtraction and negation (sign change). Multiplication and division assume that the "point" is fixed to the right of least significant bit - that is that the numbers are
1006:
With four address mode selection bits (P, R, I and N - indexed, relative, indirect and immediate), NAR 2 instructions can specify 16 different addressing modes but not all make sense in all instructions. In the following table:
1379:
Note 1: "N" (immediate) flag has no effect on jump (flow control) instructions, as the processor can not jump into a specified value, but only to a memory address.
944:
The NAR 2 assembly language syntax was designed to be straightforward and easy to parse. Each program line may contain up to one instruction specified as follows:
1517: 1751: 1737: 1392:
register selection and parameter value - only the "opcode" is omitted). Thus, the following program, if loaded at memory location 0 and executed:
1732: 1458:... which essentially puts Xi+n into accumulator. For n=0, this turns into a "load index register value into accumulator" instruction. 181:(note: the address is loaded from specified location and, should it also specify "I" flag the indirect address calculation continues) 909:
Zero Jump) performs a conditional jump to the address specified by the parameter if the current value of the accumulator is zero
1510: 756:
but they can be explained as if they operate on vectors of bits and separately apply logical operations on each pair of bits.
1436:
seems more generic (could freeze NAR 2 from any location), but this depends on when BN register value is incremented/changed.
1777: 97: 1746: 1756: 1503: 951:
Whitespace, if instruction specifies any index registers, addressing mode or a parameter and then comma-separated:
261:
are specifiable, X0 to X15. However, X0 was never used, possibly because it was reserved as program counter (BN)
1742: 247: 90: 251: 45: 935:
Stop the Computer) stops any further processing; this is the only instruction that ignores the parameter.
57: 1571: 108: 679: 753: 1485: 53: 1556: 853:
to the address specified by the parameter if the current value of the accumulator is negative
1489: 1440:
table above presents the first case to show different addressing modes achievable this way.
932: 916: 906: 890: 880: 876: 860: 850: 846: 830: 813: 797: 787: 771: 734: 722: 705: 693: 676: 664: 647: 627: 617: 605: 595: 583: 573: 561: 551: 539: 522: 498: 488: 472: 462: 446: 436: 420: 410: 394: 381: 367: 347: 337: 318: 308: 289: 265: 237: 226: 189: 171: 157: 143: 136: 125: 94: 69: 65: 34: 23: 1566: 1388: 218: 178: 525:
Change the Sign of Accumuator, Fixed Point) - Changes (flips) the sign of the accumulator
68:. Many NAR 2 simulators have been created — for instance, one was named "Å ljiva" ( 1631: 1576: 1023:
f() is the "effective value" function used for indirect addressing (see details below):
258: 115: 1771: 760: 1488:- Examples of student assignments for "ORS" course (Basics of Computer Systems), in 276:
Following opcodes were available (actual codes were not specified, only mnemonics):
1647: 122: 380:
Note: all mnemonics in this group end with letter "F" indicating "Fiksni zarez" (
1581: 741: 708: 683: 61: 1495: 1433:
R, I, 0 ; Memory-Into-Accumulator, Relative, Indirect, from location BN+0
1417:"I, 0" specifies that the actual address is to be loaded from memory location 0 1411:"I, 0" specifies that the actual address is to be loaded from memory location 0 1405:"I, 0" specifies that the actual address is to be loaded from memory location 0 715:
with the parameter and the accumulator and stores the result in the accumulator
686:
with the parameter and the accumulator and stores the result in the accumulator
712: 650:
Change the Sign of Accumuator) - Changes (flips) the sign of the accumulator
1611: 1606: 1601: 1596: 1591: 737: 1694: 1687: 1682: 1677: 1561: 1551: 1546: 1541: 749: 1672: 1667: 1662: 1657: 1652: 1626: 1616: 1586: 1527: 465:
Multiply, Fixed Point) - Multiples the accumulator with the parameter
439:
Subtract, Fixed Point) - subtracts the parameter from the accumulator
104: 78: 48:
professor Nedeljko Parezanović as an enhancement to its predecessor,
1492:. Task "V1: NAR" requires the student to write a simulator of NAR 2. 1475:, another processor designed by a professor to help students learn. 1710: 1621: 1467: 1455:
Xi, P, N, n ; Memory-Into-Accumulator, Indexed, Immediate, 0
49: 1472: 73: 1499: 1401:... will freeze NAR 2 in an infinite address calculation loop: 1398:
I, 0 ; Memory-Into-Accumulator, Indirect, from location 0
491:
Divide, Fixed Point) - Divides the accumulator by the parameter
816:
Shift Right) - shifts the bits of the accumulator to the right
340:
Accumulator Into Memory) stores the content of the accumulator
41: 1020:
Xi specifies the index register selected by data at location
790:
Shift Left) - shifts the bits of the accumulator to the left
370:
Load Index Register) Loads the value into the index register
1011:
M specifies the 32-bit value (content) of memory location x
16:
32-bit RISC architecture developed by Nedeljko Parezanović
744:
on the content of the accumulator (ignores the parameter)
311:
Memory Into Accumulator) loads the value into accumulator
598:
Multiply) - Multiples the accumulator with the parameter
576:
Subtract) - subtracts the parameter from the accumulator
957:
Names of addressing mode flags (also comma separated)
413:
Add, Fixed Point) - adds parameter to the accumulator
1724: 1703: 1640: 1534: 1017:
p specifies the 16-bit signed parameter at location
44:word computer created by Faculty of Mathematics of 1420:Memory location 0 is loaded. It reads "I, 0" again 1414:Memory location 0 is loaded. It reads "I, 0" again 1408:Memory location 0 is loaded. It reads "I, 0" again 620:Divide) - Divides the accumulator by the parameter 1511: 919: 893: 863: 833: 800: 774: 725: 696: 667: 630: 608: 586: 564: 542: 501: 475: 449: 423: 397: 350: 321: 292: 8: 1518: 1504: 1496: 883:to the address specified by the parameter 752:. Their names imply that they are purely 1026: 554:Add) - adds parameter to the accumulator 250:that can be treated either as integer ( 163:elativno) - relative to program counter 7: 118:to use with indexed addressing modes 1486:Primeri seminarskih zadataka iz ORS 1444:Reading values from Index Registers 40:2) is a theoretical model of a 32- 14: 940:Standard assembly language syntax 254:) or real (floating point) number 114:4 bits (20 to 23) specifying the 93:uses 32-bit machine words. Each 1014:BN specifies the program counter 879:Unconditional Jump) performs an 954:Name of index register, if used 748:Note: above operations are all 60:courses. The word "nar" means 1: 1745:and history of computing in: 121:4 bits (16 to 19) containing 1372: 1369: 1366: 1363: 1360: 1357: 1352: 1349: 1346: 1343: 1340: 1337: 1332: 1329: 1326: 1323: 1320: 1317: 1312: 1309: 1306: 1303: 1300: 1297: 1292: 1289: 1286: 1283: 1280: 1277: 1272: 1269: 1266: 1263: 1260: 1257: 1252: 1249: 1246: 1243: 1240: 1237: 1232: 1229: 1226: 1223: 1220: 1217: 1212: 1209: 1206: 1203: 1200: 1197: 1192: 1189: 1186: 1183: 1180: 1177: 1172: 1169: 1166: 1163: 1160: 1157: 1152: 1149: 1146: 1143: 1140: 1137: 1132: 1129: 1126: 1123: 1120: 1117: 1112: 1109: 1106: 1103: 1100: 1097: 1092: 1089: 1086: 1083: 1080: 1077: 1072: 1069: 1066: 1063: 1060: 1057: 1389:multi-level memory indirect 1383:Multi-level memory indirect 179:multi-level memory indirect 1794: 849:Negative Jump) performs a 213:NAR 2 has four registers: 1032: 1029: 920: 894: 864: 834: 801: 775: 726: 697: 668: 631: 609: 587: 565: 543: 530:Floating point arithmetic 502: 476: 450: 424: 398: 351: 322: 293: 77:) as that fruit grows in 81:, while "nar" does not. 266:flags or flag registers 241:Counter of Instructions 91:central processing unit 1526:Computer systems from 280:Memory/register access 195:eposredno) - immediate 46:University of Belgrade 1778:Models of computation 109:most significant bits 85:Instruction structure 58:Computer architecture 948:Instruction mnemonic 38:Educational Computer 52:. It was used for 881:unconditional jump 754:logical operations 375:Integer arithmetic 1765: 1764: 1752:former Yugoslavia 1738:former Yugoslavia 1377: 1376: 1033:Instruction type 54:Assembly language 1785: 1731:Full lists from 1520: 1513: 1506: 1497: 1490:Serbian language 1027: 1002:Addressing modes 930: 929: 904: 903: 874: 873: 851:conditional jump 844: 843: 811: 810: 785: 784: 732: 731: 703: 702: 674: 673: 645: 644: 615: 614: 593: 592: 571: 570: 549: 548: 520: 519: 486: 485: 460: 459: 434: 433: 408: 407: 365: 364: 335: 334: 306: 305: 1793: 1792: 1788: 1787: 1786: 1784: 1783: 1782: 1768: 1767: 1766: 1761: 1720: 1699: 1641:1960‑1979 1636: 1567:ATLAS-TIM AT 32 1535:1980‑2000 1530: 1524: 1482: 1464: 1446: 1387:NAR 2 supports 1385: 1004: 999: 960:Parameter value 942: 823: 764: 657: 655:Bitwise/logical 532: 377: 282: 274: 259:Index registers 219:Program counter 211: 204:parameter value 111:(bits 24 to 31) 87: 17: 12: 11: 5: 1791: 1789: 1781: 1780: 1770: 1769: 1763: 1762: 1760: 1759: 1754: 1749: 1740: 1735: 1728: 1726: 1722: 1721: 1719: 1718: 1713: 1707: 1705: 1701: 1700: 1698: 1697: 1692: 1691: 1690: 1685: 1680: 1675: 1670: 1665: 1660: 1655: 1644: 1642: 1638: 1637: 1635: 1634: 1629: 1624: 1619: 1614: 1609: 1604: 1599: 1594: 1589: 1584: 1579: 1577:Galaksija Plus 1574: 1569: 1564: 1559: 1554: 1549: 1544: 1538: 1536: 1532: 1531: 1525: 1523: 1522: 1515: 1508: 1500: 1494: 1493: 1481: 1480:External links 1478: 1477: 1476: 1470: 1463: 1460: 1445: 1442: 1425: 1424: 1421: 1418: 1415: 1412: 1409: 1406: 1384: 1381: 1375: 1374: 1371: 1368: 1365: 1362: 1359: 1355: 1354: 1351: 1348: 1345: 1342: 1339: 1335: 1334: 1331: 1328: 1325: 1324: -  1322: 1319: 1315: 1314: 1311: 1308: 1305: 1304: -  1302: 1299: 1295: 1294: 1291: 1288: 1285: 1282: 1281: -  1279: 1275: 1274: 1271: 1268: 1265: 1262: 1261: -  1259: 1255: 1254: 1251: 1248: 1245: 1244: -  1242: 1241: -  1239: 1235: 1234: 1231: 1228: 1225: 1224: -  1222: 1221: -  1219: 1215: 1214: 1211: 1208: 1205: 1202: 1199: 1195: 1194: 1191: 1188: 1185: 1182: 1179: 1175: 1174: 1171: 1168: 1165: 1164: -  1162: 1159: 1155: 1154: 1151: 1148: 1145: 1144: -  1142: 1139: 1135: 1134: 1131: 1128: 1125: 1122: 1121: -  1119: 1115: 1114: 1111: 1108: 1105: 1102: 1101: -  1099: 1095: 1094: 1091: 1088: 1085: 1084: -  1082: 1081: -  1079: 1075: 1074: 1071: 1068: 1065: 1064: -  1062: 1061: -  1059: 1055: 1054: 1051: 1048: 1045: 1042: 1039: 1035: 1034: 1031: 1025: 1024: 1021: 1018: 1015: 1012: 1003: 1000: 990:X1, p, n, 0 986:X1, p, n, 1 970: 964: 963: 962: 961: 958: 955: 949: 941: 938: 937: 936: 910: 884: 854: 822: 819: 818: 817: 791: 763: 761:Logical shifts 758: 746: 745: 716: 687: 656: 653: 652: 651: 621: 599: 577: 555: 531: 528: 527: 526: 492: 466: 440: 414: 376: 373: 372: 371: 341: 312: 281: 278: 273: 270: 269: 268: 264:There were no 262: 255: 246:Single 32-bit 244: 210: 207: 206: 205: 198: 197: 196: 182: 164: 150: 119: 116:Index register 112: 86: 83: 15: 13: 10: 9: 6: 4: 3: 2: 1790: 1779: 1776: 1775: 1773: 1758: 1755: 1753: 1750: 1748: 1744: 1741: 1739: 1736: 1734: 1730: 1729: 1727: 1723: 1717: 1714: 1712: 1709: 1708: 1706: 1702: 1696: 1693: 1689: 1686: 1684: 1681: 1679: 1676: 1674: 1671: 1669: 1666: 1664: 1661: 1659: 1656: 1654: 1651: 1650: 1649: 1648:CER Computers 1646: 1645: 1643: 1639: 1633: 1630: 1628: 1625: 1623: 1620: 1618: 1615: 1613: 1610: 1608: 1605: 1603: 1600: 1598: 1595: 1593: 1590: 1588: 1585: 1583: 1580: 1578: 1575: 1573: 1570: 1568: 1565: 1563: 1560: 1558: 1555: 1553: 1550: 1548: 1545: 1543: 1540: 1539: 1537: 1533: 1529: 1521: 1516: 1514: 1509: 1507: 1502: 1501: 1498: 1491: 1487: 1484: 1483: 1479: 1474: 1471: 1469: 1466: 1465: 1461: 1459: 1456: 1454: 1450: 1443: 1441: 1437: 1434: 1432: 1428: 1422: 1419: 1416: 1413: 1410: 1407: 1404: 1403: 1402: 1399: 1397: 1393: 1390: 1382: 1380: 1356: 1347: -  1336: 1316: 1307: -  1296: 1276: 1267: -  1256: 1236: 1227: -  1216: 1198: -  1196: 1187: -  1178: -  1176: 1158: -  1156: 1147: -  1138: -  1136: 1118: -  1116: 1107: -  1098: -  1096: 1078: -  1076: 1067: -  1058: -  1056: 1052: 1049: 1046: 1043: 1040: 1037: 1036: 1028: 1022: 1019: 1016: 1013: 1010: 1009: 1008: 1001: 997: 993: 989: 985: 981: 977: 973: 969: 968: 959: 956: 953: 952: 950: 947: 946: 945: 939: 934: 927: 923: 918: 914: 911: 908: 901: 897: 892: 888: 885: 882: 878: 871: 867: 862: 858: 855: 852: 848: 841: 837: 832: 828: 825: 824: 820: 815: 808: 804: 799: 795: 792: 789: 782: 778: 773: 769: 766: 765: 762: 759: 757: 755: 751: 743: 740:) - performs 739: 736: 729: 724: 720: 717: 714: 711:) - performs 710: 707: 700: 695: 691: 688: 685: 682:) - performs 681: 678: 671: 666: 662: 659: 658: 654: 649: 642: 638: 634: 629: 625: 622: 619: 612: 607: 603: 600: 597: 590: 585: 581: 578: 575: 568: 563: 559: 556: 553: 546: 541: 537: 534: 533: 529: 524: 518:iksnom zarezu 517: 514:kumulatora u 513: 509: 505: 500: 496: 493: 490: 484:iksnom zarezu 483: 479: 474: 470: 467: 464: 458:iksnom zarezu 457: 453: 448: 444: 441: 438: 432:iksnom zarezu 431: 427: 422: 418: 415: 412: 406:iksnom zarezu 405: 401: 396: 392: 389: 388: 387: 386: 383: 374: 369: 362: 358: 354: 349: 345: 342: 339: 332: 329: 325: 320: 316: 313: 310: 303: 300: 296: 291: 287: 284: 283: 279: 277: 271: 267: 263: 260: 256: 253: 249: 245: 242: 239: 235: 231: 228: 224: 220: 216: 215: 214: 208: 203: 199: 194: 191: 187: 183: 180: 177:ndirektno) - 176: 173: 169: 165: 162: 159: 155: 151: 148: 145: 141: 138: 134: 130: 129: 127: 124: 120: 117: 113: 110: 106: 103: 102: 101: 99: 96: 92: 84: 82: 80: 76: 75: 71: 67: 63: 59: 55: 51: 47: 43: 39: 36: 32: 28: 25: 21: 1715: 1457: 1452: 1451: 1447: 1438: 1435: 1430: 1429: 1426: 1400: 1395: 1394: 1386: 1378: 1030:Addr. flags 1005: 998:X2, p, n, 0 995: 991: 987: 983: 979: 975: 971: 967:Sample code: 966: 965: 943: 925: 921: 912: 899: 895: 886: 869: 865: 856: 839: 835: 826: 821:Flow control 806: 802: 793: 780: 776: 767: 747: 727: 718: 698: 689: 669: 660: 640: 636: 632: 623: 610: 601: 588: 579: 566: 557: 544: 535: 515: 511: 507: 503: 494: 481: 477: 468: 455: 451: 442: 429: 425: 416: 403: 399: 390: 379: 378: 360: 356: 352: 343: 330: 327: 323: 314: 301: 298: 294: 285: 275: 240: 233: 229: 222: 212: 201: 192: 185: 174: 167: 160: 153: 146: 139: 132: 123:address mode 88: 72: 37: 30: 26: 19: 18: 1704:Theoretical 1582:Hobby ZR-84 1427:Note that: 974:X1, p, 0 742:logical NOT 709:Disjunction 684:logical AND 680:Conjunction 252:fixed point 248:accumulator 149:) - indexed 98:instruction 62:Pomegranate 713:logical OR 643:kumulatora 326:kumulator 100:contains: 89:The NAR 2 33:ačunar 2, 1572:Galaksija 868:zuslovni 359:ndeksnog 304:kumulator 272:Mnemonics 257:Up to 16 209:Registers 142:osredno, 1772:Category 1725:See also 1612:Lira 386 1602:Lira 512 1597:Pecom 64 1592:Pecom 32 1462:See also 1333:BN+Xi+p 1330:BN+Xi+p 1313:BN+Xi+p 838:gativni 738:Negation 701:junkcija 672:junkcija 385:integer. 355:unjenje 297:emorija 236:aredbi, 184:bit 16: 166:bit 17: 152:bit 18: 147:mediated 131:bit 19: 1695:HRS-100 1688:CER-203 1683:CER-202 1678:CER-200 1607:Lira AT 1562:TIM-600 1557:TIM-030 1552:TIM-011 1547:TIM-001 1542:TIM-100 994:n, 1 978:n, 1 924:ustavi 750:bitwise 635:romeni 506:romeni 363:egistra 333:emoriju 221:called 200:16 bit 95:Machine 66:Serbian 29:stavni 24:Serbian 1747:Serbia 1733:Serbia 1673:CER-22 1668:CER-20 1663:CER-12 1658:CER-11 1653:CER-10 1627:LPA512 1617:Lola 8 1587:ET-188 1528:Serbia 928:ačunar 428:zmi u 402:eri u 232:rojač 202:signed 105:opcode 79:Serbia 1757:World 1743:World 1716:NAR 2 1711:NAR 1 1622:PA512 1468:NAR 1 1373:f(M) 1370:f(M) 1353:f(M) 1293:f(M) 1290:f(M) 1273:f(M) 1253:Xi+p 1250:Xi+p 1233:Xi+p 1213:f(M) 1210:f(M) 1193:f(M) 1173:BN+p 1170:BN+p 1153:BN+p 1133:f(M) 1130:f(M) 1113:f(M) 1053:Jump 1050:Data 982:15 805:meri 779:meri 730:acija 454:ži u 126:flags 107:in 8 50:NAR 1 20:NAR 2 1473:MMIX 1350:M)] 1270:M)] 1190:M)] 1110:M)] 996:oduf 992:oduf 809:esno 639:nak 510:nak 495:PZAF 480:i u 469:DELF 443:MNOF 417:ODUF 391:SABF 74:plum 56:and 1632:Vuk 1453:mua 1431:mua 1423:... 1396:mua 988:mua 984:pir 980:aum 976:mua 972:aum 933:en. 917:sr. 913:ZAR 907:en. 902:kok 898:la- 891:sr. 887:NUS 877:en. 872:kok 861:sr. 857:BES 847:en. 842:kok 831:sr. 827:NES 814:en. 798:sr. 794:POD 788:en. 783:evo 772:sr. 768:POL 735:en. 728:Neg 723:sr. 719:NEG 706:en. 699:Dis 694:sr. 690:DIS 677:en. 670:Kon 665:sr. 661:KON 648:en. 628:sr. 624:PZA 618:en. 611:Del 606:sr. 602:DEL 596:en. 589:Mno 584:sr. 580:MNO 574:en. 569:zmi 567:Odu 562:sr. 558:ODU 552:en. 547:eri 545:Sab 540:sr. 536:SAB 523:en. 499:sr. 489:en. 478:Del 473:sr. 463:en. 452:Mno 447:sr. 437:en. 426:Odu 421:sr. 411:en. 400:Sab 395:sr. 382:en. 368:en. 348:sr. 344:PIR 338:en. 319:sr. 315:AUM 309:en. 290:sr. 286:MUA 238:en. 227:sr. 190:sr. 172:sr. 158:sr. 144:en. 137:sr. 70:en. 64:in 42:bit 35:en. 1774:: 1364:I 1361:R 1344:I 1341:R 1321:R 1310:M 1301:R 1284:I 1264:I 1230:M 1204:I 1201:R 1184:I 1181:R 1161:R 1150:M 1141:R 1124:I 1104:I 1093:p 1090:p 1073:p 1070:M 1047:N 1044:I 1041:R 1038:P 931:, 922:Za 905:, 896:Nu 875:, 866:Be 845:, 836:Ne 812:, 803:Po 786:, 777:Po 733:, 704:, 675:, 646:, 616:, 594:, 591:ži 572:, 550:, 521:, 487:, 461:, 435:, 409:, 366:, 336:, 307:, 223:BN 217:a 128:: 27:Na 1519:e 1512:t 1505:v 1367:N 1358:P 1338:P 1327:N 1318:P 1298:P 1287:N 1278:P 1258:P 1247:N 1238:P 1218:P 1207:N 1167:N 1127:N 1087:N 926:R 915:( 900:S 889:( 870:S 859:( 840:S 829:( 807:D 796:( 781:L 770:( 721:( 692:( 663:( 641:A 637:Z 633:P 626:( 613:i 604:( 582:( 560:( 538:( 516:F 512:A 508:Z 504:P 497:( 482:F 471:( 456:F 445:( 430:F 419:( 404:F 393:( 361:R 357:I 353:P 346:( 331:M 328:U 324:A 317:( 302:A 299:U 295:M 288:( 243:) 234:N 230:B 225:( 193:N 188:( 186:N 175:I 170:( 168:I 161:R 156:( 154:R 140:P 135:( 133:P 31:R 22:(

Index

Serbian
en.
bit
University of Belgrade
NAR 1
Assembly language
Computer architecture
Pomegranate
Serbian
en.
plum
Serbia
central processing unit
Machine
instruction
opcode
most significant bits
Index register
address mode
flags
sr.
en.
sr.
sr.
multi-level memory indirect
sr.
Program counter
sr.
en.
accumulator

Text is available under the Creative Commons Attribution-ShareAlike License. Additional terms may apply.

ā†‘