Category: Computer organization and architecture

Computer organization and architecture program in java

RESTORING Division program in java

RESTORING Division program in java

import java.util.*; class RESTORING { public static void lshift(int a[],int q[]) { for(int i=0;i<3;i++) { a[i]=a[i+1]; } a[3]=q[0]; for(int i=0;i<3;i++) { q[i]=q[i+1]; } q[3]=0; } public static int[] add(int a[],int m1[]) { int carry...

Booths Algorithm program in java

Booths Algorithm program in java

import java.util.*; class BOOTH { public static int[] add(int a[],int m1[]) { int carry=0; int sum[]=new int [4]; for(int i=3;i>=0;i–) { sum[i]=(a[i]+m1[i]+carry)%2; carry=(a[i]+m1[i]+carry)/2; } return sum; } public static void shift(int a[],int q[]) {...

non restoring division algorithm in java

non restoring division algorithm in java

import java.io.*; class NONRESTORING { public static int[] lshift(int s1[],int s2) { int s[]=new int [4]; for(int i=0;i<3;i++) { s[i]=s1[i+1]; } s[3]=s2; return(s); } public static int[] add(int A[],int B[]) { int s[]=new int...

Full Adder program in java

Full Adder program in java

import java.util.*; class FULLADDER { public static void main(String args[]) { int a[],b[]; Scanner sc=new Scanner(System.in); System.out.println(“ENTER NUMBER OF BITS : “); int n=sc.nextInt(); a=new int[n]; b=new int[n]; System.out.println(“ENTER ELEMENTS : \nA CONTAINS:”); for(int...