This is only tangentially related but the best course that actually made real analysis click for me was from Harvey Mudd, seems like a solid university: https://www.youtube.com/playlist?list=PL04BA7A9EB907EDAF
Harvey Mudd Miniature Machine
11–20 of 27 posts
Re: Harvey Mudd Miniature Machine
#12Earlier quoted context omitted.
I feel like I'm missing something, Henry Mudd Harvey Mudd's son?
I'm guessing he was probably trying to refer to Harry Mudd, the Star Trek character?
Re: Harvey Mudd Miniature Machine
#13Here's one from (the younger) me:
=======================
Description
=======================
24-bit words (no bytes, so no endianness)
5 1 3 3 12
r2 = 0 means zero value
dir/ind:
0 dir
1 ind
cond:
001 eq
010 lt
1000 gt
8 regs
r0 = PC
op:
00x xx0 - type independent
01x xx0 - bitwise
10x xx0 - integer
11x xx0 - floating-point
ST 00 ; store (ignores ind/dir)
LD 02 ; load/move
BR 04 ; branch (rel/abs)
SL 20 ; shift left
SR 22 ; shift right
SA 24 ; shift right arithmetical
OR 26 ; or
AN 30 ; and
OX 32 ; or exclusive (xor)
NO 34 ; not
AD 40 ; add
SB 42 ; subtract
MU 44 ; multiply
DV 46 ; divide
CP 50 ; compare
FA 60 ; add
FS 62 ; subtract
FM 64 ; multiply
FD 66 ; divide
FC 70 ; compare
example:
LD r1, [4096] ; |03121000|
AD r1, 1 ; |40100001|
LD r2, r1 ; |02210000|
SB r2, 33 ; |42200033|
BR le, exit ; |04300001|
ST r1, [4096] ; |01201000|
exit: .
floating-point format - normalized:
1 7 16 + 1 implicit
literals:
decimal: -8,388,608 ... 8,388,607 (can use commas)
binary (in octal): |42200033|
floating-point: 1.23e-45
character sequence 'abc' (3 characters per word)
r0 can be used as a temporary
=======================
Implementation
=======================
#include
#include
#define n 1024
#define trace(op) fprintf(stderr, "%04o %s\n", r0, #op)
enum {
ST = 000, /* store (ignores ind/dir) */
LD = 002, /* load/move */
BR = 004, /* branch (ignores ind/dir) */
SL = 020, /* shift left */
SR = 022, /* shift right */
SA = 024, /* shift right arithmetical */
OR = 026, /* or */
AN = 030, /* and */
OX = 032, /* or exclusive (xor) */
NO = 034, /* not */
AD = 040, /* add */
SB = 042, /* subtract */
MU = 044, /* multiply */
DV = 046, /* divide */
CP = 050, /* compare */
FA = 060, /* add */
FS = 062, /* subtract */
FM = 064, /* multiply */
FD = 066, /* divide */
FC = 070 /* compare */
};
int main() {
static int b[n];
/* load image */
int c, *p, s, z;
static int r[8];
for (s = 21, p = b; p 0;)
if (isdigit(c) && c = 0 && r[0] > 19 & 31) > 18 & 1);
x = i >> 15 & 7;
y = i >> 12 & 7;
v = ((i > 20) + (y ? r[y] : 0); /* assuming 32-bit ints */
switch(o) {
case ST: b[v] = r[x]; trace(ST); break;
case LD: r[x] = d ? v : b[v]; trace(LD); break;
case BR: if (x & c) r[0] += v; trace(BR); break;
case SL: r[x] > v; c = r[x] == 0 ? 1 : r[x] > (unsigned) v; c = r[x] == 0 ? 1 : r[x] 3)
puts("........");
else if (z > 1)
puts("00000000");
if (z > 2)
puts("00000000");
z = 0;
}
for (s = 21, m = 7 >= 3, s -= 3)
putchar(0x30 | (*p & m) >> s);
putchar('\n');
}
else
++z;
return 0;
}
=======================
Example: Bubble Sort
=======================
0000 LD r1, 10 ; n = 8 02100010
repeat:
0001 SB r1, 1 ; n = n - 1 42100001
0002 LD r2, 0 ; i = 0 02200000
0003 LD r3, 0 ; f = false 02300000
compare:
0004 LD r4, [r2 + data] ; 03420021
0005 CP r4, [r2 + data + 1] ; 51420022
0006 BR le, next ; 04300004
0007 LD r5, [r2 + data + 1] ; swap 03520022
0010 ST r5, [r2 + data] ; 00520021
0011 ST r4, [r2 + data + 1] ; 00420022
0012 LD r3, 1 ; f = true 02300001
next:
0013 AD r2, 1 ; i = i + 1 40200001
0014 CP r2, r1 ; i Re: Harvey Mudd Miniature Machine
#14This is only tangentially related but the best course that actually made real analysis click for me was from Harvey Mudd, seems like a solid university: https://www.youtube.com/playlist?list=PL04BA7A9EB907EDAF
Went there, can definitely recommend
Re: Harvey Mudd Miniature Machine
#15I got all excited until I realized Harvey Mudd isn't Henry Mudd. This project would have had a lot more cred, in my book, if it were the latter.
Re: Harvey Mudd Miniature Machine
#16I got all excited until I realized Harvey Mudd isn't Henry Mudd. This project would have had a lot more cred, in my book, if it were the latter.