Verilog output value X in Gate Level - simulation

I'm trying to make a counter that counts up to 18 and from there it needs to go back to 0. I designed it with using D-flip flops, I calculated the functions using K-Map and tried to implement that design in Gate Level in ISE Design Suite.
But when I try to test it in Simulation, all values except clock is always X. I don't know what it means and how can I overcome that.
Here is my code:
module denemeff(A, B, C, D, E, C_CLK);
output A, B, C, D, E;
input C_CLK; // C_CLK stands for Common Clock.
wire C_CLK;
wire A, B, C, D, E;
wire A_BAR, B_BAR, C_BAR, D_BAR, E_BAR;
wire Da, Db, Dc, Dd, De;
wire Da_1, Da_2, Db_1, Db_2, Db_3, Dc_1, Dc_2, Dc_3, Dd_1, Dd_2, Dd_3, De_1, De_2;
not notA(A_BAR, A);
not notB(B_BAR, B);
not notC(C_BAR, C);
not notD(D_BAR, D);
not notE(E_BAR, E);
//Operations for Da
and Da_and_1(Da_1, A_BAR, B, C, D, E);
and Da_and_2(Da_2, A, B_BAR, C_BAR, D_BAR);
or Da_final(Da, Da_1, Da_2);
//Operations for Db
and Db_and_1(Db_1, A_BAR, B, E_BAR);
and Db_and_2(Db_2, A_BAR, B, D_BAR);
and Db_and_3(Db_3, A_BAR, B, C_BAR);
or Db_final(Db, Db_1, Db_2, Db_3);
//Operations for Dc
and Dc_and_1(Dc_1, A_BAR, C_BAR, D, E);
and Dc_and_2(Dc_2, A_BAR, C, D_BAR);
and Dc_and_3(Dc_3, A_BAR, C, E_BAR);
or Dc_final(Dc, Dc_1, Dc_2, Dc_3);
//Operations for Dd
and Dd_and_1(Dd_1, B_BAR, C_BAR, D_BAR, E);
and Dd_and_2(Dd_2, A_BAR, D_BAR, E);
and Dd_and_3(Dd_3, A_BAR, D, E_BAR);
or Dd_final(Dd, Dd_1, Dd_2, Dd_3);
//Operations for De
and De_and_1(De_1, A_BAR, E_BAR);
and De_and_2(De_2, B_BAR, C_BAR, D_BAR, E_BAR);
or De_final(De, De_1, De_2);
dff d_ff_a(A, A_BAR, Da, C_CLK);
dff d_ff_b(B, B_BAR, Db, C_CLK);
dff d_ff_c(C, C_BAR, Dc, C_CLK);
dff d_ff_d(D, D_BAR, Dd, C_CLK);
dff d_ff_e(E, E_BAR, De, C_CLK);
endmodule
module dff(Q, Q_BAR, D, CLK);
input D, CLK;
output Q, Q_BAR;
wire D, CLK;
wire Q, Q_BAR;
not not1(D_BAR, D);
nand n1(X, D, CLK);
nand n2(Y, D_BAR, CLK);
nand n3(Q, Q_BAR, X);
nand n4(Q_BAR, Q, Y);
endmodule

You need to reset your flops. With your current DFF description, the initial output value of Q is unknown and there is no way to reset it to a known value. Hence you see the x values.
See here for some NAND-based DFF designs with asynchronous resets:
http://userpages.umbc.edu/~squire/cs313_l22.html
Or just define them behaviorally:
http://www.asic-world.com/examples/verilog/d_ff.html

Related

PySpark - Creating a single column from multiple columns with some basic math

Consider the following PySpark dataframe
Col1
Col2
Col3
A, B
D, G
A, G
C, F
C, D
A, G
C, F
C, D
A, G
I'd like to create a new dataframe with 2 columns, the first with all the different combinations, and the second column is the ratio: Frequency of Combination / Total Number of Combinations. For example,
Combination
Ratio
A, B
0.111 (1/9)
C, F
0.222 (2/9)
D, G
0.111 (1/9)
C, D
0.222 (2/9)
A, G
0.333 (3/9)
You can unpivot, then group by and count:
from pyspark.sql import functions as F, Window
df2 = df.selectExpr(
'stack(' + str(len(df.columns)) + ', ' + ', '.join(df.columns) + ') as combination'
).groupBy('combination').count().withColumn(
'ratio',
F.col('count') / F.sum('count').over(Window.orderBy())
).drop('count')
df2.show()
+-----------+------------------+
|combination| ratio|
+-----------+------------------+
| A, B|0.1111111111111111|
| C, F|0.2222222222222222|
| C, D|0.2222222222222222|
| D, G|0.1111111111111111|
| A, G|0.3333333333333333|
+-----------+------------------+

Sum of two n bit numbers (n<=255) in 8085 microprocessor

LDA 2000h ; Store the no of byte that each number consists of in memory location 2000h.
MOV C A
MOV B A
LXI D 5000h
LXI H 2001h
STC
CMC
LOOP1: MOV A M
SHLD 7000h
LOOP: INX H
DCR C
JNZ LOOP
ADC M
STAX D
LHLD 7000h
LDA 2000h
MOV C A
INX D
INX H
DCR B
JNZ LOOP1
HLT
This is my code for the above mentioned problem. What would be more efficient algorithm to do so?

Assembly level programming to find the factorial

MVI B 07h
LXI H 0007h
LXI D 0007h
DCR B
LOOP1: DCR B
MOV C B
INR B
LOOP: DAD D
DCR C
JNZ LOOP
MOV E L
MOV D H
DCR B
JNZ LOOP1
HLT
I couldn't find out the problem in my code. Can you please help me out? It's giving me partially wrong answer. The two LSB bits are correct but not the MSBs.
I'm not sure why you're doing the extra decrement (followed by the increment) at the LOOP1 label to the B register but when B is one it causes C to become 0, which then wraps around to FFh and performs the multiply loop another 255 times.
Instead why don't you take out the DCR B / INR B and before the multiply loop just set the H register to 0. The full program would look like this:
MVI B, 07h
LXI H, 0007h
LXI D, 0007h
DCR B
LOOP1:
MOV C, B
LXI H, 0
LOOP:
DAD D
DCR C
JNZ LOOP
MOV E, L
MOV D, H
DCR B
JNZ LOOP1
HLT

creating an adjacency List for Graphs in Scala

I have a list of edges, for an undirected graph, saved in var edges: List[Edge]. Some of them are.
A, B, 6
B, A, 6
A, D, 4
D, A, 4
B, C, 10
C, B, 10
B, D, 7
D, B, 7
B, E, 7
E, B, 7
C, D, 8
D, C, 8
C, E, 5
E, C, 5
C, F, 6
F, C, 6
D, E, 12
E, D, 12
E, F, 7
F, E, 7
I am trying to put them in an adjacency List, in this way:
val adjList: List[(Vertex, List[Vertex])] =
(graph.edges.groupBy(_.source).map
{ case (k,v) => (k, v.map {_.destination}) }).toList
But, it's not functional. Something I am doing wrong? :(
Edit:
It is not wrong (my mistake, read my comment below)!
My given solution up is right. Simply, It was a wrong testing from my side. Thanks your everybody's help.

logical XOR operator in Progress

Is there XOR operator in Progress?
There is AND, OR and NOT, so, i can code "XOR" like this:
(a OR b) AND NOT (a AND b)
I just want to know if the operator exists (with another name).
Thanks.
Unfortunately, there is no such inbuilt operator in Progress.
You can implement it in the way you said.
There is no built-in XOR. But you might find this helpful:
/* _md5.i
RSA Data Security, Inc. MD5 Message-Digest Algorithm
Progress implementation courtesy Ultramain Systems, Inc.
12/20/00 Andrew Brooman
*/
&IF DEFINED ( BROOMAN_MD5_IMPLEMENTATION ) EQ 0 &THEN
&GLOBAL-DEFINE BROOMAN_MD5_IMPLEMENTATION
/* 12/20/00 Andrew Brooman
NOTES:
1) The MD5 algorithm is described at www.landfield.com/rfcs/rfc1321.html.
2) For ease of debugging, I have used the variable names from the algorithm
as described (e.g. M, A, B, C, D, X, Y, Z, FF, GG, HH, II) hence the
inconsistency with Progress naming conventions (e.g. cMessage).
3) A "word" in this algorithm is a long word (32 bits).
4) Progress INTEGERs are signed long words. Despite the signing,
AND, OR, XOR, NOT, Shift, Add seem to work fine. You will notice
use of negative numbers (e.g. initializing MD5 buffers A B C D) when
the high-order bit needs to be set.
MAX INT = +2147483647
MIN INT = -2147483648
MAX INT + 1 = MIN INT (overflows)
29 Aug 2006 Greg Higgins
Removed Functions to _md5.i
Added Preprocessor BROOMAN_MD5_IMPLEMENTATION
Added some ASSIGN statements
*/
/* bitwise logical operations on long words */
FUNCTION bitAND RETURNS INTEGER (INPUT X AS INTEGER, INPUT Y AS INTEGER):
DEFINE VARIABLE b1 AS INTEGER NO-UNDO.
DEFINE VARIABLE b2 AS INTEGER NO-UNDO.
DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE Z AS INTEGER NO-UNDO.
DO n = 1 TO 32:
ASSIGN
b1 = GET-BITS(X, n, 1)
b2 = GET-BITS(Y, n, 1)
.
IF b1 = 1 AND b2 = 1 THEN PUT-BITS(Z, n, 1) = 1.
END.
RETURN Z.
END FUNCTION.
FUNCTION bitNOT RETURNS INTEGER (INPUT X AS INTEGER):
DEFINE VARIABLE b AS INTEGER NO-UNDO.
DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE Z AS INTEGER NO-UNDO.
DO n = 1 TO 32:
b = GET-BITS(X, n, 1).
IF b = 0 THEN PUT-BITS(Z, n, 1) = 1.
END.
RETURN Z.
END FUNCTION.
FUNCTION bitOR RETURNS INTEGER (INPUT X AS INTEGER, INPUT Y AS INTEGER):
DEFINE VARIABLE b1 AS INTEGER NO-UNDO.
DEFINE VARIABLE b2 AS INTEGER NO-UNDO.
DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE Z AS INTEGER NO-UNDO.
DO n = 1 TO 32:
ASSIGN
b1 = GET-BITS(X, n, 1)
b2 = GET-BITS(Y, n, 1)
.
IF b1 = 1 OR b2 = 1 THEN PUT-BITS(Z, n, 1) = 1.
END.
RETURN Z.
END FUNCTION.
FUNCTION bitShift RETURNS INTEGER (INPUT X AS INTEGER, INPUT S AS INTEGER):
DEFINE VARIABLE Z AS INTEGER NO-UNDO.
ASSIGN
PUT-BITS(Z, 1, s) = GET-BITS(X, 33 - s, s)
PUT-BITS(Z, s + 1, 32 - s) = GET-BITS(X, 1, 32 - s)
.
RETURN Z.
END FUNCTION.
FUNCTION bitXOR RETURNS INTEGER (INPUT X AS INTEGER, INPUT Y AS INTEGER):
DEFINE VARIABLE b1 AS INTEGER NO-UNDO.
DEFINE VARIABLE b2 AS INTEGER NO-UNDO.
DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE Z AS INTEGER NO-UNDO.
DO n = 1 TO 32:
ASSIGN
b1 = GET-BITS(X, n, 1)
b2 = GET-BITS(Y, n, 1)
.
IF b1 + b2 = 1 THEN PUT-BITS(Z, n, 1) = 1.
END.
RETURN Z.
END FUNCTION.
/* function to convert integer to hex (starting with low order byte first) */
FUNCTION hexGet RETURNS CHARACTER (INPUT X AS INTEGER):
DEFINE VARIABLE b1 AS INTEGER NO-UNDO.
DEFINE VARIABLE b2 AS INTEGER NO-UNDO.
DEFINE VARIABLE n AS INTEGER NO-UNDO.
DEFINE VARIABLE h AS CHARACTER NO-UNDO INITIAL "0123456789abcdef".
DEFINE VARIABLE Z AS CHARACTER NO-UNDO.
DO n = 0 TO 3:
ASSIGN
b1 = GET-BITS(X, n * 8 + 5, 4)
b2 = GET-BITS(X, n * 8 + 1, 4)
.
Z = Z + SUBSTRING(h, b1 + 1, 1) + SUBSTRING(h, b2 + 1, 1).
END.
RETURN Z.
END FUNCTION.
/* MD5 operations */
FUNCTION F RETURNS INTEGER(INPUT X AS INTEGER, INPUT Y AS INTEGER,
INPUT Z AS INTEGER):
RETURN bitOR(bitAND(X,Y), bitAND(bitNOT(X),Z)).
END FUNCTION.
FUNCTION G RETURNS INTEGER(INPUT X AS INTEGER, INPUT Y AS INTEGER,
INPUT Z AS INTEGER):
RETURN bitOR(bitAND(X, Z), bitAND(Y, bitNOT(Z))).
END FUNCTION.
FUNCTION H RETURNS INTEGER(INPUT X AS INTEGER, INPUT Y AS INTEGER,
INPUT Z AS INTEGER):
RETURN bitXOR(bitXOR(X, Y), Z).
END FUNCTION.
FUNCTION I RETURNS INTEGER(INPUT X AS INTEGER, INPUT Y AS INTEGER,
INPUT Z AS INTEGER):
RETURN bitXOR(Y, bitOR(X, bitNOT(Z))).
END FUNCTION.
/* in the following operations, notice the values for X[k] and T[i]
are passed in rather than looked up--slight deviation from standard */
PROCEDURE Round1:
DEFINE INPUT-OUTPUT PARAMETER a AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER b AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER c AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER d AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Xk AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER s AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Ti AS INTEGER NO-UNDO.
a = b + bitShift(a + F(b, c, d) + Xk + Ti, s).
END PROCEDURE.
PROCEDURE Round2:
DEFINE INPUT-OUTPUT PARAMETER a AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER b AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER c AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER d AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Xk AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER s AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Ti AS INTEGER NO-UNDO.
a = b + bitShift(a + G(b, c, d) + Xk + Ti, s).
END PROCEDURE.
PROCEDURE Round3:
DEFINE INPUT-OUTPUT PARAMETER a AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER b AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER c AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER d AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Xk AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER s AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Ti AS INTEGER NO-UNDO.
a = b + bitShift(a + H(b, c, d) + Xk + Ti, s).
END PROCEDURE.
PROCEDURE Round4:
DEFINE INPUT-OUTPUT PARAMETER a AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER b AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER c AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER d AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Xk AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER s AS INTEGER NO-UNDO.
DEFINE INPUT PARAMETER Ti AS INTEGER NO-UNDO.
a = b + bitShift(a + I(b, c, d) + Xk + Ti, s).
END PROCEDURE.
/* main function to compute an MD5 digest */
FUNCTION MD5 RETURNS CHARACTER (INPUT cMessage AS CHARACTER):
DEFINE VARIABLE A AS INTEGER NO-UNDO.
DEFINE VARIABLE AA AS INTEGER NO-UNDO.
DEFINE VARIABLE B AS INTEGER NO-UNDO.
DEFINE VARIABLE BB AS INTEGER NO-UNDO.
DEFINE VARIABLE C AS INTEGER NO-UNDO.
DEFINE VARIABLE CC AS INTEGER NO-UNDO.
DEFINE VARIABLE D AS INTEGER NO-UNDO.
DEFINE VARIABLE DD AS INTEGER NO-UNDO.
DEFINE VARIABLE i AS INTEGER NO-UNDO.
DEFINE VARIABLE j AS INTEGER NO-UNDO.
DEFINE VARIABLE M AS MEMPTR NO-UNDO.
DEFINE VARIABLE N AS INTEGER NO-UNDO.
DEFINE VARIABLE X AS INTEGER NO-UNDO EXTENT 16.
DEFINE VARIABLE cDigest AS CHARACTER NO-UNDO.
DEFINE VARIABLE iLenOrig AS INTEGER NO-UNDO.
DEFINE VARIABLE iLenPadded AS INTEGER NO-UNDO.
DEFINE VARIABLE iPadding AS INTEGER NO-UNDO.
/* compute original message length */
iLenOrig = LENGTH(cMessage).
/* compute padded message length:
a) must be a multiple of 64 bytes
b) must have at least 9 bytes of padding
*/
iPadding = 64 - iLenOrig MOD 64.
IF iPadding < 9 THEN iPadding = iPadding + 64.
iLenPadded = iLenOrig + iPadding.
/* create MEMPTR to hold message since we need to manipulate bits,
bytes, and long words */
ASSIGN
SET-SIZE(M) = iLenPadded
SET-BYTE-ORDER(M) = 3 /* little-endian */
.
/* add padding */
ASSIGN
PUT-STRING(M, 1, iLenOrig) = cMessage
PUT-BYTE(M, iLenOrig + 1) = 128
PUT-LONG(M, iLenPadded - 7) = iLenOrig * 8
.
/* initialize MD registers */
ASSIGN
A = 1732584193
B = -271733879
C = -1732584194
D = 271733878
.
/* process message in N blocks of 16 words (64 bytes) */
N = iLenPadded / 64 - 1.
DO i = 0 TO N:
/* copy 16 words into working buffer X */
DO j = 0 TO 15:
X[j + 1] = GET-LONG(M, i * 64 + j * 4 + 1).
END.
/* store current MD5 registers */
ASSIGN
AA = A
BB = B
CC = C
DD = D
.
/* note: in the following rounds, minor changes were made:
a) X[k] is passed rather than k
b) T[i] is passed rather that i
c) because Progress has one based arrays, the subscript
for X[k] is one higher than the standard algorithm
*/
/* round 1 */
RUN Round1(INPUT-OUTPUT A, B, C, D, X[1], 7, -680876936).
RUN Round1(INPUT-OUTPUT D, A, B, C, X[2], 12, -389564586).
RUN Round1(INPUT-OUTPUT C, D, A, B, X[3], 17, 606105819).
RUN Round1(INPUT-OUTPUT B, C, D, A, X[4], 22, -1044525330).
RUN Round1(INPUT-OUTPUT A, B, C, D, X[5], 7, -176418897).
RUN Round1(INPUT-OUTPUT D, A, B, C, X[6], 12, 1200080426).
RUN Round1(INPUT-OUTPUT C, D, A, B, X[7], 17, -1473231341).
RUN Round1(INPUT-OUTPUT B, C, D, A, X[8], 22, -45705983).
RUN Round1(INPUT-OUTPUT A, B, C, D, X[9], 7, 1770035416).
RUN Round1(INPUT-OUTPUT D, A, B, C, X[10], 12, -1958414417).
RUN Round1(INPUT-OUTPUT C, D, A, B, X[11], 17, -42063).
RUN Round1(INPUT-OUTPUT B, C, D, A, X[12], 22, -1990404162).
RUN Round1(INPUT-OUTPUT A, B, C, D, X[13], 7, 1804603682).
RUN Round1(INPUT-OUTPUT D, A, B, C, X[14], 12, -40341101).
RUN Round1(INPUT-OUTPUT C, D, A, B, X[15], 17, -1502002290).
RUN Round1(INPUT-OUTPUT B, C, D, A, X[16], 22, 1236535329).
/* round 2 */
RUN Round2(INPUT-OUTPUT A, B, C, D, X[2], 5, -165796510).
RUN Round2(INPUT-OUTPUT D, A, B, C, X[7], 9, -1069501632).
RUN Round2(INPUT-OUTPUT C, D, A, B, X[12], 14, 643717713).
RUN Round2(INPUT-OUTPUT B, C, D, A, X[1], 20, -373897302).
RUN Round2(INPUT-OUTPUT A, B, C, D, X[6], 5, -701558691).
RUN Round2(INPUT-OUTPUT D, A, B, C, X[11], 9, 38016083).
RUN Round2(INPUT-OUTPUT C, D, A, B, X[16], 14, -660478335).
RUN Round2(INPUT-OUTPUT B, C, D, A, X[5], 20, -405537848).
RUN Round2(INPUT-OUTPUT A, B, C, D, X[10], 5, 568446438).
RUN Round2(INPUT-OUTPUT D, A, B, C, X[15], 9, -1019803690).
RUN Round2(INPUT-OUTPUT C, D, A, B, X[4], 14, -187363961).
RUN Round2(INPUT-OUTPUT B, C, D, A, X[9], 20, 1163531501).
RUN Round2(INPUT-OUTPUT A, B, C, D, X[14], 5, -1444681467).
RUN Round2(INPUT-OUTPUT D, A, B, C, X[3], 9, -51403784).
RUN Round2(INPUT-OUTPUT C, D, A, B, X[8], 14, 1735328473).
RUN Round2(INPUT-OUTPUT B, C, D, A, X[13], 20, -1926607734).
/* round 3 */
RUN Round3(INPUT-OUTPUT A, B, C, D, X[6], 4, -378558).
RUN Round3(INPUT-OUTPUT D, A, B, C, X[9], 11, -2022574463).
RUN Round3(INPUT-OUTPUT C, D, A, B, X[12], 16, 1839030562).
RUN Round3(INPUT-OUTPUT B, C, D, A, X[15], 23, -35309556).
RUN Round3(INPUT-OUTPUT A, B, C, D, X[2], 4, -1530992060).
RUN Round3(INPUT-OUTPUT D, A, B, C, X[5], 11, 1272893353).
RUN Round3(INPUT-OUTPUT C, D, A, B, X[8], 16, -155497632).
RUN Round3(INPUT-OUTPUT B, C, D, A, X[11], 23, -1094730640).
RUN Round3(INPUT-OUTPUT A, B, C, D, X[14], 4, 681279174).
RUN Round3(INPUT-OUTPUT D, A, B, C, X[1], 11, -358537222).
RUN Round3(INPUT-OUTPUT C, D, A, B, X[4], 16, -722521979).
RUN Round3(INPUT-OUTPUT B, C, D, A, X[7], 23, 76029189).
RUN Round3(INPUT-OUTPUT A, B, C, D, X[10], 4, -640364487).
RUN Round3(INPUT-OUTPUT D, A, B, C, X[13], 11, -421815835).
RUN Round3(INPUT-OUTPUT C, D, A, B, X[16], 16, 530742520).
RUN Round3(INPUT-OUTPUT B, C, D, A, X[3], 23, -995338651).
/* round 4 */
RUN Round4(INPUT-OUTPUT A, B, C, D, X[1], 6, -198630844).
RUN Round4(INPUT-OUTPUT D, A, B, C, X[8], 10, 1126891415).
RUN Round4(INPUT-OUTPUT C, D, A, B, X[15], 15, -1416354905).
RUN Round4(INPUT-OUTPUT B, C, D, A, X[6], 21, -57434055).
RUN Round4(INPUT-OUTPUT A, B, C, D, X[13], 6, 1700485571).
RUN Round4(INPUT-OUTPUT D, A, B, C, X[4], 10, -1894986606).
RUN Round4(INPUT-OUTPUT C, D, A, B, X[11], 15, -1051523).
RUN Round4(INPUT-OUTPUT B, C, D, A, X[2], 21, -2054922799).
RUN Round4(INPUT-OUTPUT A, B, C, D, X[9], 6, 1873313359).
RUN Round4(INPUT-OUTPUT D, A, B, C, X[16], 10, - 30611744).
RUN Round4(INPUT-OUTPUT C, D, A, B, X[7], 15, -1560198380).
RUN Round4(INPUT-OUTPUT B, C, D, A, X[14], 21, 1309151649).
RUN Round4(INPUT-OUTPUT A, B, C, D, X[5], 6, -145523070).
RUN Round4(INPUT-OUTPUT D, A, B, C, X[12], 10, -1120210379).
RUN Round4(INPUT-OUTPUT C, D, A, B, X[3], 15, 718787259).
RUN Round4(INPUT-OUTPUT B, C, D, A, X[10], 21, -343485551).
/* update MD5 registers */
ASSIGN
A = A + AA
B = B + BB
C = C + CC
D = D + DD
.
END.
/* convert MD5 registers to hex string from low-order A to high-order D */
cDigest = hexGet(A) + hexGet(B) + hexGet(C) + hexGet(D).
/* cleanup and return */
SET-SIZE(M) = 0.
RETURN cDigest.
END FUNCTION.
&ENDIF
/* End of _md5.i */