diff options
author | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-10-31 15:35:11 +0100 |
---|---|---|
committer | Alex AUVOLAT <alex.auvolat@ens.fr> | 2013-10-31 15:35:11 +0100 |
commit | 0b269f32dd9b8d349f94793dad44e728473e9f0a (patch) | |
tree | 066a30fee1efe19d897f5e153d7ea9aa3d7448af /tp1/test | |
download | SystDigit-Projet-0b269f32dd9b8d349f94793dad44e728473e9f0a.tar.gz SystDigit-Projet-0b269f32dd9b8d349f94793dad44e728473e9f0a.zip |
First commit ; includes first TP and minijazz compiler
Diffstat (limited to 'tp1/test')
-rw-r--r-- | tp1/test/clock_div.mj | 4 | ||||
-rw-r--r-- | tp1/test/clock_div.net | 9 | ||||
-rw-r--r-- | tp1/test/cm2.mj | 4 | ||||
-rw-r--r-- | tp1/test/cm2.net | 9 | ||||
-rw-r--r-- | tp1/test/fulladder.mj | 4 | ||||
-rw-r--r-- | tp1/test/fulladder.net | 12 | ||||
-rw-r--r-- | tp1/test/nadder.mj | 19 | ||||
-rw-r--r-- | tp1/test/nadder.net | 17 | ||||
-rw-r--r-- | tp1/test/ram.mj | 15 | ||||
-rw-r--r-- | tp1/test/ram.net | 32 |
10 files changed, 125 insertions, 0 deletions
diff --git a/tp1/test/clock_div.mj b/tp1/test/clock_div.mj new file mode 100644 index 0000000..ad1e919 --- /dev/null +++ b/tp1/test/clock_div.mj @@ -0,0 +1,4 @@ +main() = (o) where + o = reg(c); + c = not (reg (o)) +end where
\ No newline at end of file diff --git a/tp1/test/clock_div.net b/tp1/test/clock_div.net new file mode 100644 index 0000000..9a17fc7 --- /dev/null +++ b/tp1/test/clock_div.net @@ -0,0 +1,9 @@ +INPUT +OUTPUT o +VAR + _l_2, c, o +IN +c = NOT _l_2 +o = REG c +_l_2 = REG o + diff --git a/tp1/test/cm2.mj b/tp1/test/cm2.mj new file mode 100644 index 0000000..8863bf1 --- /dev/null +++ b/tp1/test/cm2.mj @@ -0,0 +1,4 @@ +main(x) = (s, r) where + s = reg (x xor s); + r = x and s +end where
\ No newline at end of file diff --git a/tp1/test/cm2.net b/tp1/test/cm2.net new file mode 100644 index 0000000..e296b96 --- /dev/null +++ b/tp1/test/cm2.net @@ -0,0 +1,9 @@ +INPUT x +OUTPUT s, r +VAR + _l_1, r, s, x +IN +r = AND x s +s = REG _l_1 +_l_1 = XOR x s + diff --git a/tp1/test/fulladder.mj b/tp1/test/fulladder.mj new file mode 100644 index 0000000..c4b6b0e --- /dev/null +++ b/tp1/test/fulladder.mj @@ -0,0 +1,4 @@ +main(a,b,c) = (s, r) where + s = (a xor b) xor c; + r = (a and b) or ((a xor b) and c); +end where
\ No newline at end of file diff --git a/tp1/test/fulladder.net b/tp1/test/fulladder.net new file mode 100644 index 0000000..b2271c2 --- /dev/null +++ b/tp1/test/fulladder.net @@ -0,0 +1,12 @@ +INPUT a, b, c +OUTPUT s, r +VAR + _l_1, _l_3, _l_4, _l_5, a, b, c, r, s +IN +r = OR _l_3 _l_5 +s = XOR _l_1 c +_l_1 = XOR a b +_l_3 = AND a b +_l_4 = XOR a b +_l_5 = AND _l_4 c + diff --git a/tp1/test/nadder.mj b/tp1/test/nadder.mj new file mode 100644 index 0000000..0c95386 --- /dev/null +++ b/tp1/test/nadder.mj @@ -0,0 +1,19 @@ +fulladder(a,b,c) = (s, r) where + s = (a ^ b) ^ c; + r = (a & b) + ((a ^ b) & c); +end where + +adder<n>(a:[n], b:[n], c_in) = (o:[n], c_out) where + if n = 0 then + o = []; + c_out = 0 + else + (s_n1, c_n1) = adder<n-1>(a[1..], b[1..], c_in); + (s_n, c_out) = fulladder(a[0], b[0], c_n1); + o = s_n . s_n1 + end if +end where + +main(a, b) = (o, c) where + (o, c) = adder<1>(a,b,0) +end where
\ No newline at end of file diff --git a/tp1/test/nadder.net b/tp1/test/nadder.net new file mode 100644 index 0000000..bf87051 --- /dev/null +++ b/tp1/test/nadder.net @@ -0,0 +1,17 @@ +INPUT a, b +OUTPUT o, c +VAR + _l_10_50, _l_11_49, _l_16_22, _l_17_21, _l_7_52, _l_9_51, a, b, c, + c_n1_27, o, s_n_26 +IN +o = s_n_26 +c = OR _l_9_51 _l_11_49 +s_n_26 = XOR _l_7_52 c_n1_27 +_l_7_52 = XOR _l_16_22 _l_17_21 +_l_9_51 = AND _l_16_22 _l_17_21 +_l_10_50 = XOR _l_16_22 _l_17_21 +_l_11_49 = AND _l_10_50 c_n1_27 +c_n1_27 = 0 +_l_16_22 = SELECT 0 a +_l_17_21 = SELECT 0 b + diff --git a/tp1/test/ram.mj b/tp1/test/ram.mj new file mode 100644 index 0000000..7c4d1ed --- /dev/null +++ b/tp1/test/ram.mj @@ -0,0 +1,15 @@ +const addr = 2 +const word = 4 + +or_n<n>(a:[n],b:[n]) = (o:[n]) where + if n = 0 then + o = [] + else + o = (a[0] and b[0]).(or_n<n-1>(a[1..], b[1..])) + end if +end where + +main(ra:[addr], we, wa:[addr], c:[word]) = (o:[word]) where + o = ram<addr, word>(ra, we, wa, or_n<word>(o, c)) +end where + diff --git a/tp1/test/ram.net b/tp1/test/ram.net new file mode 100644 index 0000000..ee4570a --- /dev/null +++ b/tp1/test/ram.net @@ -0,0 +1,32 @@ +INPUT ra, we, wa, c +OUTPUT o +VAR + _l_10_22, _l_10_35, _l_10_48, _l_10_61, _l_11_21, _l_11_34, _l_11_47, + _l_11_60, _l_12_20 : 3, _l_12_33 : 2, _l_12_46 : 1, _l_13_19 : 3, _l_13_32 : 2, + _l_13_45 : 1, _l_14_18 : 3, _l_14_31 : 2, _l_14_44 : 1, _l_16 : 4, + _l_9_23, _l_9_36, _l_9_49, _l_9_62, c : 4, o : 4, ra : 2, wa : 2, we +IN +o = RAM 2 4 ra we wa _l_16 +_l_16 = CONCAT _l_11_21 _l_14_18 +_l_9_23 = SELECT 0 o +_l_10_22 = SELECT 0 c +_l_11_21 = AND _l_9_23 _l_10_22 +_l_12_20 = SLICE 1 3 o +_l_13_19 = SLICE 1 3 c +_l_14_18 = CONCAT _l_11_34 _l_14_31 +_l_9_36 = SELECT 0 _l_12_20 +_l_10_35 = SELECT 0 _l_13_19 +_l_11_34 = AND _l_9_36 _l_10_35 +_l_12_33 = SLICE 1 2 _l_12_20 +_l_13_32 = SLICE 1 2 _l_13_19 +_l_14_31 = CONCAT _l_11_47 _l_14_44 +_l_9_49 = SELECT 0 _l_12_33 +_l_10_48 = SELECT 0 _l_13_32 +_l_11_47 = AND _l_9_49 _l_10_48 +_l_12_46 = SLICE 1 1 _l_12_33 +_l_13_45 = SLICE 1 1 _l_13_32 +_l_14_44 = _l_11_60 +_l_9_62 = SELECT 0 _l_12_46 +_l_10_61 = SELECT 0 _l_13_45 +_l_11_60 = AND _l_9_62 _l_10_61 + |