Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
71020198e4 | ||
|
|
66f1340c35 | ||
|
|
0ee3ddfd03 | ||
|
|
4b742dd23b | ||
|
|
cbf5100a16 | ||
|
|
dd51f49d5b | ||
|
|
64c6a3004d | ||
|
|
04c0284ca7 | ||
|
|
c22bd92d64 | ||
|
|
cbd6a1fa29 | ||
|
|
8d0db9c098 | ||
|
|
17e9bbad82 | ||
|
|
c211089a94 | ||
|
|
28dcb864ae | ||
|
|
33b91c2dfb | ||
|
|
1ed8ad5fdc | ||
|
|
165500c739 | ||
|
|
b037c0f6fc | ||
|
|
c8384eb9f6 | ||
|
|
484940f8de | ||
|
|
8e7477b83b | ||
|
|
51f295d37f | ||
|
|
2721d59449 | ||
|
|
1864b98e55 | ||
|
|
8af5e1a8a5 | ||
|
|
9360547eab | ||
|
|
556dc410f5 | ||
|
|
fc50f1f9d3 | ||
|
|
c52c69e8fb | ||
|
|
83373bbae5 | ||
|
|
c922fbe961 | ||
|
|
1970a91580 | ||
|
|
4bce0d8107 | ||
|
|
7b0201b69c | ||
|
|
11567d0f3d | ||
|
|
d8f6070643 | ||
|
|
0c46a7fe81 | ||
|
|
3eeaa0a5f5 | ||
|
|
d7b4ade86c | ||
|
|
84ee9394fe | ||
|
|
92781859e1 | ||
|
|
19eadde8da | ||
|
|
95a989a001 | ||
|
|
82f64d5e06 | ||
|
|
83315b4c17 | ||
|
|
24e5cb75cb | ||
|
|
756dc0ec5a | ||
|
|
5ffd02c06e | ||
|
|
d34a85dbd0 | ||
|
|
1aa4dcee1f | ||
|
|
99a3711411 | ||
|
|
47c9f86bae | ||
|
|
d32d1d090b | ||
|
|
a4b3c6cbb5 | ||
|
|
d1e884eb47 | ||
|
|
e58772981a | ||
|
|
1f4de98cea | ||
|
|
2808f7e893 | ||
|
|
e8863e01ba | ||
|
|
1ddbed0820 | ||
|
|
d9db6eed75 | ||
|
|
f538cb1577 | ||
|
|
bd5ea68dda | ||
|
|
c1e96aecba | ||
|
|
c34cdf77ac | ||
|
|
905ec4a05e | ||
|
|
15da56174f | ||
|
|
7467d81909 | ||
|
|
e803bf494d | ||
|
|
cfe212249a | ||
|
|
f9051bc51c | ||
|
|
14ff542f7a | ||
|
|
7efce56819 | ||
|
|
51899a014d | ||
|
|
736cf3464d | ||
|
|
5dad6f21b4 | ||
|
|
b99fc27ccc | ||
|
|
dda7811902 | ||
|
|
3803aa154c | ||
|
|
d3b0f59c8b | ||
|
|
0f7a8fb950 | ||
|
|
d0677069e1 | ||
|
|
a9da9b8d3d | ||
|
|
3c29cd8d3f | ||
|
|
3b9576c520 | ||
|
|
a8e4af4484 | ||
|
|
f323c6fd7a | ||
|
|
619807f898 | ||
|
|
6fd2570659 | ||
|
|
b9f08b774d | ||
|
|
6984f03f6f | ||
|
|
b4f968c7c4 | ||
|
|
2e87c7c8e2 | ||
|
|
4b69580c5d | ||
|
|
1d3ac60495 | ||
|
|
795ca6b382 | ||
|
|
881893fda3 | ||
|
|
ef273a188a | ||
|
|
06feba8f63 | ||
|
|
d0433ac19d | ||
|
|
3a7cd38951 | ||
|
|
8c656907f3 | ||
|
|
7b2080f729 | ||
|
|
5f6b6097aa | ||
|
|
d7d8e55e83 | ||
|
|
93a4d8905d | ||
|
|
1a346c73d9 | ||
|
|
4943c43e32 | ||
|
|
599726a7b2 | ||
|
|
ff4700093d | ||
|
|
480214099c | ||
|
|
b3e02ac085 | ||
|
|
f72d1deb10 | ||
|
|
0f36365c8f | ||
|
|
47ec6a20ee | ||
|
|
c4cf1e850b | ||
|
|
f6813422d3 | ||
|
|
1787a89840 | ||
|
|
89ab6cb56c | ||
|
|
8c34443241 | ||
|
|
44743f9de8 | ||
|
|
638ce8aca6 | ||
|
|
3dcf4ac4ee | ||
|
|
7d85a6682c | ||
|
|
7dd115a77b | ||
|
|
9c3fdb9862 | ||
|
|
5e1f2c0642 | ||
|
|
3bb2a235f5 | ||
|
|
a7b7a37fe6 | ||
|
|
9d6ab7b156 | ||
|
|
018cb85f4b | ||
|
|
36e1738f34 | ||
|
|
3b79938452 | ||
|
|
2dd7abc098 | ||
|
|
93ffa53c60 | ||
|
|
5df39993c6 | ||
|
|
cb6cb78ea2 | ||
|
|
ebe4306954 | ||
|
|
165f0a4d91 | ||
|
|
562c2ea650 | ||
|
|
df2e491f6e | ||
|
|
3625f3e441 | ||
|
|
901475f64b | ||
|
|
345dc15c72 | ||
|
|
7bb287e303 | ||
|
|
98f2150ec7 | ||
|
|
5583170836 | ||
|
|
ce651be552 | ||
|
|
6177a79e5a | ||
|
|
7944c546df | ||
|
|
2e7c1bf9fd | ||
|
|
af3f095306 | ||
|
|
bfa464ddb8 | ||
|
|
5870d9af59 | ||
|
|
19876a64f5 | ||
|
|
cd3b9bdb0f | ||
|
|
d249d20b50 | ||
|
|
a1df4a5323 | ||
|
|
cb3024c2ff | ||
|
|
88e3c73665 | ||
|
|
9a0571f6ce | ||
|
|
48a6292f4c | ||
|
|
1bc565b404 | ||
|
|
16c9996524 | ||
|
|
fa2e213d8f | ||
|
|
82838a75ef | ||
|
|
1a984690a6 | ||
|
|
3aa61449c3 | ||
|
|
2fd87cc940 | ||
|
|
1c21af3d1c | ||
|
|
d9427ed6e3 | ||
|
|
44047cd580 | ||
|
|
4a87b2b9bb | ||
|
|
26f86652fa | ||
|
|
f42fa2e6a9 | ||
|
|
d022d78049 | ||
|
|
057e6edb2d | ||
|
|
6851dcf324 | ||
|
|
c3488bcd1a | ||
|
|
a962976b96 | ||
|
|
4798698a38 | ||
|
|
03d6b84ac7 | ||
|
|
1a8a2f6b8b | ||
|
|
701cc392a0 | ||
|
|
e27233e516 | ||
|
|
2415e4c78b | ||
|
|
d049b5824e | ||
|
|
0d70374cd0 | ||
|
|
6ffb11b44b | ||
|
|
55b8103189 | ||
|
|
ca5f96d996 | ||
|
|
a5b3234e99 | ||
|
|
096674ce14 | ||
|
|
2857236623 | ||
|
|
1ab613da24 | ||
|
|
fcb43650e4 | ||
|
|
be35445fdb | ||
|
|
fd0972e5dd | ||
|
|
9837603ae1 | ||
|
|
f045dc1592 | ||
|
|
272d7f0f7d | ||
|
|
af8fb3b865 | ||
|
|
3f1d7e4a15 | ||
|
|
84e83a7977 | ||
|
|
03d0e1a6b9 | ||
|
|
270a1dbda9 | ||
|
|
0047d32755 | ||
|
|
85c1156549 | ||
|
|
ed3b12acda | ||
|
|
74e4af5fdf | ||
|
|
2f7ab91e0d | ||
|
|
9edf6a70af | ||
|
|
eed1090f2d | ||
|
|
010c1d2b65 | ||
|
|
d0c4a3d800 | ||
|
|
bdb8fec295 | ||
|
|
73cfd45401 | ||
|
|
5309734167 | ||
|
|
55ee041c08 | ||
|
|
e3aeadebf5 | ||
|
|
b06e84a2b7 | ||
|
|
0a2abde8bf | ||
|
|
097032e4d5 | ||
|
|
d61b3c2e0c | ||
|
|
5af1242330 | ||
|
|
ea60299d26 | ||
|
|
32440f7db9 | ||
|
|
00ae5a7810 | ||
|
|
67d79572d7 | ||
|
|
c24915c0ba | ||
|
|
808f924277 | ||
|
|
2650ac571e | ||
|
|
503a275b6f | ||
|
|
df5ede51c2 | ||
|
|
398b9be4c1 | ||
|
|
82f44a02c8 | ||
|
|
3302a57d0c | ||
|
|
a7deab4d4b | ||
|
|
6f7fa8bd78 | ||
|
|
7cf6386cff | ||
|
|
0404c24bdc | ||
|
|
356125d58d | ||
|
|
3846de5ae3 | ||
|
|
bfbed487d5 | ||
|
|
697150b619 | ||
|
|
ea06df8e15 | ||
|
|
201c5d54de | ||
|
|
9cf0030fe8 | ||
|
|
73452b0abc | ||
|
|
5743284dbf | ||
|
|
9d6ff5fa17 | ||
|
|
c5d7d2fe3b | ||
|
|
88975a56a0 | ||
|
|
f84cdc7e6b | ||
|
|
3419540ef7 | ||
|
|
35c1a4e010 | ||
|
|
364a66b1d3 | ||
|
|
43e83aa8df | ||
|
|
e6767de381 | ||
|
|
3fdaeaed48 | ||
|
|
46e8e2d093 | ||
|
|
7a62a6f245 | ||
|
|
58b7ca02dd | ||
|
|
b182c161b0 | ||
|
|
dd930a0530 | ||
|
|
cb25248c3f | ||
|
|
8043f0b373 | ||
|
|
d5c30504ac | ||
|
|
9e5fa1c972 | ||
|
|
087210ce5c | ||
|
|
ee807ecdc8 | ||
|
|
76c81bff41 | ||
|
|
5a2a217622 | ||
|
|
6e9407ef79 | ||
|
|
652dfe00a2 | ||
|
|
7f91449b94 | ||
|
|
84363d2734 | ||
|
|
9d420b16d4 | ||
|
|
cb8367c67a | ||
|
|
ab321735e8 | ||
|
|
aefed52167 | ||
|
|
9a188d8b8a | ||
|
|
e76ab469ca | ||
|
|
3bfefe621d | ||
|
|
2440831a07 | ||
|
|
26ffec7f49 | ||
|
|
c5d08ec384 | ||
|
|
e4da80768a | ||
|
|
82a500a99b | ||
|
|
9522e9e22e | ||
|
|
b8b6cfcd81 | ||
|
|
4cd0065434 | ||
|
|
f1c3a17fa8 | ||
|
|
58dcfb0ea1 | ||
|
|
b1156e2163 | ||
|
|
0300be76ce | ||
|
|
262d045890 | ||
|
|
f7af661eda | ||
|
|
3638a97abf | ||
|
|
c8567cfede | ||
|
|
8d2c3bc81b | ||
|
|
a39f16486e | ||
|
|
d4be0af140 | ||
|
|
c78f82dd05 | ||
|
|
919293cab2 | ||
|
|
b5bf49af28 | ||
|
|
9b50ec6a5b | ||
|
|
5d542e783b | ||
|
|
a6fe149b7a | ||
|
|
3897393a94 | ||
|
|
eafe4bf00d | ||
|
|
a61b69bd79 | ||
|
|
d516ec5004 | ||
|
|
d2c79c26d0 | ||
|
|
47e7daee7d | ||
|
|
b291a9f5a5 | ||
|
|
deb2fdbb90 | ||
|
|
6226f79562 | ||
|
|
e7e1b9118e | ||
|
|
ee627567f2 | ||
|
|
34ef0ebe93 | ||
|
|
46e1bd322c | ||
|
|
41d5b6e409 | ||
|
|
fff35dc404 | ||
|
|
c3ed579118 | ||
|
|
9a27ebc627 | ||
|
|
e476537d89 | ||
|
|
1f37f0bfce | ||
|
|
988c245f76 | ||
|
|
d0e2af2ee7 | ||
|
|
374566a294 | ||
|
|
7fff4289e3 | ||
|
|
70c9bcb8bc | ||
|
|
61bcdc2caa | ||
|
|
951713990f | ||
|
|
c229af0f71 | ||
|
|
f862b2a5ae | ||
|
|
ed3a943777 | ||
|
|
2b459949bb | ||
|
|
bdf60c1304 | ||
|
|
b22c3f79fa | ||
|
|
ad21a2febb | ||
|
|
f08e17b23f | ||
|
|
c7eed7504d | ||
|
|
f96a017bc7 | ||
|
|
ec40c08234 | ||
|
|
ed26cf7449 | ||
|
|
295095e2b0 | ||
|
|
b19c4c2883 | ||
|
|
2edaa4d7cb | ||
|
|
8eb6b3ff9e | ||
|
|
53b731a4eb | ||
|
|
8f12925523 | ||
|
|
360bd90d0f | ||
|
|
c9d75c5d52 | ||
|
|
97543c8bbd | ||
|
|
84953b98b9 | ||
|
|
bae4ed7e62 | ||
|
|
ca0b04c733 | ||
|
|
d1407db11d | ||
|
|
8097a4f41c | ||
|
|
2f16cf461a | ||
|
|
407a33db94 | ||
|
|
6605ecc2ac | ||
|
|
7ad5c7f3c2 | ||
|
|
fb41f345fa | ||
|
|
41f9574600 | ||
|
|
4f08ade4e2 | ||
|
|
fd05664b04 | ||
|
|
c569ae0bf0 | ||
|
|
1963853702 | ||
|
|
621e5b1747 | ||
|
|
bca2359c65 | ||
|
|
dabea0e2ab | ||
|
|
4016d60a4c | ||
|
|
0e0a7e48a6 | ||
|
|
99b30ba0cc | ||
|
|
5e4798bbab | ||
|
|
ec35a40898 | ||
|
|
4646c2ef34 | ||
|
|
b2c5bcb279 | ||
|
|
ae98d5f2d3 | ||
|
|
9b65c9429e | ||
|
|
bd1bb90bb0 | ||
|
|
2da60e2b54 | ||
|
|
4afbac8e59 | ||
|
|
a5bd5bf099 | ||
|
|
8cac4b62d9 | ||
|
|
34b05078c4 | ||
|
|
6a777f0b86 | ||
|
|
b0c03c4449 | ||
|
|
b0a3645610 | ||
|
|
84e492a1e8 | ||
|
|
d4008485e3 | ||
|
|
194720b817 | ||
|
|
8a7119fa2f | ||
|
|
f52494f466 | ||
|
|
7aa1eefb79 | ||
|
|
13488ae71e | ||
|
|
6588eb752a | ||
|
|
11fa96a4e7 | ||
|
|
4d598154ca | ||
|
|
4687df5154 | ||
|
|
3d9effde77 | ||
|
|
0c2fd3e928 | ||
|
|
5630152954 | ||
|
|
1bc700a041 | ||
|
|
ce79902c62 | ||
|
|
ca623db33b | ||
|
|
3edba6d5a7 | ||
|
|
d1893931ed | ||
|
|
d0da5022ef | ||
|
|
be66661fe9 | ||
|
|
44551d28fd | ||
|
|
6ea540f7c7 | ||
|
|
5fe93ed9ac | ||
|
|
5427d4cae0 | ||
|
|
0a90acac6d | ||
|
|
e20785fc1e | ||
|
|
3a234769af | ||
|
|
bfa747571f | ||
|
|
32f0d8c23a | ||
|
|
2005b700c1 | ||
|
|
5beeee9fa7 | ||
|
|
ca5a2b4958 | ||
|
|
5c1b83fb1e | ||
|
|
d5ff73eb3c | ||
|
|
06bc5d193e | ||
|
|
bd65d611dd | ||
|
|
fa8fadd8cc | ||
|
|
dfd8330e50 | ||
|
|
246d511246 | ||
|
|
fa1bed5497 | ||
|
|
1b8dd20871 | ||
|
|
dc0762a753 | ||
|
|
670bad910d | ||
|
|
965590d383 | ||
|
|
ddc3b8050e | ||
|
|
a0ad9a9182 | ||
|
|
b586cba1b0 | ||
|
|
4cd72abd34 | ||
|
|
3f4cbf0377 | ||
|
|
b828537c4d | ||
|
|
678f09b925 | ||
|
|
f06a5b3eb8 | ||
|
|
477467abaa | ||
|
|
a4395aba8a | ||
|
|
75583b4cc4 | ||
|
|
a0525f2d6b | ||
|
|
f55028c696 | ||
|
|
ce636ef1ec | ||
|
|
88d51424b9 | ||
|
|
4896105caf | ||
|
|
e18657267d | ||
|
|
fc552de5b5 | ||
|
|
f0c6196710 | ||
|
|
81b5e2f867 | ||
|
|
b9e398cd4b | ||
|
|
fea271f21e | ||
|
|
9f42f0977e | ||
|
|
2acd911f1a | ||
|
|
bcb0678984 | ||
|
|
811eb68146 | ||
|
|
97de048b7f | ||
|
|
1dc522c559 | ||
|
|
3c0747a0a3 | ||
|
|
17eb8faee1 | ||
|
|
a08fda26f5 | ||
|
|
3ddbfdff33 | ||
|
|
b1dfffbc2a | ||
|
|
c6323411e1 | ||
|
|
55f1bfea82 | ||
|
|
208c2a6eec | ||
|
|
1dc80701fe | ||
|
|
628593a879 | ||
|
|
752b788327 | ||
|
|
910638fa11 | ||
|
|
f1db5927e2 | ||
|
|
0d68ca00ac | ||
|
|
7668dd7814 | ||
|
|
38593077e9 | ||
|
|
47b93c6228 | ||
|
|
22152cee0f | ||
|
|
7c1cc7980b | ||
|
|
dfffc2ffc7 | ||
|
|
be1bae5243 | ||
|
|
94665d9c19 | ||
|
|
ba98d8e13e | ||
|
|
62499069a2 | ||
|
|
1d6bd6979a | ||
|
|
7314433047 | ||
|
|
0dec1e970c | ||
|
|
b941473d61 | ||
|
|
a342eac188 | ||
|
|
31de77081c | ||
|
|
943a081c61 | ||
|
|
08e0105ab2 | ||
|
|
016c84ee80 | ||
|
|
ac38fe2513 | ||
|
|
2e66c57e0c | ||
|
|
0bbc4aeb6c | ||
|
|
a7f2f3e5bb | ||
|
|
6a6e02a46b | ||
|
|
a830a1e650 | ||
|
|
b4e40f2045 | ||
|
|
35ff958aec | ||
|
|
97c90054da | ||
|
|
38bd9acd52 | ||
|
|
1423984428 | ||
|
|
4b9cba542b | ||
|
|
7f780a37a5 | ||
|
|
d8c54b3aaf | ||
|
|
0a8974c7cd | ||
|
|
6034b51816 | ||
|
|
136ce46020 | ||
|
|
72ccf2c243 | ||
|
|
4ee703f9b4 | ||
|
|
d0e55bb674 | ||
|
|
bcc7de6fd6 | ||
|
|
153f59cda7 | ||
|
|
06f158ac3e | ||
|
|
69a2ee32a1 | ||
|
|
06d9c0115c | ||
|
|
bfb58f3b4e | ||
|
|
e691b4429b | ||
|
|
bd3aa8c06e | ||
|
|
bafe1745c5 | ||
|
|
40ce9c1d94 | ||
|
|
228e893904 | ||
|
|
5e38a6ff43 | ||
|
|
0d992f0999 | ||
|
|
9cbdedff8e | ||
|
|
9c0bdbd6be | ||
|
|
eaec09fd09 | ||
|
|
9453e9b1aa | ||
|
|
dfca80c273 | ||
|
|
92b39b9539 | ||
|
|
0f70052aa3 | ||
|
|
7705d1220e | ||
|
|
7ac9bde7ff | ||
|
|
1237143a38 | ||
|
|
fd682df811 | ||
|
|
0afb7b1758 | ||
|
|
f6e00c3922 | ||
|
|
e919e0028e | ||
|
|
f541f84db1 | ||
|
|
4e66c8c1c8 | ||
|
|
02e2f89308 | ||
|
|
d282feb11d | ||
|
|
deefbcffb3 | ||
|
|
bbd2673d42 | ||
|
|
833c2cfd5d | ||
|
|
0cd6e321f1 | ||
|
|
fde16498ad | ||
|
|
19183aabc8 | ||
|
|
691706ef57 | ||
|
|
182e68126e | ||
|
|
5c6c1fd1cd | ||
|
|
b06aab0b3c | ||
|
|
ff20480866 | ||
|
|
db9e21023c | ||
|
|
4cd6758a4b | ||
|
|
fe322f0f58 | ||
|
|
7649454e46 | ||
|
|
2d7ca921d4 | ||
|
|
07967f5009 | ||
|
|
e17a1eefb5 | ||
|
|
7139c44dba | ||
|
|
c3def58a86 | ||
|
|
49d461b30c | ||
|
|
37ccf88d01 | ||
|
|
b6ba2e0ceb | ||
|
|
01b998de21 | ||
|
|
aeac0c85ad | ||
|
|
c02d1c0bbb | ||
|
|
714cf9990b | ||
|
|
40585be161 | ||
|
|
e4ee71e3aa | ||
|
|
a524cfd8a5 | ||
|
|
e5ac777d1f | ||
|
|
6752df9a9e | ||
|
|
c5ee4b9f8e | ||
|
|
0c9665f21c | ||
|
|
4eff4f531e | ||
|
|
8a1836039c | ||
|
|
b754491070 | ||
|
|
322468adb9 | ||
|
|
f585adb8b7 | ||
|
|
32d9c79467 | ||
|
|
30184e5502 | ||
|
|
52acc7bd34 | ||
|
|
4430b4eb37 | ||
|
|
87298253d2 | ||
|
|
0c41791956 | ||
|
|
1898185020 | ||
|
|
57c876c27a | ||
|
|
356308b4ea | ||
|
|
1a80a502d3 | ||
|
|
b400f0a1a7 | ||
|
|
b26c0b526c | ||
|
|
6246a78478 | ||
|
|
edb60cf6cd | ||
|
|
b85b41e65d | ||
|
|
70e48af3ab | ||
|
|
175cf3a4f4 | ||
|
|
b4a8815af3 | ||
|
|
b12bb21d64 | ||
|
|
f81cd4018f | ||
|
|
11c9696320 | ||
|
|
f3f42c7c14 | ||
|
|
242631375f | ||
|
|
c0bf39885e | ||
|
|
ae123fadc7 | ||
|
|
dcea9c36b7 | ||
|
|
daeae0edba | ||
|
|
802ac54fdc | ||
|
|
e1c497beab | ||
|
|
c40a774db8 | ||
|
|
2f047f8efb | ||
|
|
8ca2e8128d | ||
|
|
aef329e702 | ||
|
|
2a83979a5b | ||
|
|
191646cc73 | ||
|
|
cd2640e9c6 | ||
|
|
e48ed8f595 | ||
|
|
8054829fcc | ||
|
|
9ff2d32370 | ||
|
|
1926d23b44 | ||
|
|
f002777772 | ||
|
|
c1042cfa51 | ||
|
|
a836d35ee1 | ||
|
|
a43bcf23af | ||
|
|
0253fc426d | ||
|
|
27021a571d | ||
|
|
f4a34e386e | ||
|
|
8b1c6d706e | ||
|
|
e138bc1259 | ||
|
|
6147fe66e3 | ||
|
|
285ebe2795 | ||
|
|
daf5a55788 | ||
|
|
9f939c1e85 | ||
|
|
697dc4f0d3 | ||
|
|
bd6adf0ff7 | ||
|
|
9afbdcb353 | ||
|
|
ba9fb123d3 | ||
|
|
485d5bcd82 | ||
|
|
5bdfc99bc6 | ||
|
|
e3e4d6bf01 | ||
|
|
41978bb08c | ||
|
|
f0093103fa | ||
|
|
a2a1d6f5b9 | ||
|
|
e21b4d5e81 | ||
|
|
05e18be4e7 | ||
|
|
77e58cfbde | ||
|
|
a6a659904b | ||
|
|
2e8a574d88 | ||
|
|
81067ffa84 | ||
|
|
c6c676d89b | ||
|
|
57f8626d86 | ||
|
|
da67d66447 | ||
|
|
17aaaea4ab | ||
|
|
e349fbcecf | ||
|
|
2361b4a440 | ||
|
|
4ffe6063ba | ||
|
|
c36489a1d3 | ||
|
|
7b972d0084 | ||
|
|
61d9104fb2 | ||
|
|
280db0f521 | ||
|
|
bf4ba346c0 | ||
|
|
c4bbe02cdc | ||
|
|
026c442fce | ||
|
|
0d10a1c1c6 | ||
|
|
6951fea497 | ||
|
|
181ba51895 |
Binary file not shown.
@@ -0,0 +1,4 @@
|
||||
|
||||
PACKAGE ALT_CUSP_PACKAGE IS
|
||||
|
||||
END ALT_CUSP_PACKAGE;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,689 @@
|
||||
-- Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License
|
||||
-- Subscription Agreement, the Altera Quartus II License Agreement,
|
||||
-- the Altera MegaCore Function License Agreement, or other
|
||||
-- applicable license agreement, including, without limitation,
|
||||
-- that your use is for the sole purpose of programming logic
|
||||
-- devices manufactured by Altera and sold by Altera or its
|
||||
-- authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
-----------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Description: Declares utility package for Altera IP support --
|
||||
-- --
|
||||
-- --
|
||||
-- *** USER DESIGNS SHOULD NOT INCLUDE THIS PACKAGE DIRECTLY *** --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
-- ----------------------------------------------------------------------------
|
||||
--
|
||||
-- These routines are used to help SOPC Builder generate VHDL code.
|
||||
--
|
||||
-- ----------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
use IEEE.NUMERIC_STD.all;
|
||||
use IEEE.STD_LOGIC_UNSIGNED.all;
|
||||
|
||||
package altera_europa_support_lib is
|
||||
|
||||
attribute IS_SIGNED : BOOLEAN ;
|
||||
attribute SYNTHESIS_RETURN : STRING ;
|
||||
|
||||
|
||||
FUNCTION and_reduce(arg : STD_LOGIC_VECTOR) RETURN STD_LOGIC;
|
||||
-- Result subtype: STD_LOGIC.
|
||||
-- Result: Result of and'ing all of the bits of the vector.
|
||||
|
||||
FUNCTION nand_reduce(arg : STD_LOGIC_VECTOR) RETURN STD_LOGIC;
|
||||
-- Result subtype: STD_LOGIC.
|
||||
-- Result: Result of nand'ing all of the bits of the vector.
|
||||
|
||||
FUNCTION or_reduce(arg : STD_LOGIC_VECTOR) RETURN STD_LOGIC;
|
||||
-- Result subtype: STD_LOGIC.
|
||||
-- Result: Result of or'ing all of the bits of the vector.
|
||||
|
||||
FUNCTION nor_reduce(arg : STD_LOGIC_VECTOR) RETURN STD_LOGIC;
|
||||
-- Result subtype: STD_LOGIC.
|
||||
-- Result: Result of nor'ing all of the bits of the vector.
|
||||
|
||||
FUNCTION xor_reduce(arg : STD_LOGIC_VECTOR) RETURN STD_LOGIC;
|
||||
-- Result subtype: STD_LOGIC.
|
||||
-- Result: Result of xor'ing all of the bits of the vector.
|
||||
|
||||
FUNCTION xnor_reduce(arg : STD_LOGIC_VECTOR) RETURN STD_LOGIC;
|
||||
-- Result subtype: STD_LOGIC.
|
||||
-- Result: Result of xnor'ing all of the bits of the vector.
|
||||
|
||||
FUNCTION A_SRL(arg: std_logic_vector; shift: integer) RETURN std_logic_vector;
|
||||
FUNCTION A_SLL(arg: std_logic_vector; shift: integer) RETURN std_logic_vector;
|
||||
|
||||
FUNCTION A_SRL(arg: std_logic_vector; shift: std_logic_vector) RETURN std_logic_vector;
|
||||
FUNCTION A_SLL(arg: std_logic_vector; shift: std_logic_vector) RETURN std_logic_vector;
|
||||
|
||||
FUNCTION A_TOSTDLOGICVECTOR(a: std_logic) RETURN std_logic_vector;
|
||||
FUNCTION A_TOSTDLOGICVECTOR(a: std_logic_vector) RETURN std_logic_vector;
|
||||
|
||||
FUNCTION A_WE_StdLogic (select_arg: boolean; then_arg: STD_LOGIC ; else_arg:STD_LOGIC) RETURN STD_LOGIC;
|
||||
FUNCTION A_WE_StdUlogic (select_arg: boolean; then_arg: STD_ULOGIC; else_arg:STD_ULOGIC) RETURN STD_ULOGIC;
|
||||
FUNCTION A_WE_StdLogicVector(select_arg: boolean; then_arg: STD_LOGIC_VECTOR; else_arg:STD_LOGIC_VECTOR) RETURN STD_LOGIC_VECTOR;
|
||||
FUNCTION A_WE_StdUlogicVector(select_arg: boolean; then_arg: STD_ULOGIC_VECTOR; else_arg:STD_ULOGIC_VECTOR) RETURN STD_ULOGIC_VECTOR;
|
||||
|
||||
FUNCTION Vector_To_Std_Logic(vector: STD_LOGIC_VECTOR) return Std_Logic;
|
||||
|
||||
function TO_STD_LOGIC(arg : BOOLEAN) return STD_LOGIC;
|
||||
-- Result subtype: STD_LOGIC
|
||||
-- Result: Converts a BOOLEAN to a STD_LOGIC..
|
||||
|
||||
FUNCTION a_rep(arg : STD_LOGIC; repeat : INTEGER) RETURN STD_LOGIC_VECTOR ;
|
||||
FUNCTION a_rep_vector(arg : STD_LOGIC_VECTOR; repeat : INTEGER) RETURN STD_LOGIC_VECTOR ;
|
||||
function a_min(L, R: INTEGER) return INTEGER ;
|
||||
function a_max(L, R: INTEGER) return INTEGER ;
|
||||
FUNCTION a_ext (arg : STD_LOGIC_VECTOR; size : INTEGER) RETURN STD_LOGIC_VECTOR ;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Conversions for Verilog $display/$write emulation --
|
||||
-------------------------------------------------------
|
||||
|
||||
-- All required padding is to the left of the value (right justified) to
|
||||
-- a string that can hold the maximum value of the vector in that radix.
|
||||
-- When displaying decimal values (e.g. %d), padding is spaces.
|
||||
-- When displaying other radices (e.g. %h), padding is zeros.
|
||||
-- There is no padding when a zero is placed after the % (e.g. %0d or %0h).
|
||||
|
||||
type pad_type is (pad_none, pad_spaces, pad_zeros);
|
||||
|
||||
function to_hex_string(val : std_logic_vector;
|
||||
pad : pad_type := pad_zeros) return string;
|
||||
|
||||
function to_decimal_string(val : integer;
|
||||
pad : pad_type := pad_spaces) return string;
|
||||
|
||||
function to_decimal_string(val : std_logic_vector;
|
||||
pad : pad_type := pad_spaces) return string;
|
||||
|
||||
function to_octal_string(val : std_logic_vector;
|
||||
pad : pad_type := pad_zeros) return string;
|
||||
|
||||
function to_binary_string(val : std_logic_vector;
|
||||
pad : pad_type := pad_zeros) return string;
|
||||
|
||||
function to_hex_string(val : std_logic;
|
||||
pad : pad_type := pad_zeros) return string;
|
||||
|
||||
function to_decimal_string(val : std_logic;
|
||||
pad : pad_type := pad_spaces) return string;
|
||||
|
||||
function to_octal_string(val : std_logic;
|
||||
pad : pad_type := pad_zeros) return string;
|
||||
|
||||
function to_binary_string(val : std_logic;
|
||||
pad : pad_type := pad_zeros) return string;
|
||||
|
||||
end altera_europa_support_lib;
|
||||
|
||||
package body altera_europa_support_lib is
|
||||
|
||||
--
|
||||
-- Reducing logical functions.
|
||||
--
|
||||
|
||||
FUNCTION and_reduce(arg: STD_LOGIC_VECTOR) RETURN STD_LOGIC IS
|
||||
VARIABLE result: STD_LOGIC;
|
||||
-- Exemplar synthesis directive attributes for this function
|
||||
ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_AND" ;
|
||||
BEGIN
|
||||
result := '1';
|
||||
FOR i IN arg'RANGE LOOP
|
||||
result := result AND arg(i);
|
||||
END LOOP;
|
||||
RETURN result;
|
||||
END;
|
||||
|
||||
FUNCTION nand_reduce(arg: STD_LOGIC_VECTOR) RETURN STD_LOGIC IS
|
||||
VARIABLE result: STD_LOGIC;
|
||||
ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_NAND" ;
|
||||
BEGIN
|
||||
result := NOT and_reduce(arg);
|
||||
RETURN result;
|
||||
END;
|
||||
|
||||
FUNCTION or_reduce(arg: STD_LOGIC_VECTOR) RETURN STD_LOGIC IS
|
||||
VARIABLE result: STD_LOGIC;
|
||||
-- Exemplar synthesis directive attributes for this function
|
||||
ATTRIBUTE synthesis_return OF result:VARIABLE IS "REDUCE_OR" ;
|
||||
BEGIN
|
||||
result := '0';
|
||||
FOR i IN arg'RANGE LOOP
|
||||
result := result OR arg(i);
|
||||
END LOOP;
|
||||
RETURN result;
|
||||
END;
|
||||
|
||||
FUNCTION nor_reduce(arg: STD_LOGIC_VECTOR) RETURN STD_LOGIC IS
|
||||
VARIABLE result: STD_LOGIC;
|
||||
ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_NOR" ;
|
||||
BEGIN
|
||||
result := NOT or_reduce(arg);
|
||||
RETURN result;
|
||||
END;
|
||||
|
||||
FUNCTION xor_reduce(arg: STD_LOGIC_VECTOR) RETURN STD_LOGIC IS
|
||||
VARIABLE result: STD_LOGIC;
|
||||
-- Exemplar synthesis directive attributes for this function
|
||||
ATTRIBUTE synthesis_return OF result:VARIABLE IS "REDUCE_XOR" ;
|
||||
BEGIN
|
||||
result := '0';
|
||||
FOR i IN arg'RANGE LOOP
|
||||
result := result XOR arg(i);
|
||||
END LOOP;
|
||||
RETURN result;
|
||||
END;
|
||||
|
||||
FUNCTION xnor_reduce(arg: STD_LOGIC_VECTOR) RETURN STD_LOGIC IS
|
||||
VARIABLE result: STD_LOGIC;
|
||||
ATTRIBUTE synthesis_RETURN OF result:VARIABLE IS "REDUCE_XNOR" ;
|
||||
BEGIN
|
||||
result := NOT xor_reduce(arg);
|
||||
RETURN result;
|
||||
END;
|
||||
|
||||
function TO_STD_LOGIC(arg : BOOLEAN) return STD_LOGIC is
|
||||
begin
|
||||
if(arg = true) then
|
||||
return('1');
|
||||
else
|
||||
return('0');
|
||||
end if;
|
||||
end;
|
||||
|
||||
FUNCTION A_SRL(arg : STD_LOGIC_VECTOR; shift : STD_LOGIC_VECTOR) RETURN STD_LOGIC_VECTOR IS
|
||||
BEGIN
|
||||
RETURN(A_SRL(arg,conv_integer(shift)));
|
||||
END;
|
||||
|
||||
FUNCTION A_SLL(arg : STD_LOGIC_VECTOR; shift : STD_LOGIC_VECTOR) RETURN STD_LOGIC_VECTOR IS
|
||||
BEGIN
|
||||
RETURN(A_SLL(arg,conv_integer(shift)));
|
||||
END;
|
||||
|
||||
FUNCTION A_SRL(arg : STD_LOGIC_VECTOR; shift : INTEGER) RETURN STD_LOGIC_VECTOR IS
|
||||
VARIABLE result : STD_LOGIC_VECTOR(arg'LEFT DOWNTO 0) := (arg'RANGE => '0');
|
||||
BEGIN
|
||||
IF ((shift <= arg'LEFT) AND (shift >= 0)) THEN
|
||||
IF (shift = 0) THEN
|
||||
result := arg;
|
||||
ELSE
|
||||
result(arg'LEFT - shift DOWNTO 0) := arg(arg'LEFT DOWNTO shift);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
RETURN(result);
|
||||
END;
|
||||
|
||||
FUNCTION A_SLL(arg : STD_LOGIC_VECTOR; shift : INTEGER) RETURN STD_LOGIC_VECTOR IS
|
||||
VARIABLE result : STD_LOGIC_VECTOR(arg'LEFT DOWNTO 0) := (arg'RANGE => '0');
|
||||
BEGIN
|
||||
IF ((shift <= arg'LEFT) AND (shift >= 0)) THEN
|
||||
IF (shift = 0) THEN
|
||||
result := arg;
|
||||
ELSE
|
||||
result(arg'LEFT DOWNTO shift) := arg(arg'LEFT - shift DOWNTO 0);
|
||||
END IF;
|
||||
END IF;
|
||||
|
||||
RETURN(result);
|
||||
END;
|
||||
|
||||
|
||||
|
||||
FUNCTION A_TOSTDLOGICVECTOR(a: std_logic) RETURN std_logic_vector IS
|
||||
BEGIN
|
||||
IF a = '1' THEN
|
||||
return "1";
|
||||
ELSE
|
||||
return "0";
|
||||
END IF;
|
||||
END;
|
||||
|
||||
FUNCTION A_TOSTDLOGICVECTOR(a: std_logic_vector) RETURN std_logic_vector IS
|
||||
BEGIN
|
||||
return a;
|
||||
END;
|
||||
|
||||
FUNCTION A_WE_StdLogic (select_arg: boolean; then_arg: STD_LOGIC ; else_arg:STD_LOGIC) RETURN STD_LOGIC IS
|
||||
BEGIN
|
||||
IF (select_arg) THEN
|
||||
return (then_arg);
|
||||
ELSE
|
||||
return (else_arg);
|
||||
END IF;
|
||||
END;
|
||||
|
||||
FUNCTION A_WE_StdUlogic (select_arg: boolean; then_arg: STD_ULOGIC; else_arg:STD_ULOGIC) RETURN STD_ULOGIC IS
|
||||
BEGIN
|
||||
IF (select_arg) THEN
|
||||
return (then_arg);
|
||||
ELSE
|
||||
return (else_arg);
|
||||
END IF;
|
||||
END;
|
||||
|
||||
FUNCTION A_WE_StdLogicVector(select_arg: boolean; then_arg: STD_LOGIC_VECTOR; else_arg:STD_LOGIC_VECTOR) RETURN STD_LOGIC_VECTOR IS
|
||||
BEGIN
|
||||
IF (select_arg) THEN
|
||||
return (then_arg);
|
||||
ELSE
|
||||
return (else_arg);
|
||||
END IF;
|
||||
END;
|
||||
|
||||
FUNCTION A_WE_StdUlogicVector(select_arg: boolean; then_arg: STD_ULOGIC_VECTOR; else_arg:STD_ULOGIC_VECTOR) RETURN STD_ULOGIC_VECTOR IS
|
||||
BEGIN
|
||||
IF (select_arg) THEN
|
||||
return (then_arg);
|
||||
ELSE
|
||||
return (else_arg);
|
||||
END IF;
|
||||
END;
|
||||
|
||||
FUNCTION Vector_To_Std_Logic(vector: STD_LOGIC_VECTOR)
|
||||
return Std_Logic IS
|
||||
BEGIN
|
||||
return (vector(vector'right));
|
||||
END;
|
||||
|
||||
|
||||
FUNCTION a_rep(arg : STD_LOGIC; repeat : INTEGER) RETURN STD_LOGIC_VECTOR IS
|
||||
VARIABLE result : STD_LOGIC_VECTOR(repeat-1 DOWNTO 0) := (others => '0');
|
||||
VARIABLE i : integer := 0;
|
||||
BEGIN
|
||||
FOR i IN 0 TO (repeat-1) LOOP
|
||||
result(i) := arg;
|
||||
end LOOP;
|
||||
|
||||
RETURN(result);
|
||||
END;
|
||||
|
||||
FUNCTION a_rep_vector(arg : STD_LOGIC_VECTOR; repeat : INTEGER) RETURN STD_LOGIC_VECTOR IS
|
||||
VARIABLE arg_copy : STD_LOGIC_VECTOR ((arg'length - 1)DOWNTO 0) := arg ;
|
||||
VARIABLE result : STD_LOGIC_VECTOR(((repeat * (arg_copy'LEFT+1))-1) DOWNTO 0) := (others => '0');
|
||||
VARIABLE i : integer := 0;
|
||||
BEGIN
|
||||
FOR i IN 0 TO (repeat-1) LOOP
|
||||
result((((arg_copy'left + 1) * i) + arg_copy'left) downto ((arg_copy'left + 1) * i)) := arg_copy(arg_copy'LEFT DOWNTO 0);
|
||||
end LOOP;
|
||||
|
||||
RETURN(result);
|
||||
END;
|
||||
|
||||
-- a_min : return the minimum of two integers;
|
||||
function a_min(L, R: INTEGER) return INTEGER is
|
||||
begin
|
||||
if L < R then
|
||||
return L;
|
||||
else
|
||||
return R;
|
||||
end if;
|
||||
end;
|
||||
|
||||
-- a_max : return the minimum of two integers;
|
||||
function a_max(L, R: INTEGER) return INTEGER is
|
||||
begin
|
||||
if L > R then
|
||||
return L;
|
||||
else
|
||||
return R;
|
||||
end if;
|
||||
end;
|
||||
|
||||
-- a_ext is the Altera version of the EXT function. It is used to both
|
||||
-- zero-extend a signal to a new length, and to extract a signal of 'size'
|
||||
-- length from a larger signal.
|
||||
FUNCTION a_ext (arg : STD_LOGIC_VECTOR; size : INTEGER) RETURN STD_LOGIC_VECTOR IS
|
||||
VARIABLE arg_copy : STD_LOGIC_VECTOR ((arg'length - 1)DOWNTO 0) := arg ;
|
||||
VARIABLE result : STD_LOGIC_VECTOR((size-1) DOWNTO 0) := (others => '0');
|
||||
VARIABLE i : integer := 0;
|
||||
VARIABLE bits_to_copy : integer := 0;
|
||||
VARIABLE arg_length : integer := arg'length ;
|
||||
VARIABLE LSB_bit : integer := 0;
|
||||
BEGIN
|
||||
bits_to_copy := a_min(arg_length, size);
|
||||
FOR i IN 0 TO (bits_to_copy - 1) LOOP
|
||||
result(i) := arg_copy(i);
|
||||
end LOOP;
|
||||
|
||||
RETURN(result);
|
||||
END;
|
||||
|
||||
-------------------------------------------------------
|
||||
-- Conversions for Verilog $display/$write emulation --
|
||||
-------------------------------------------------------
|
||||
|
||||
subtype slv4 is std_logic_vector(1 to 4);
|
||||
subtype slv3 is std_logic_vector(1 to 3);
|
||||
|
||||
-- Remove leading zeros. Also changes strings of all 'x' or 'z' to one char.
|
||||
-- This handles the %0<radix> kind of Verilog syntax in the format string.
|
||||
-- Examples:
|
||||
-- input output
|
||||
-- ----- -----------
|
||||
-- 001f 1f
|
||||
-- 0000 0
|
||||
-- xxxx x
|
||||
-- zzzz z
|
||||
-- xxzz xxzz
|
||||
|
||||
function do_pad_none(
|
||||
str_in : string) return string is
|
||||
variable start : integer;
|
||||
variable all_x : boolean := true;
|
||||
variable all_z : boolean := true;
|
||||
begin
|
||||
-- Nothing to remove if string isn't at least two characters long.
|
||||
if (str_in'length < 2) then
|
||||
return str_in;
|
||||
end if;
|
||||
|
||||
for i in str_in'range loop
|
||||
case str_in(i) is
|
||||
when 'X' | 'x' => all_z := false;
|
||||
when 'Z' | 'z' => all_x := false;
|
||||
when others => all_x := false; all_z := false;
|
||||
end case;
|
||||
end loop;
|
||||
|
||||
if (all_x or all_z) then
|
||||
return str_in(str_in'left to str_in'left);
|
||||
end if;
|
||||
|
||||
-- Find index of first non-zero character.
|
||||
for i in str_in'range loop
|
||||
start := i;
|
||||
exit when (str_in(i) /= '0');
|
||||
end loop;
|
||||
|
||||
return str_in(start to str_in'right);
|
||||
end do_pad_none;
|
||||
|
||||
-- Replace leading zeros with spaces.
|
||||
-- This handles the %d kind of Verilog syntax in the format string.
|
||||
function replace_leading_zeros(
|
||||
str_in : string;
|
||||
c : character) return string is
|
||||
variable str_out : string(str_in'range) := str_in;
|
||||
begin
|
||||
-- Nothing to replace if string isn't at least two characters long.
|
||||
if (str_in'length < 2) then
|
||||
return str_in;
|
||||
end if;
|
||||
|
||||
for i in str_in'range loop
|
||||
if (str_in(i) = '0') then
|
||||
str_out(i) := c;
|
||||
else
|
||||
exit;
|
||||
end if;
|
||||
end loop;
|
||||
|
||||
return str_out;
|
||||
end replace_leading_zeros;
|
||||
|
||||
function do_pad(
|
||||
str : string;
|
||||
pad : pad_type) return string is
|
||||
begin
|
||||
case pad is
|
||||
when pad_none => return do_pad_none(str);
|
||||
when pad_spaces => return replace_leading_zeros(str, ' ');
|
||||
when pad_zeros => return str;
|
||||
end case;
|
||||
end do_pad;
|
||||
|
||||
function round_up_to_multiple(
|
||||
val : integer;
|
||||
size : integer) return integer is
|
||||
begin
|
||||
return ((val + size - 1) / size) * size;
|
||||
end round_up_to_multiple;
|
||||
|
||||
function to_hex_string(
|
||||
val : std_logic_vector;
|
||||
pad : pad_type := pad_zeros) return string is
|
||||
variable ext_len : integer := round_up_to_multiple(val'length,4);
|
||||
variable val_ext : std_logic_vector(1 to ext_len) := (others => '0');
|
||||
variable ptr : integer range 1 to (ext_len/4)+1 := 1;
|
||||
variable str : string(1 to ext_len/4) := (others=>'0');
|
||||
variable found_x : boolean := false;
|
||||
variable found_z : boolean := false;
|
||||
begin
|
||||
val_ext(ext_len-val'length+1 to ext_len) := val;
|
||||
|
||||
-- Extend MSB to extended sulv unless it starts with one (unsigned).
|
||||
-- Done to extend 'x' and 'z'.
|
||||
if ext_len-val'length > 0 and val(val'left) /= '1' then
|
||||
val_ext(1 to ext_len-val'length) := (others => val(val'left));
|
||||
end if;
|
||||
|
||||
for i in val_ext'range loop
|
||||
next when i rem 4 /= 1;
|
||||
|
||||
case slv4(to_x01z(val_ext(i to i+3))) is
|
||||
when "0000" => str(ptr) := '0';
|
||||
when "0001" => str(ptr) := '1';
|
||||
when "0010" => str(ptr) := '2';
|
||||
when "0011" => str(ptr) := '3';
|
||||
when "0100" => str(ptr) := '4';
|
||||
when "0101" => str(ptr) := '5';
|
||||
when "0110" => str(ptr) := '6';
|
||||
when "0111" => str(ptr) := '7';
|
||||
when "1000" => str(ptr) := '8';
|
||||
when "1001" => str(ptr) := '9';
|
||||
when "1010" => str(ptr) := 'a';
|
||||
when "1011" => str(ptr) := 'b';
|
||||
when "1100" => str(ptr) := 'c';
|
||||
when "1101" => str(ptr) := 'd';
|
||||
when "1110" => str(ptr) := 'e';
|
||||
when "1111" => str(ptr) := 'f';
|
||||
when "XXXX" => str(ptr) := 'x';
|
||||
when "ZZZZ" => str(ptr) := 'z';
|
||||
when others =>
|
||||
for j in 0 to 3 loop
|
||||
case val_ext(i + j) is
|
||||
when 'X' => found_x := true;
|
||||
when 'Z' => found_z := true;
|
||||
when others => null;
|
||||
end case;
|
||||
end loop;
|
||||
|
||||
if found_x then
|
||||
str(ptr) := 'X';
|
||||
elsif found_z then
|
||||
str(ptr) := 'Z';
|
||||
else
|
||||
str(ptr) := 'X';
|
||||
end if;
|
||||
end case;
|
||||
ptr := ptr + 1;
|
||||
end loop;
|
||||
return do_pad(str, pad);
|
||||
end to_hex_string;
|
||||
|
||||
function to_decimal_string(
|
||||
val : integer;
|
||||
pad : pad_type := pad_spaces) return string is
|
||||
variable tmp : integer := val;
|
||||
variable ptr : integer range 1 to 32 := 32;
|
||||
variable str : string(1 to 32) := (others=>'0');
|
||||
begin
|
||||
if val=0 then
|
||||
return do_pad("0", pad);
|
||||
else
|
||||
while tmp > 0 loop
|
||||
case tmp rem 10 is
|
||||
when 0 => str(ptr) := '0';
|
||||
when 1 => str(ptr) := '1';
|
||||
when 2 => str(ptr) := '2';
|
||||
when 3 => str(ptr) := '3';
|
||||
when 4 => str(ptr) := '4';
|
||||
when 5 => str(ptr) := '5';
|
||||
when 6 => str(ptr) := '6';
|
||||
when 7 => str(ptr) := '7';
|
||||
when 8 => str(ptr) := '8';
|
||||
when 9 => str(ptr) := '9';
|
||||
when others => null;
|
||||
end case;
|
||||
|
||||
tmp := tmp / 10;
|
||||
ptr := ptr - 1;
|
||||
end loop;
|
||||
|
||||
return do_pad(str(ptr+1 to 32), pad);
|
||||
end if;
|
||||
end to_decimal_string;
|
||||
|
||||
function to_decimal_string(
|
||||
val : std_logic_vector;
|
||||
pad : pad_type := pad_spaces) return string is
|
||||
variable all_x : boolean := true;
|
||||
variable all_z : boolean := true;
|
||||
variable some_x : boolean := false;
|
||||
variable some_z : boolean := false;
|
||||
variable fixed_str : string(1 to 1);
|
||||
begin
|
||||
for i in val'range loop
|
||||
case to_x01z(val(i)) is
|
||||
when 'X' => some_x := true; all_z := false;
|
||||
when 'Z' => some_z := true; all_x := false;
|
||||
when others => all_x := false; all_z := false;
|
||||
end case;
|
||||
end loop;
|
||||
|
||||
if (all_x) then
|
||||
fixed_str(1) := 'x';
|
||||
return fixed_str;
|
||||
elsif (all_z) then
|
||||
fixed_str(1) := 'z';
|
||||
return fixed_str;
|
||||
elsif (some_x) then
|
||||
fixed_str(1) := 'X';
|
||||
return fixed_str;
|
||||
elsif (some_z) then
|
||||
fixed_str(1) := 'Z';
|
||||
return fixed_str;
|
||||
else
|
||||
return to_decimal_string(conv_integer(val), pad);
|
||||
end if;
|
||||
end to_decimal_string;
|
||||
|
||||
function to_octal_string(
|
||||
val : std_logic_vector;
|
||||
pad : pad_type := pad_zeros) return string is
|
||||
variable ext_len : integer := round_up_to_multiple(val'length,3);
|
||||
variable val_ext : std_logic_vector(1 to ext_len) := (others => '0');
|
||||
variable ptr : integer range 1 to (ext_len/3)+1 := 1;
|
||||
variable str : string(1 to ext_len/3) := (others=>'0');
|
||||
variable found_x : boolean := false;
|
||||
variable found_z : boolean := false;
|
||||
begin
|
||||
val_ext(ext_len-val'length+1 to ext_len) := val;
|
||||
|
||||
-- Extend MSB to extended sulv unless it starts with one (unsigned).
|
||||
-- Done to extend 'x' and 'z'.
|
||||
if ext_len-val'length > 0 and val(val'left) /= '1' then
|
||||
val_ext(1 to ext_len-val'length) := (others => val(val'left));
|
||||
end if;
|
||||
|
||||
for i in val_ext'range loop
|
||||
next when i rem 3 /= 1;
|
||||
|
||||
case slv3(to_x01z(val_ext(i to i+2))) is
|
||||
when "000" => str(ptr) := '0';
|
||||
when "001" => str(ptr) := '1';
|
||||
when "010" => str(ptr) := '2';
|
||||
when "011" => str(ptr) := '3';
|
||||
when "100" => str(ptr) := '4';
|
||||
when "101" => str(ptr) := '5';
|
||||
when "110" => str(ptr) := '6';
|
||||
when "111" => str(ptr) := '7';
|
||||
when "XXX" => str(ptr) := 'x';
|
||||
when "ZZZ" => str(ptr) := 'z';
|
||||
when others =>
|
||||
for j in 0 to 2 loop
|
||||
case val_ext(i + j) is
|
||||
when 'X' => found_x := true;
|
||||
when 'Z' => found_z := true;
|
||||
when others => null;
|
||||
end case;
|
||||
end loop;
|
||||
|
||||
if found_x then
|
||||
str(ptr) := 'X';
|
||||
elsif found_z then
|
||||
str(ptr) := 'Z';
|
||||
else
|
||||
str(ptr) := 'X';
|
||||
end if;
|
||||
end case;
|
||||
ptr := ptr + 1;
|
||||
end loop;
|
||||
return do_pad(str, pad);
|
||||
end to_octal_string;
|
||||
|
||||
function to_hex_string(
|
||||
val : std_logic;
|
||||
pad : pad_type := pad_zeros) return string is
|
||||
begin
|
||||
return to_binary_string(val, pad);
|
||||
end to_hex_string;
|
||||
|
||||
function to_decimal_string(
|
||||
val : std_logic;
|
||||
pad : pad_type := pad_spaces) return string is
|
||||
begin
|
||||
return to_binary_string(val, pad);
|
||||
end to_decimal_string;
|
||||
|
||||
function to_octal_string(
|
||||
val : std_logic;
|
||||
pad : pad_type := pad_zeros) return string is
|
||||
begin
|
||||
return to_binary_string(val, pad);
|
||||
end to_octal_string;
|
||||
|
||||
function to_binary_string(
|
||||
val : std_logic;
|
||||
pad : pad_type := pad_zeros) return string is
|
||||
variable str : string(1 to 1);
|
||||
begin
|
||||
case to_x01z(val) is
|
||||
when '0' => str(1) := '0';
|
||||
when '1' => str(1) := '1';
|
||||
when 'X' => str(1) := 'x';
|
||||
when 'Z' => str(1) := 'z';
|
||||
when others => str(1) := 'x';
|
||||
end case;
|
||||
return do_pad(str, pad);
|
||||
end to_binary_string;
|
||||
|
||||
function to_binary_string(
|
||||
val : std_logic_vector;
|
||||
pad : pad_type := pad_zeros) return string is
|
||||
variable str : string(1 to val'length) := (others=>'0');
|
||||
variable ptr : integer := str'left;
|
||||
begin
|
||||
for i in val'range loop
|
||||
str(ptr to ptr) := to_binary_string(val(i));
|
||||
ptr := ptr + 1;
|
||||
end loop;
|
||||
return do_pad(str, pad);
|
||||
end to_binary_string;
|
||||
|
||||
end altera_europa_support_lib;
|
||||
@@ -0,0 +1,40 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 2003 by Altera Corp. All rights reserved. --
|
||||
-- --
|
||||
-- --
|
||||
-- Description: Declares utility package for internal Altera synthesis --
|
||||
-- support. --
|
||||
-- --
|
||||
-- --
|
||||
-- *** USER DESIGNS SHOULD NOT INCLUDE THIS PACKAGE DIRECTLY *** --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
PACKAGE altera_internal_syn is
|
||||
|
||||
-- Specfies a built-in pragma function that should replace a user-defined
|
||||
-- subprogram during synthesis.
|
||||
ATTRIBUTE synthesis_return : STRING;
|
||||
|
||||
-- If a subprogram specifies a synthesis_return attribute, it may also
|
||||
-- use these additional attributes to fine-tune the behavior of a built-in
|
||||
-- function.
|
||||
|
||||
-- Specifies the method for calculating the size of a unary or binary
|
||||
-- built-in pragma function's result. The following values are supported:
|
||||
--
|
||||
-- LEFT: Use the size of the left operand
|
||||
-- RIGHT: Use the size of the right operand
|
||||
-- MAX_LEFT_RIGHT: Use the maximum of the left and right operands
|
||||
ATTRIBUTE synthesis_result_size : STRING;
|
||||
|
||||
-- Flag that indicates if a type or an argument/result of a built-in pragma
|
||||
-- function is signed (TRUE) or unsigned (FALSE).
|
||||
ATTRIBUTE is_signed : BOOLEAN;
|
||||
|
||||
-- Flag that indicates if truncation should preserve the sign bit
|
||||
attribute signed_truncation : BOOLEAN;
|
||||
|
||||
END altera_internal_syn;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,435 @@
|
||||
-- Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License
|
||||
-- Subscription Agreement, the Altera Quartus II License Agreement,
|
||||
-- the Altera MegaCore Function License Agreement, or other
|
||||
-- applicable license agreement, including, without limitation,
|
||||
-- that your use is for the sole purpose of programming logic
|
||||
-- devices manufactured by Altera and sold by Altera or its
|
||||
-- authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
-- ALtera Primitives Component Declaration File
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.std_logic_1164.all;
|
||||
use IEEE.VITAL_Timing.all;
|
||||
use IEEE.VITAL_Primitives.all;
|
||||
|
||||
package dffeas_pack is
|
||||
|
||||
-- default generic values
|
||||
CONSTANT DefWireDelay : VitalDelayType01 := (0 ns, 0 ns);
|
||||
CONSTANT DefPropDelay01 : VitalDelayType01 := (0 ns, 0 ns);
|
||||
CONSTANT DefPropDelay01Z : VitalDelayType01Z := (OTHERS => 0 ns);
|
||||
CONSTANT DefSetupHoldCnst : TIME := 0 ns;
|
||||
CONSTANT DefPulseWdthCnst : TIME := 0 ns;
|
||||
CONSTANT DefGlitchMode : VitalGlitchKindType := VitalTransport;
|
||||
CONSTANT DefGlitchMsgOn : BOOLEAN := FALSE;
|
||||
CONSTANT DefGlitchXOn : BOOLEAN := FALSE;
|
||||
CONSTANT DefMsgOnChecks : BOOLEAN := TRUE;
|
||||
CONSTANT DefXOnChecks : BOOLEAN := TRUE;
|
||||
|
||||
end dffeas_pack;
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
use IEEE.VITAL_Timing.all;
|
||||
use work.dffeas_pack.all;
|
||||
|
||||
package altera_primitives_components is
|
||||
|
||||
component carry
|
||||
port (
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic );
|
||||
end component;
|
||||
|
||||
component cascade
|
||||
port (
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic );
|
||||
end component;
|
||||
|
||||
component global
|
||||
port (
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic);
|
||||
end component;
|
||||
|
||||
component tri
|
||||
port(
|
||||
a_in : in std_logic;
|
||||
oe : in std_logic;
|
||||
a_out : out std_logic);
|
||||
end component;
|
||||
|
||||
component carry_sum
|
||||
port (
|
||||
sin : in std_logic;
|
||||
cin : in std_logic;
|
||||
sout : out std_logic;
|
||||
cout : out std_logic );
|
||||
end component;
|
||||
|
||||
component exp
|
||||
port (
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic);
|
||||
end component;
|
||||
|
||||
component soft
|
||||
port (
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic );
|
||||
end component;
|
||||
|
||||
component opndrn
|
||||
port (
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic );
|
||||
end component;
|
||||
|
||||
component row_global
|
||||
port (
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic );
|
||||
end component;
|
||||
|
||||
component lut_input
|
||||
port(
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic);
|
||||
end component;
|
||||
|
||||
component lut_output
|
||||
port(
|
||||
a_in : in std_logic;
|
||||
a_out : out std_logic);
|
||||
end component;
|
||||
|
||||
component dlatch
|
||||
port(
|
||||
d : in std_logic;
|
||||
ena : in std_logic;
|
||||
clrn : in std_logic;
|
||||
prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component latch
|
||||
port(
|
||||
d : in std_logic;
|
||||
ena : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component dff
|
||||
port(
|
||||
d, clk, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component dffe
|
||||
port(
|
||||
d, clk, ena, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component dffea
|
||||
port(
|
||||
d, clk, ena, clrn, prn, aload, adata : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component dffeas
|
||||
generic (
|
||||
power_up : string := "DONT_CARE";
|
||||
is_wysiwyg : string := "false";
|
||||
dont_touch : string := "false";
|
||||
x_on_violation : string := "on";
|
||||
lpm_type : string := "DFFEAS";
|
||||
tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_clrn_q_negedge : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_prn_q_negedge : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_asdata_q: VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clk : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_d : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_asdata : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_sclr : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_sload : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clrn : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_prn : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_aload : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_ena : VitalDelayType01 := DefPropDelay01;
|
||||
TimingChecksOn: Boolean := True;
|
||||
MsgOn: Boolean := DefGlitchMsgOn;
|
||||
XOn: Boolean := DefGlitchXOn;
|
||||
MsgOnChecks: Boolean := DefMsgOnChecks;
|
||||
XOnChecks: Boolean := DefXOnChecks;
|
||||
InstancePath: STRING := "*" );
|
||||
|
||||
port (
|
||||
d : in std_logic := '0';
|
||||
clk : in std_logic := '0';
|
||||
ena : in std_logic := '1';
|
||||
clrn : in std_logic := '1';
|
||||
prn : in std_logic := '1';
|
||||
aload : in std_logic := '0';
|
||||
asdata : in std_logic := '1';
|
||||
sclr : in std_logic := '0';
|
||||
sload : in std_logic := '0';
|
||||
devclrn : in std_logic := '1';
|
||||
devpor : in std_logic := '1';
|
||||
q : out std_logic );
|
||||
end component;
|
||||
|
||||
component tff
|
||||
port(
|
||||
t, clk, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component tffe
|
||||
port(
|
||||
t, clk, ena, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component jkff
|
||||
port(
|
||||
j, k, clk, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component jkffe
|
||||
port(
|
||||
j, k, clk, ena, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component srff
|
||||
port(
|
||||
s, r, clk, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component srffe
|
||||
port(
|
||||
s, r, clk, ena, clrn, prn : in std_logic;
|
||||
q : out std_logic);
|
||||
end component;
|
||||
|
||||
component clklock
|
||||
generic(
|
||||
input_frequency : natural := 10000;
|
||||
clockboost : natural := 1);
|
||||
|
||||
port(
|
||||
inclk : in std_logic;
|
||||
outclk : out std_logic);
|
||||
end component;
|
||||
|
||||
component alt_inbuf
|
||||
generic(
|
||||
io_standard : string := "NONE";
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
lpm_type : string := "alt_inbuf" );
|
||||
|
||||
port(
|
||||
i : in std_logic;
|
||||
o : out std_logic);
|
||||
end component;
|
||||
|
||||
component alt_outbuf
|
||||
generic(
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
slow_slew_rate : string := "NONE";
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
lpm_type : string := "alt_outbuf" );
|
||||
|
||||
port(
|
||||
i : in std_logic;
|
||||
o : out std_logic);
|
||||
end component;
|
||||
|
||||
component alt_outbuf_tri
|
||||
generic(
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
slow_slew_rate : string := "NONE";
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
lpm_type : string := "alt_outbuf_tri" );
|
||||
|
||||
port(
|
||||
i : in std_logic;
|
||||
oe : in std_logic;
|
||||
o : out std_logic);
|
||||
end component;
|
||||
|
||||
component alt_iobuf
|
||||
generic(
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
slow_slew_rate : string := "NONE";
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
input_termination : string := "NONE";
|
||||
output_termination : string := "NONE";
|
||||
lpm_type : string := "alt_iobuf" );
|
||||
|
||||
port(
|
||||
i : in std_logic;
|
||||
oe : in std_logic;
|
||||
io : inout std_logic;
|
||||
o : out std_logic);
|
||||
end component;
|
||||
|
||||
component alt_inbuf_diff
|
||||
generic(
|
||||
io_standard : string := "NONE";
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
lpm_type : string := "alt_inbuf_diff" );
|
||||
|
||||
port(
|
||||
i : in std_logic;
|
||||
ibar : in std_logic;
|
||||
o : out std_logic);
|
||||
end component;
|
||||
|
||||
component alt_outbuf_diff
|
||||
generic (
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
lpm_type : string := "alt_outbuf_diff" );
|
||||
|
||||
port(
|
||||
i : in std_logic;
|
||||
o : out std_logic;
|
||||
obar : out std_logic );
|
||||
end component;
|
||||
|
||||
component alt_outbuf_tri_diff
|
||||
generic (
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
lpm_type : string := "alt_outbuf_tri_diff" );
|
||||
port(
|
||||
i : in std_logic;
|
||||
oe : in std_logic;
|
||||
o : out std_logic;
|
||||
obar : out std_logic );
|
||||
end component;
|
||||
|
||||
component alt_iobuf_diff
|
||||
generic (
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
input_termination : string := "NONE";
|
||||
output_termination : string := "NONE";
|
||||
lpm_type : string := "alt_iobuf_diff" );
|
||||
port(
|
||||
i : in std_logic;
|
||||
oe : in std_logic;
|
||||
io : inout std_logic;
|
||||
iobar : inout std_logic;
|
||||
o : out std_logic );
|
||||
end component;
|
||||
|
||||
component alt_bidir_diff
|
||||
generic (
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
input_termination : string := "NONE";
|
||||
output_termination : string := "NONE";
|
||||
lpm_type : string := "alt_bidir_diff" );
|
||||
port(
|
||||
oe : in std_logic;
|
||||
bidirin : inout std_logic;
|
||||
io : inout std_logic;
|
||||
iobar : inout std_logic );
|
||||
end component;
|
||||
|
||||
component alt_bidir_buf
|
||||
generic (
|
||||
io_standard : string := "NONE";
|
||||
current_strength : string := "NONE";
|
||||
current_strength_new : string := "NONE";
|
||||
slew_rate : integer := -1;
|
||||
location : string := "NONE";
|
||||
enable_bus_hold : string := "NONE";
|
||||
weak_pull_up_resistor : string := "NONE";
|
||||
termination : string := "NONE";
|
||||
input_termination : string := "NONE";
|
||||
output_termination : string := "NONE";
|
||||
lpm_type : string := "alt_bidir_buf" );
|
||||
port(
|
||||
oe : in std_logic;
|
||||
bidirin : inout std_logic;
|
||||
io : inout std_logic );
|
||||
end component;
|
||||
|
||||
end altera_primitives_components;
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
-- Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License
|
||||
-- Subscription Agreement, the Altera Quartus II License Agreement,
|
||||
-- the Altera MegaCore Function License Agreement, or other
|
||||
-- applicable license agreement, including, without limitation,
|
||||
-- that your use is for the sole purpose of programming logic
|
||||
-- devices manufactured by Altera and sold by Altera or its
|
||||
-- authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
library std;
|
||||
use std.standard.all;
|
||||
|
||||
package altera_standard_functions is
|
||||
|
||||
function maximum (L, R: integer) return integer;
|
||||
function minimum (L, R: integer) return integer;
|
||||
|
||||
end altera_standard_functions;
|
||||
|
||||
package body altera_standard_functions is
|
||||
|
||||
function maximum (L, R: integer) return integer is
|
||||
begin
|
||||
if L > R then
|
||||
return L;
|
||||
else
|
||||
return R;
|
||||
end if;
|
||||
end maximum;
|
||||
|
||||
function minimum (L, R: integer) return integer is
|
||||
begin
|
||||
if L > R then
|
||||
return R;
|
||||
else
|
||||
return L;
|
||||
end if;
|
||||
end minimum;
|
||||
|
||||
end altera_standard_functions;
|
||||
@@ -0,0 +1,94 @@
|
||||
-- Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License
|
||||
-- Subscription Agreement, the Altera Quartus II License Agreement,
|
||||
-- the Altera MegaCore Function License Agreement, or other
|
||||
-- applicable license agreement, including, without limitation,
|
||||
-- that your use is for the sole purpose of programming logic
|
||||
-- devices manufactured by Altera and sold by Altera or its
|
||||
-- authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
-----------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 2006 by Altera Corp. All rights reserved. --
|
||||
-- --
|
||||
-- --
|
||||
-- Description: Package containing Attribute Declarations for all --
|
||||
-- attributes that control Quartus II Integrated Synthesis. --
|
||||
-- Please refer to the Quartus II Help for documentation --
|
||||
-- on using these attributes. --
|
||||
-- --
|
||||
-- --
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
library std;
|
||||
use std.standard.all;
|
||||
|
||||
|
||||
PACKAGE altera_syn_attributes is
|
||||
|
||||
-- Directs Quartus II to implement input, output, and output
|
||||
-- enable registers in I/O cells that have fast, direct connections to
|
||||
-- an I/O pin, when possible
|
||||
ATTRIBUTE useioff : BOOLEAN;
|
||||
|
||||
-- Prevents Quartus II from minimizing or removing a register
|
||||
ATTRIBUTE preserve : BOOLEAN;
|
||||
|
||||
-- Prevents Quartus II from removing a dangling register
|
||||
ATTRIBUTE noprune : BOOLEAN;
|
||||
|
||||
-- Prevents Quartus II from merging a register with a duplicate
|
||||
ATTRIBUTE dont_merge : BOOLEAN;
|
||||
|
||||
-- Prevents Quartus II from replicating a register to improve timing
|
||||
ATTRIBUTE dont_replicate : BOOLEAN;
|
||||
|
||||
-- Prevents Quartus II from retiming a register
|
||||
ATTRIBUTE dont_retime : BOOLEAN;
|
||||
|
||||
-- Identifies the critical clock enable signal for a register. The
|
||||
-- Quartus II software will attempt to connect this signal to the
|
||||
-- dedicated clock enable port.
|
||||
ATTRIBUTE direct_enable : BOOLEAN;
|
||||
|
||||
-- Prevents Quartus II from minimizing or removing a particular
|
||||
-- signal net during combinational logic optimization
|
||||
ATTRIBUTE keep : BOOLEAN;
|
||||
|
||||
-- Sets a fan-out limit on a register or net.
|
||||
ATTRIBUTE maxfan : NATURAL;
|
||||
|
||||
-- Controls the implementation of a multiplication (*) operations in VHDL
|
||||
ATTRIBUTE multstyle : STRING;
|
||||
|
||||
-- Controls the implementation of inferred memories
|
||||
ATTRIBUTE ramstyle : STRING;
|
||||
|
||||
-- Controls the implementation of inferred ROMs
|
||||
ATTRIBUTE romstyle : STRING;
|
||||
|
||||
-- Specifies a Memory Initialization File (.mif) for an inferred RAM
|
||||
ATTRIBUTE ram_init_file : STRING;
|
||||
|
||||
-- Assigns a logic encoding to an enumerated type. Prevents state
|
||||
-- machine extraction for all objects with the enumerated type.
|
||||
ATTRIBUTE enum_encoding : STRING;
|
||||
|
||||
-- Assigns a state encoding to an enumerated type that models the states
|
||||
-- of an extracted state machine.
|
||||
ATTRIBUTE syn_encoding : STRING;
|
||||
|
||||
-- Specifies device pin assignments for a VHDL entity port
|
||||
ATTRIBUTE chip_pin : STRING;
|
||||
|
||||
-- Applies an arbitrary number of Quartus Settings File (QSF) assignments
|
||||
-- to a signal, entity, architecture, instance, or inferred register
|
||||
ATTRIBUTE altera_attribute : STRING;
|
||||
|
||||
END altera_syn_attributes;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,242 @@
|
||||
-----------------------------------------------------------------------------
|
||||
-- --
|
||||
-- Copyright (c) 1996 by Altera Corp. All rights reserved. --
|
||||
-- --
|
||||
-- --
|
||||
-- Description: Package file for Altera mega functions. --
|
||||
-- --
|
||||
-- --
|
||||
------------------------------------------------------------------------------
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
package megacore is
|
||||
component a16450
|
||||
port (
|
||||
mr : IN std_logic;
|
||||
clk : IN std_logic;
|
||||
a : IN std_logic_vector(2 downto 0);
|
||||
din : IN std_logic_vector(7 downto 0);
|
||||
cs0 : IN std_logic;
|
||||
cs1 : IN std_logic;
|
||||
ncs2 : IN std_logic;
|
||||
nads : IN std_logic;
|
||||
rd : IN std_logic;
|
||||
nrd : IN std_logic;
|
||||
wr : IN std_logic;
|
||||
nwr : IN std_logic;
|
||||
sin : IN std_logic;
|
||||
rclk : IN std_logic;
|
||||
ncts : IN std_logic;
|
||||
ndsr : IN std_logic;
|
||||
ndcd : IN std_logic;
|
||||
nri : IN std_logic;
|
||||
dout : OUT std_logic_vector(7 downto 0);
|
||||
ddis : OUT std_logic;
|
||||
csout : OUT std_logic;
|
||||
sout : OUT std_logic;
|
||||
nbaudout : OUT std_logic;
|
||||
nrts : OUT std_logic;
|
||||
ndtr : OUT std_logic;
|
||||
nout1 : OUT std_logic;
|
||||
nout2 : OUT std_logic;
|
||||
intr : OUT std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component a6402
|
||||
port (
|
||||
cls1 : IN std_logic;
|
||||
cls2 : IN std_logic;
|
||||
crl : IN std_logic;
|
||||
ndrr : IN std_logic;
|
||||
epe : IN std_logic;
|
||||
mr : IN std_logic;
|
||||
pi : IN std_logic;
|
||||
rrc : IN std_logic;
|
||||
rri : IN std_logic;
|
||||
sbs : IN std_logic;
|
||||
tbr : IN std_logic_vector(7 downto 0);
|
||||
ntbrl : IN std_logic;
|
||||
trc : IN std_logic;
|
||||
dr : OUT std_logic;
|
||||
fe : OUT std_logic;
|
||||
oe : OUT std_logic;
|
||||
pe : OUT std_logic;
|
||||
rbr : OUT std_logic_vector(7 downto 0);
|
||||
tbre : OUT std_logic;
|
||||
tro : OUT std_logic;
|
||||
tre : OUT std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component a6850
|
||||
port (
|
||||
nreset : IN std_logic;
|
||||
di : IN std_logic_vector(7 downto 0);
|
||||
e : IN std_logic;
|
||||
rnw : IN std_logic;
|
||||
cs : IN std_logic_vector(2 downto 0);
|
||||
rs : IN std_logic;
|
||||
txclk : IN std_logic;
|
||||
rxclk : IN std_logic;
|
||||
rxdata : IN std_logic;
|
||||
ncts : IN std_logic;
|
||||
ndcd : IN std_logic;
|
||||
do : OUT std_logic_vector(7 downto 0);
|
||||
nirq : OUT std_logic;
|
||||
txdata : OUT std_logic;
|
||||
nrts : OUT std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component a8237
|
||||
port (
|
||||
reset : IN std_logic;
|
||||
clk : IN std_logic;
|
||||
ncs : IN std_logic;
|
||||
niorin : IN std_logic;
|
||||
niowin : IN std_logic;
|
||||
ready : IN std_logic;
|
||||
hlda : IN std_logic;
|
||||
neopin : IN std_logic;
|
||||
ain : IN std_logic_vector(3 downto 0);
|
||||
dreq : IN std_logic_vector(3 downto 0);
|
||||
dbin : IN std_logic_vector(7 downto 0);
|
||||
dbout : OUT std_logic_vector(7 downto 0);
|
||||
dben : OUT std_logic;
|
||||
aout : OUT std_logic_vector(7 downto 0);
|
||||
hrq : OUT std_logic;
|
||||
dack : OUT std_logic_vector(3 downto 0);
|
||||
aen : OUT std_logic;
|
||||
adstb : OUT std_logic;
|
||||
niorout : OUT std_logic;
|
||||
niowout : OUT std_logic;
|
||||
nmemr : OUT std_logic;
|
||||
nmemw : OUT std_logic;
|
||||
neopout : OUT std_logic;
|
||||
dmaenable : OUT std_logic
|
||||
);
|
||||
end component;
|
||||
|
||||
component a8251
|
||||
port (
|
||||
clk : IN std_logic;
|
||||
nreset : IN std_logic;
|
||||
nwr : IN std_logic;
|
||||
nrd : IN std_logic;
|
||||
ncs : IN std_logic;
|
||||
cnd : IN std_logic;
|
||||
ndsr : IN std_logic;
|
||||
ncts : IN std_logic;
|
||||
extsyncd : IN std_logic;
|
||||
ntxc : IN std_logic;
|
||||
nrxc : IN std_logic;
|
||||
rxd : IN std_logic;
|
||||
din : IN std_logic_vector(7 downto 0);
|
||||
txd : OUT std_logic;
|
||||
txrdy : OUT std_logic;
|
||||
txempty : OUT std_logic;
|
||||
rxrdy : OUT std_logic;
|
||||
ndtr : OUT std_logic;
|
||||
nrts : OUT std_logic;
|
||||
syn_brk : OUT std_logic;
|
||||
nen : OUT std_logic;
|
||||
dout : OUT std_logic_vector(7 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component a8255
|
||||
port (
|
||||
reset : IN std_logic;
|
||||
clk : IN std_logic;
|
||||
ncs : IN std_logic;
|
||||
nrd : IN std_logic;
|
||||
nwr : IN std_logic;
|
||||
a : IN std_logic_vector(1 downto 0);
|
||||
din : IN std_logic_vector(7 downto 0);
|
||||
pain : IN std_logic_vector(7 downto 0);
|
||||
pbin : IN std_logic_vector(7 downto 0);
|
||||
pcin : IN std_logic_vector(7 downto 0);
|
||||
dout : OUT std_logic_vector(7 downto 0);
|
||||
paout : OUT std_logic_vector(7 downto 0);
|
||||
paen : OUT std_logic;
|
||||
pbout : OUT std_logic_vector(7 downto 0);
|
||||
pben : OUT std_logic;
|
||||
pcout : OUT std_logic_vector(7 downto 0);
|
||||
pcen : OUT std_logic_vector(7 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component rgb2ycrcb
|
||||
port (
|
||||
R : IN std_logic_vector(7 downto 0);
|
||||
G : IN std_logic_vector(7 downto 0);
|
||||
B : IN std_logic_vector(7 downto 0);
|
||||
CLOCK : IN std_logic := '0';
|
||||
ACLR : IN std_logic := '0';
|
||||
Y : OUT std_logic_vector(15 downto 0);
|
||||
Cr: OUT std_logic_vector(14 downto 0);
|
||||
Cb: OUT std_logic_vector(14 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component ycrcb2rgb
|
||||
port (
|
||||
Y : IN std_logic_vector(7 downto 0);
|
||||
CR : IN std_logic_vector(7 downto 0);
|
||||
CB : IN std_logic_vector(7 downto 0);
|
||||
CLOCK : IN std_logic := '0';
|
||||
ACLR : IN std_logic := '0';
|
||||
R : OUT std_logic_vector(16 downto 0);
|
||||
G: OUT std_logic_vector(16 downto 0);
|
||||
B: OUT std_logic_vector(16 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component a8259
|
||||
port (
|
||||
nmrst, clk, ncs, nwr, nrd, a0, nsp, ninta : IN std_logic;
|
||||
casin : IN std_logic_vector(2 downto 0);
|
||||
din, ir : IN std_logic_vector(7 downto 0);
|
||||
nen, cas_en, int : OUT std_logic;
|
||||
dout : OUT std_logic_vector(7 downto 0);
|
||||
casout : OUT std_logic_vector(7 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
component fft
|
||||
generic (
|
||||
WIDTH_DATA : POSITIVE;
|
||||
WIDTH_TWIDDLE : POSITIVE;
|
||||
PIPE_DATA : INTEGER;
|
||||
PIPE_TWIDDLE : INTEGER;
|
||||
WIDTH_EXPONENT : POSITIVE;
|
||||
WIDTH_ADD : POSITIVE;
|
||||
EXPONENT_INITIAL_VALUE : INTEGER
|
||||
);
|
||||
port (
|
||||
clock : IN std_logic := '0';
|
||||
start_fft : IN std_logic;
|
||||
data_left_in_re : IN std_logic_vector(WIDTH_DATA-1 downto 0);
|
||||
data_left_in_im : IN std_logic_vector(WIDTH_DATA-1 downto 0);
|
||||
data_right_in_re : IN std_logic_vector(WIDTH_DATA-1 downto 0);
|
||||
data_right_in_im : IN std_logic_vector(WIDTH_DATA-1 downto 0);
|
||||
twiddle_re : IN std_logic_vector(WIDTH_TWIDDLE-1 downto 0);
|
||||
twiddle_im : IN std_logic_vector(WIDTH_TWIDDLE-1 downto 0);
|
||||
done : OUT std_logic;
|
||||
data_direction : OUT std_logic;
|
||||
we_left : OUT std_logic;
|
||||
add_left : OUT std_logic_vector(WIDTH_ADD-1 downto 0);
|
||||
we_right : OUT std_logic;
|
||||
add_right : OUT std_logic_vector(WIDTH_ADD-1 downto 0);
|
||||
add_twiddle : OUT std_logic_vector(WIDTH_ADD-2 downto 0);
|
||||
data_out_re : OUT std_logic_vector(WIDTH_DATA-1 downto 0);
|
||||
data_out_im : OUT std_logic_vector(WIDTH_DATA-1 downto 0);
|
||||
exponent : OUT std_logic_vector(WIDTH_EXPONENT-1 downto 0)
|
||||
);
|
||||
end component;
|
||||
|
||||
|
||||
|
||||
end megacore;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,221 @@
|
||||
--
|
||||
-- Copyright (C) 1988-2002 Altera Corporation
|
||||
--
|
||||
-- Any megafunction design, and related net list (encrypted or decrypted),
|
||||
-- support information, device programming or simulation file, and any
|
||||
-- other associated documentation or information provided by Altera or a
|
||||
-- partner under Altera's Megafunction Partnership Program may be used only
|
||||
-- to program PLD devices (but not masked PLD devices) from Altera. Any
|
||||
-- other use of such megafunction design, net list, support information,
|
||||
-- device programming or simulation file, or any other related
|
||||
-- documentation or information is prohibited for any other purpose,
|
||||
-- including, but not limited to modification, reverse engineering, de-
|
||||
-- compiling, or use with any other silicon devices, unless such use is
|
||||
-- explicitly licensed under a separate agreement with Altera or a
|
||||
-- megafunction partner. Title to the intellectual property, including
|
||||
-- patents, copyrights, trademarks, trade secrets, or maskworks, embodied
|
||||
-- in any such megafunction design, net list, support information, device
|
||||
-- programming or simulation file, or any other related documentation or
|
||||
-- information provided by Altera or a megafunction partner, remains with
|
||||
-- Altera, the megafunction partner, or their respective licensors. No
|
||||
-- other licenses, including any licenses needed under any third party's
|
||||
-- intellectual property, are provided herein.
|
||||
----------------------------------------------------------------------------
|
||||
----------------------------------------------------------------------------
|
||||
-- ALtera Stratix GX Megafunction Component Declaration File
|
||||
--
|
||||
|
||||
library ieee;
|
||||
use ieee.std_logic_1164.all;
|
||||
|
||||
package stratixgx_mf_components is
|
||||
function get_rx_channel_width(use_generic_fifo, clk_out_mode_reference : string;
|
||||
channel_width : integer) return integer;
|
||||
function get_rx_dwidth_factor(use_generic_fifo, clk_out_mode_reference : string;
|
||||
dwidth_factor : integer) return integer;
|
||||
component altgxb
|
||||
generic (
|
||||
operation_mode : string := "DUPLEX";
|
||||
loopback_mode : string := "NONE";
|
||||
reverse_loopback_mode : string := "NONE";
|
||||
protocol : string := "CUSTOM";
|
||||
number_of_channels: integer := 20;
|
||||
number_of_quads : integer := 1;
|
||||
channel_width : positive := 20;
|
||||
pll_inclock_period : integer := 20000;
|
||||
data_rate : integer := 0;
|
||||
data_rate_remainder : integer := 0;
|
||||
|
||||
rx_data_rate : integer := 0;
|
||||
rx_data_rate_remainder : integer := 0;
|
||||
|
||||
use_8b_10b_mode : string := "OFF";
|
||||
use_double_data_mode : string := "OFF";
|
||||
dwidth_factor : integer := 1;
|
||||
|
||||
-- RX Mode
|
||||
disparity_mode : string := "OFF";
|
||||
cru_inclock_period : integer := 0; -- Units in ps
|
||||
run_length : integer := 128;
|
||||
run_length_enable : string := "OFF";
|
||||
use_channel_align : string := "OFF";
|
||||
use_auto_bit_slip : string := "OFF";
|
||||
use_rate_match_fifo : string := "OFF";
|
||||
use_symbol_align : string := "OFF";
|
||||
align_pattern : string := "X";
|
||||
align_pattern_length : integer := 0;
|
||||
infiniband_invalid_code : integer := 0;
|
||||
clk_out_mode_reference : string := "ON";
|
||||
-- TX Mode
|
||||
use_fifo_mode : string := "ON";
|
||||
intended_device_family : string := "STRATIXGX";
|
||||
force_disparity_mode : string := "OFF";
|
||||
lpm_type : string := "altgxb";
|
||||
tx_termination : integer := 0;
|
||||
-- Quartus 2.2 New Parameters
|
||||
-- common
|
||||
use_self_test_mode : string := "OFF";
|
||||
self_test_mode : integer := 0;
|
||||
|
||||
-- Receiver
|
||||
use_equalizer_ctrl_signal : string := "OFF";
|
||||
equalizer_ctrl_setting : integer := 0;
|
||||
signal_threshold_select : integer := 80;
|
||||
rx_bandwidth_type : string := "NEW_MEDIUM";
|
||||
rx_enable_dc_coupling : string := "OFF";
|
||||
use_vod_ctrl_signal : string := "OFF";
|
||||
vod_ctrl_setting : integer := 1000;
|
||||
use_preemphasis_ctrl_signal : string := "OFF";
|
||||
preemphasis_ctrl_setting : integer := 0;
|
||||
use_phase_shift : string := "ON";
|
||||
pll_bandwidth_type : string := "LOW";
|
||||
pll_use_dc_coupling : string := "OFF";
|
||||
rx_ppm_setting : integer := 1000;
|
||||
use_generic_fifo : string := "OFF";
|
||||
use_rx_cruclk : string := "OFF";
|
||||
use_rx_clkout : string := "OFF";
|
||||
use_rx_coreclk : string := "OFF";
|
||||
use_tx_coreclk : string := "OFF";
|
||||
instantiate_transmitter_pll : string := "OFF";
|
||||
consider_instantiate_transmitter_pll_param : string := "OFF";
|
||||
rx_force_signal_detect : string := "OFF";
|
||||
flip_rx_out : string := "OFF";
|
||||
flip_tx_in : string := "OFF";
|
||||
add_generic_fifo_we_synch_register : string := "OFF";
|
||||
consider_enable_tx_8b_10b_i1i2_generation : string := "OFF";
|
||||
enable_tx_8b_10b_i1i2_generation : string := "OFF";
|
||||
for_engineering_sample_device : string := "ON";
|
||||
device_family : string := ""
|
||||
|
||||
);
|
||||
|
||||
port (
|
||||
inclk : in std_logic_vector(number_of_quads-1 downto 0) := (others => '0');
|
||||
rx_coreclk : in std_logic_vector(number_of_channels - 1 downto 0) := (others => '0');
|
||||
pll_areset : in std_logic_vector(number_of_quads-1 downto 0):= (others => '0');
|
||||
rx_cruclk : in std_logic_vector(number_of_quads - 1 downto 0) := (others => '0');
|
||||
rx_in : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0');
|
||||
rx_aclr : in std_logic_vector(number_of_channels - 1 downto 0) := (others => '0');
|
||||
rx_bitslip : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0');
|
||||
rx_enacdet : in std_logic_vector(number_of_channels-1 downto 0):= (others => '0');
|
||||
rx_we: in std_logic_vector(number_of_channels-1 downto 0) := (others => '0');
|
||||
rx_re: in std_logic_vector(number_of_channels-1 downto 0):= (others => '0');
|
||||
rx_slpbk : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0');
|
||||
rx_a1a2size : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0');
|
||||
rx_equalizerctrl : in std_logic_vector(number_of_channels * 3 -1 downto 0) := (others => '0');
|
||||
rx_locktorefclk : in std_logic_vector(number_of_channels -1 downto 0) := (others => '0');
|
||||
rx_locktodata : in std_logic_vector(number_of_channels -1 downto 0) := (others => '0');
|
||||
|
||||
tx_in : in std_logic_vector(channel_width * number_of_channels-1 downto 0) := (others => '0');
|
||||
tx_coreclk : in std_logic_vector(number_of_channels - 1 downto 0) := (others => '0');
|
||||
tx_aclr : in std_logic_vector(number_of_channels - 1 downto 0) := (others => '0');
|
||||
tx_ctrlenable : in std_logic_vector(dwidth_factor * number_of_channels-1 downto 0) := (others => '0');
|
||||
tx_forcedisparity : in std_logic_vector(dwidth_factor * number_of_channels-1 downto 0) := (others => '0');
|
||||
tx_srlpbk : in std_logic_vector(number_of_channels-1 downto 0) := (others => '0');
|
||||
tx_vodctrl : in std_logic_vector(number_of_channels * 3-1 downto 0) := (others => '0');
|
||||
tx_preemphasisctrl: in std_logic_vector(number_of_channels * 3-1 downto 0) := (others => '0');
|
||||
|
||||
|
||||
-- XGM Input ports, common for Both Rx and Tx Mode
|
||||
|
||||
txdigitalreset : in std_logic_vector(number_of_channels - 1 downto 0) := (others => '0');
|
||||
rxdigitalreset : in std_logic_vector(number_of_channels - 1 downto 0) := (others => '0');
|
||||
rxanalogreset : in std_logic_vector(number_of_channels - 1 downto 0) := (others => '0');
|
||||
pllenable : in std_logic_vector(number_of_quads - 1 downto 0) := (others => '1');
|
||||
|
||||
|
||||
pll_locked : out std_logic_vector(number_of_quads-1 downto 0);
|
||||
coreclk_out : out std_logic_vector(number_of_quads-1 downto 0);
|
||||
rx_out : out std_logic_vector(get_rx_channel_width(use_generic_fifo,
|
||||
clk_out_mode_reference, channel_width) * number_of_channels-1 downto 0);
|
||||
rx_clkout : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_locked : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_freqlocked : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_rlv : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_syncstatus : out std_logic_vector(get_rx_dwidth_factor(use_generic_fifo,
|
||||
clk_out_mode_reference, dwidth_factor) * number_of_channels-1 downto 0);
|
||||
|
||||
|
||||
rx_patterndetect : out std_logic_vector(get_rx_dwidth_factor(use_generic_fifo,
|
||||
clk_out_mode_reference, dwidth_factor) * number_of_channels-1 downto 0);
|
||||
rx_ctrldetect : out std_logic_vector(get_rx_dwidth_factor(use_generic_fifo,
|
||||
clk_out_mode_reference, dwidth_factor) * number_of_channels-1 downto 0);
|
||||
rx_errdetect : out std_logic_vector(get_rx_dwidth_factor(use_generic_fifo,
|
||||
clk_out_mode_reference, dwidth_factor) * number_of_channels-1 downto 0);
|
||||
rx_disperr : out std_logic_vector(get_rx_dwidth_factor(use_generic_fifo,
|
||||
clk_out_mode_reference, dwidth_factor) * number_of_channels-1 downto 0);
|
||||
rx_signaldetect : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_fifoalmostempty : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_fifoalmostfull : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_channelaligned : out std_logic_vector(number_of_quads-1 downto 0);
|
||||
rx_bisterr : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_bistdone : out std_logic_vector(number_of_channels-1 downto 0);
|
||||
rx_a1a2sizeout : out std_logic_vector(get_rx_dwidth_factor(use_generic_fifo,
|
||||
clk_out_mode_reference, dwidth_factor) * number_of_channels-1 downto 0);
|
||||
tx_out : out std_logic_vector(number_of_channels-1 downto 0)
|
||||
);
|
||||
|
||||
|
||||
end component;
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
package body stratixgx_mf_components is
|
||||
|
||||
function get_rx_channel_width(use_generic_fifo, clk_out_mode_reference : string;
|
||||
channel_width : integer) return integer is
|
||||
variable rx_channel_width : integer;
|
||||
begin
|
||||
rx_channel_width := channel_width;
|
||||
if ((use_generic_fifo = "ON") or (clk_out_mode_reference = "OFF")) then
|
||||
if (channel_width = 16) or (channel_width = 20) then
|
||||
rx_channel_width := channel_width/2;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
return rx_channel_width;
|
||||
|
||||
end get_rx_channel_width;
|
||||
|
||||
|
||||
function get_rx_dwidth_factor(use_generic_fifo, clk_out_mode_reference : string;
|
||||
dwidth_factor : integer) return integer is
|
||||
variable rx_dwidth_factor : integer;
|
||||
begin
|
||||
rx_dwidth_factor := dwidth_factor;
|
||||
if ((use_generic_fifo = "ON") or (clk_out_mode_reference = "OFF")) then
|
||||
if (dwidth_factor = 2) then
|
||||
rx_dwidth_factor := dwidth_factor/2;
|
||||
end if;
|
||||
end if;
|
||||
|
||||
return rx_dwidth_factor;
|
||||
|
||||
end get_rx_dwidth_factor;
|
||||
end;
|
||||
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,847 @@
|
||||
-- Copyright (C) 1991-2015 Altera Corporation. All rights reserved.
|
||||
-- Your use of Altera Corporation's design tools, logic functions
|
||||
-- and other software and tools, and its AMPP partner logic
|
||||
-- functions, and any output files from any of the foregoing
|
||||
-- (including device programming or simulation files), and any
|
||||
-- associated documentation or information are expressly subject
|
||||
-- to the terms and conditions of the Altera Program License
|
||||
-- Subscription Agreement, the Altera Quartus II License Agreement,
|
||||
-- the Altera MegaCore Function License Agreement, or other
|
||||
-- applicable license agreement, including, without limitation,
|
||||
-- that your use is for the sole purpose of programming logic
|
||||
-- devices manufactured by Altera and sold by Altera or its
|
||||
-- authorized distributors. Please refer to the applicable
|
||||
-- agreement for further details.
|
||||
-- Quartus II 15.0.0 Build 145 04/22/2015
|
||||
|
||||
LIBRARY IEEE;
|
||||
use IEEE.STD_LOGIC_1164.all;
|
||||
use IEEE.VITAL_Timing.all;
|
||||
use work.cycloneive_atom_pack.all;
|
||||
|
||||
package cycloneive_components is
|
||||
|
||||
|
||||
--
|
||||
-- cycloneive_lcell_comb
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_lcell_comb
|
||||
generic (
|
||||
lut_mask : std_logic_vector(15 downto 0) := (OTHERS => '1');
|
||||
sum_lutc_input : string := "datac";
|
||||
dont_touch : string := "off";
|
||||
lpm_type : string := "cycloneive_lcell_comb";
|
||||
TimingChecksOn: Boolean := True;
|
||||
MsgOn: Boolean := DefGlitchMsgOn;
|
||||
XOn: Boolean := DefGlitchXOn;
|
||||
MsgOnChecks: Boolean := DefMsgOnChecks;
|
||||
XOnChecks: Boolean := DefXOnChecks;
|
||||
InstancePath: STRING := "*";
|
||||
tpd_dataa_combout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_datab_combout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_datac_combout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_datad_combout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_cin_combout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_dataa_cout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_datab_cout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_datac_cout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_datad_cout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_cin_cout : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_dataa : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_datab : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_datac : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_datad : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_cin : VitalDelayType01 := DefPropDelay01
|
||||
);
|
||||
port (
|
||||
dataa : in std_logic := '1';
|
||||
datab : in std_logic := '1';
|
||||
datac : in std_logic := '1';
|
||||
datad : in std_logic := '1';
|
||||
cin : in std_logic := '0';
|
||||
combout : out std_logic;
|
||||
cout : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_routing_wire
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_routing_wire
|
||||
generic (
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
tpd_datain_dataout : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_datainglitch_dataout : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_datain : VitalDelayType01 := DefPropDelay01
|
||||
);
|
||||
PORT (
|
||||
datain : in std_logic;
|
||||
dataout : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_pll
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_pll
|
||||
GENERIC (
|
||||
operation_mode : string := "normal";
|
||||
pll_type : string := "auto"; -- AUTO/FAST/ENHANCED/LEFT_RIGHT/TOP_BOTTOM
|
||||
compensate_clock : string := "clock0";
|
||||
inclk0_input_frequency : integer := 0;
|
||||
inclk1_input_frequency : integer := 0;
|
||||
self_reset_on_loss_lock : string := "off";
|
||||
switch_over_type : string := "auto";
|
||||
switch_over_counter : integer := 1;
|
||||
enable_switch_over_counter : string := "off";
|
||||
bandwidth : integer := 0;
|
||||
bandwidth_type : string := "auto";
|
||||
use_dc_coupling : string := "false";
|
||||
lock_c : integer := 4;
|
||||
sim_gate_lock_device_behavior : string := "off";
|
||||
lock_high : integer := 0;
|
||||
lock_low : integer := 0;
|
||||
lock_window_ui : string := "0.05";
|
||||
lock_window : time := 5 ps;
|
||||
test_bypass_lock_detect : string := "off";
|
||||
clk0_output_frequency : integer := 0;
|
||||
clk0_multiply_by : integer := 0;
|
||||
clk0_divide_by : integer := 0;
|
||||
clk0_phase_shift : string := "0";
|
||||
clk0_duty_cycle : integer := 50;
|
||||
clk1_output_frequency : integer := 0;
|
||||
clk1_multiply_by : integer := 0;
|
||||
clk1_divide_by : integer := 0;
|
||||
clk1_phase_shift : string := "0";
|
||||
clk1_duty_cycle : integer := 50;
|
||||
clk2_output_frequency : integer := 0;
|
||||
clk2_multiply_by : integer := 0;
|
||||
clk2_divide_by : integer := 0;
|
||||
clk2_phase_shift : string := "0";
|
||||
clk2_duty_cycle : integer := 50;
|
||||
clk3_output_frequency : integer := 0;
|
||||
clk3_multiply_by : integer := 0;
|
||||
clk3_divide_by : integer := 0;
|
||||
clk3_phase_shift : string := "0";
|
||||
clk3_duty_cycle : integer := 50;
|
||||
clk4_output_frequency : integer := 0;
|
||||
clk4_multiply_by : integer := 0;
|
||||
clk4_divide_by : integer := 0;
|
||||
clk4_phase_shift : string := "0";
|
||||
clk4_duty_cycle : integer := 50;
|
||||
pfd_min : integer := 0;
|
||||
pfd_max : integer := 0;
|
||||
vco_min : integer := 0;
|
||||
vco_max : integer := 0;
|
||||
vco_center : integer := 0;
|
||||
m_initial : integer := 1;
|
||||
m : integer := 0;
|
||||
n : integer := 1;
|
||||
c0_high : integer := 1;
|
||||
c0_low : integer := 1;
|
||||
c0_initial : integer := 1;
|
||||
c0_mode : string := "bypass";
|
||||
c0_ph : integer := 0;
|
||||
c1_high : integer := 1;
|
||||
c1_low : integer := 1;
|
||||
c1_initial : integer := 1;
|
||||
c1_mode : string := "bypass";
|
||||
c1_ph : integer := 0;
|
||||
c2_high : integer := 1;
|
||||
c2_low : integer := 1;
|
||||
c2_initial : integer := 1;
|
||||
c2_mode : string := "bypass";
|
||||
c2_ph : integer := 0;
|
||||
c3_high : integer := 1;
|
||||
c3_low : integer := 1;
|
||||
c3_initial : integer := 1;
|
||||
c3_mode : string := "bypass";
|
||||
c3_ph : integer := 0;
|
||||
c4_high : integer := 1;
|
||||
c4_low : integer := 1;
|
||||
c4_initial : integer := 1;
|
||||
c4_mode : string := "bypass";
|
||||
c4_ph : integer := 0;
|
||||
m_ph : integer := 0;
|
||||
clk0_counter : string := "unused";
|
||||
clk1_counter : string := "unused";
|
||||
clk2_counter : string := "unused";
|
||||
clk3_counter : string := "unused";
|
||||
clk4_counter : string := "unused";
|
||||
c1_use_casc_in : string := "off";
|
||||
c2_use_casc_in : string := "off";
|
||||
c3_use_casc_in : string := "off";
|
||||
c4_use_casc_in : string := "off";
|
||||
m_test_source : integer := -1;
|
||||
c0_test_source : integer := -1;
|
||||
c1_test_source : integer := -1;
|
||||
c2_test_source : integer := -1;
|
||||
c3_test_source : integer := -1;
|
||||
c4_test_source : integer := -1;
|
||||
vco_multiply_by : integer := 0;
|
||||
vco_divide_by : integer := 0;
|
||||
vco_post_scale : integer := 1;
|
||||
vco_frequency_control : string := "auto";
|
||||
vco_phase_shift_step : integer := 0;
|
||||
charge_pump_current : integer := 10;
|
||||
loop_filter_r : string := " 1.0";
|
||||
loop_filter_c : integer := 0;
|
||||
pll_compensation_delay : integer := 0;
|
||||
simulation_type : string := "functional";
|
||||
lpm_type : string := "cycloneive_pll";
|
||||
clk0_use_even_counter_mode : string := "off";
|
||||
clk1_use_even_counter_mode : string := "off";
|
||||
clk2_use_even_counter_mode : string := "off";
|
||||
clk3_use_even_counter_mode : string := "off";
|
||||
clk4_use_even_counter_mode : string := "off";
|
||||
clk0_use_even_counter_value : string := "off";
|
||||
clk1_use_even_counter_value : string := "off";
|
||||
clk2_use_even_counter_value : string := "off";
|
||||
clk3_use_even_counter_value : string := "off";
|
||||
clk4_use_even_counter_value : string := "off";
|
||||
init_block_reset_a_count : integer := 1;
|
||||
init_block_reset_b_count : integer := 1;
|
||||
charge_pump_current_bits : integer := 0;
|
||||
lock_window_ui_bits : integer := 0;
|
||||
loop_filter_c_bits : integer := 0;
|
||||
loop_filter_r_bits : integer := 0;
|
||||
test_counter_c0_delay_chain_bits : integer := 0;
|
||||
test_counter_c1_delay_chain_bits : integer := 0;
|
||||
test_counter_c2_delay_chain_bits : integer := 0;
|
||||
test_counter_c3_delay_chain_bits : integer := 0;
|
||||
test_counter_c4_delay_chain_bits : integer := 0;
|
||||
test_counter_c5_delay_chain_bits : integer := 0;
|
||||
test_counter_m_delay_chain_bits : integer := 0;
|
||||
test_counter_n_delay_chain_bits : integer := 0;
|
||||
test_feedback_comp_delay_chain_bits : integer := 0;
|
||||
test_input_comp_delay_chain_bits : integer := 0;
|
||||
test_volt_reg_output_mode_bits : integer := 0;
|
||||
test_volt_reg_output_voltage_bits : integer := 0;
|
||||
test_volt_reg_test_mode : string := "false";
|
||||
vco_range_detector_high_bits : integer := -1;
|
||||
vco_range_detector_low_bits : integer := -1;
|
||||
scan_chain_mif_file : string := "";
|
||||
auto_settings : string := "true";
|
||||
family_name : string := "Cycloneive";
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
MsgOnChecks : Boolean := DefMsgOnChecks;
|
||||
XOnChecks : Boolean := DefXOnChecks;
|
||||
TimingChecksOn : Boolean := true;
|
||||
InstancePath : STRING := "*";
|
||||
tipd_inclk : VitalDelayArrayType01(1 downto 0) := (OTHERS => DefPropDelay01);
|
||||
tipd_ena : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_pfdena : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_areset : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_fbin : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_scanclk : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_scanclkena : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_scandata : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_configupdate : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clkswitch : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_phaseupdown : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_phasecounterselect : VitalDelayArrayType01(2 DOWNTO 0) := (OTHERS => DefPropDelay01);
|
||||
tipd_phasestep : VitalDelayType01 := DefPropDelay01;
|
||||
tsetup_scandata_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_scandata_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_scanclkena_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_scanclkena_scanclk_noedge_negedge : VitalDelayType := DefSetupHoldCnst;
|
||||
use_vco_bypass : string := "false"
|
||||
);
|
||||
PORT
|
||||
(
|
||||
inclk : in std_logic_vector(1 downto 0);
|
||||
fbin : in std_logic := '0';
|
||||
fbout : out std_logic;
|
||||
clkswitch : in std_logic := '0';
|
||||
areset : in std_logic := '0';
|
||||
pfdena : in std_logic := '1';
|
||||
scandata : in std_logic := '0';
|
||||
scanclk : in std_logic := '0';
|
||||
scanclkena : in std_logic := '1';
|
||||
configupdate : in std_logic := '0';
|
||||
clk : out std_logic_vector(4 downto 0);
|
||||
phasecounterselect : in std_logic_vector(2 downto 0) := "000";
|
||||
phaseupdown : in std_logic := '0';
|
||||
phasestep : in std_logic := '0';
|
||||
clkbad : out std_logic_vector(1 downto 0);
|
||||
activeclock : out std_logic;
|
||||
locked : out std_logic;
|
||||
scandataout : out std_logic;
|
||||
scandone : out std_logic;
|
||||
phasedone : out std_logic;
|
||||
vcooverrange : out std_logic;
|
||||
vcounderrange : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_ff
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_ff
|
||||
generic (
|
||||
power_up : string := "low";
|
||||
x_on_violation : string := "on";
|
||||
lpm_type : string := "cycloneive_ff";
|
||||
tsetup_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_d_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_asdata_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_sclr_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_sload_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
tpd_clk_q_posedge : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_clrn_q_posedge : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_aload_q_posedge : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_asdata_q: VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clk : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_d : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_asdata : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_sclr : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_sload : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clrn : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_aload : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_ena : VitalDelayType01 := DefPropDelay01;
|
||||
TimingChecksOn: Boolean := True;
|
||||
MsgOn: Boolean := DefGlitchMsgOn;
|
||||
XOn: Boolean := DefGlitchXOn;
|
||||
MsgOnChecks: Boolean := DefMsgOnChecks;
|
||||
XOnChecks: Boolean := DefXOnChecks;
|
||||
InstancePath: STRING := "*"
|
||||
);
|
||||
port (
|
||||
d : in std_logic := '0';
|
||||
clk : in std_logic := '0';
|
||||
clrn : in std_logic := '1';
|
||||
aload : in std_logic := '0';
|
||||
sclr : in std_logic := '0';
|
||||
sload : in std_logic := '0';
|
||||
ena : in std_logic := '1';
|
||||
asdata : in std_logic := '0';
|
||||
devclrn : in std_logic := '1';
|
||||
devpor : in std_logic := '1';
|
||||
q : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_ram_block
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_ram_block
|
||||
GENERIC (
|
||||
operation_mode : STRING := "single_port";
|
||||
mixed_port_feed_through_mode : STRING := "dont_care";
|
||||
ram_block_type : STRING := "auto";
|
||||
logical_ram_name : STRING := "ram_name";
|
||||
init_file : STRING := "init_file.hex";
|
||||
init_file_layout : STRING := "none";
|
||||
data_interleave_width_in_bits : INTEGER := 1;
|
||||
data_interleave_offset_in_bits : INTEGER := 1;
|
||||
port_a_logical_ram_depth : INTEGER := 0;
|
||||
port_a_logical_ram_width : INTEGER := 0;
|
||||
port_a_first_address : INTEGER := 0;
|
||||
port_a_last_address : INTEGER := 0;
|
||||
port_a_first_bit_number : INTEGER := 0;
|
||||
port_a_address_clear : STRING := "none";
|
||||
port_a_data_out_clear : STRING := "none";
|
||||
port_a_data_in_clock : STRING := "clock0";
|
||||
port_a_address_clock : STRING := "clock0";
|
||||
port_a_write_enable_clock : STRING := "clock0";
|
||||
port_a_read_enable_clock : STRING := "clock0";
|
||||
port_a_byte_enable_clock : STRING := "clock0";
|
||||
port_a_data_out_clock : STRING := "none";
|
||||
port_a_data_width : INTEGER := 1;
|
||||
port_a_address_width : INTEGER := 1;
|
||||
port_a_byte_enable_mask_width : INTEGER := 1;
|
||||
port_b_logical_ram_depth : INTEGER := 0;
|
||||
port_b_logical_ram_width : INTEGER := 0;
|
||||
port_b_first_address : INTEGER := 0;
|
||||
port_b_last_address : INTEGER := 0;
|
||||
port_b_first_bit_number : INTEGER := 0;
|
||||
port_b_address_clear : STRING := "none";
|
||||
port_b_data_out_clear : STRING := "none";
|
||||
port_b_data_in_clock : STRING := "clock1";
|
||||
port_b_address_clock : STRING := "clock1";
|
||||
port_b_write_enable_clock: STRING := "clock1";
|
||||
port_b_read_enable_clock: STRING := "clock1";
|
||||
port_b_byte_enable_clock : STRING := "clock1";
|
||||
port_b_data_out_clock : STRING := "none";
|
||||
port_b_data_width : INTEGER := 1;
|
||||
port_b_address_width : INTEGER := 1;
|
||||
port_b_byte_enable_mask_width : INTEGER := 1;
|
||||
port_a_read_during_write_mode : STRING := "new_data_no_nbe_read";
|
||||
port_b_read_during_write_mode : STRING := "new_data_no_nbe_read";
|
||||
power_up_uninitialized : STRING := "false";
|
||||
port_b_byte_size : INTEGER := 0;
|
||||
port_a_byte_size : INTEGER := 0;
|
||||
safe_write : STRING := "err_on_2clk";
|
||||
init_file_restructured : STRING := "unused";
|
||||
lpm_type : string := "cycloneive_ram_block";
|
||||
lpm_hint : string := "true";
|
||||
clk0_input_clock_enable : STRING := "none"; -- ena0,ena2,none
|
||||
clk0_core_clock_enable : STRING := "none"; -- ena0,ena2,none
|
||||
clk0_output_clock_enable : STRING := "none"; -- ena0,none
|
||||
clk1_input_clock_enable : STRING := "none"; -- ena1,ena3,none
|
||||
clk1_core_clock_enable : STRING := "none"; -- ena1,ena3,none
|
||||
clk1_output_clock_enable : STRING := "none"; -- ena1,none
|
||||
mem_init0 : BIT_VECTOR := X"0";
|
||||
mem_init1 : BIT_VECTOR := X"0";
|
||||
mem_init2 : BIT_VECTOR := X"0";
|
||||
mem_init3 : BIT_VECTOR := X"0";
|
||||
mem_init4 : BIT_VECTOR := X"0";
|
||||
connectivity_checking : string := "off"
|
||||
);
|
||||
PORT (
|
||||
portadatain : IN STD_LOGIC_VECTOR(port_a_data_width - 1 DOWNTO 0) := (OTHERS => '0');
|
||||
portaaddr : IN STD_LOGIC_VECTOR(port_a_address_width - 1 DOWNTO 0) := (OTHERS => '0');
|
||||
portawe : IN STD_LOGIC := '0';
|
||||
portare : IN STD_LOGIC := '1';
|
||||
portbdatain : IN STD_LOGIC_VECTOR(port_b_data_width - 1 DOWNTO 0) := (OTHERS => '0');
|
||||
portbaddr : IN STD_LOGIC_VECTOR(port_b_address_width - 1 DOWNTO 0) := (OTHERS => '0');
|
||||
portbwe : IN STD_LOGIC := '0';
|
||||
portbre : IN STD_LOGIC := '1';
|
||||
clk0 : IN STD_LOGIC := '0';
|
||||
clk1 : IN STD_LOGIC := '0';
|
||||
ena0 : IN STD_LOGIC := '1';
|
||||
ena1 : IN STD_LOGIC := '1';
|
||||
ena2 : IN STD_LOGIC := '1';
|
||||
ena3 : IN STD_LOGIC := '1';
|
||||
clr0 : IN STD_LOGIC := '0';
|
||||
clr1 : IN STD_LOGIC := '0';
|
||||
portabyteenamasks : IN STD_LOGIC_VECTOR(port_a_byte_enable_mask_width - 1 DOWNTO 0) := (OTHERS => '1');
|
||||
portbbyteenamasks : IN STD_LOGIC_VECTOR(port_b_byte_enable_mask_width - 1 DOWNTO 0) := (OTHERS => '1');
|
||||
devclrn : IN STD_LOGIC := '1';
|
||||
devpor : IN STD_LOGIC := '1';
|
||||
portaaddrstall : IN STD_LOGIC := '0';
|
||||
portbaddrstall : IN STD_LOGIC := '0';
|
||||
portadataout : OUT STD_LOGIC_VECTOR(port_a_data_width - 1 DOWNTO 0);
|
||||
portbdataout : OUT STD_LOGIC_VECTOR(port_b_data_width - 1 DOWNTO 0)
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_mac_mult
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_mac_mult
|
||||
GENERIC (
|
||||
dataa_width : integer := 18;
|
||||
datab_width : integer := 18;
|
||||
dataa_clock : string := "none";
|
||||
datab_clock : string := "none";
|
||||
signa_clock : string := "none";
|
||||
signb_clock : string := "none";
|
||||
TimingChecksOn : Boolean := True;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOnChecks : Boolean := DefMsgOnChecks;
|
||||
XOnChecks : Boolean := DefXOnChecks;
|
||||
InstancePath : STRING := "*";
|
||||
lpm_hint : string := "true";
|
||||
lpm_type : string := "cycloneive_mac_mult"
|
||||
);
|
||||
PORT (
|
||||
dataa : IN std_logic_vector(dataa_width-1 DOWNTO 0) := (OTHERS => '0');
|
||||
datab : IN std_logic_vector(datab_width-1 DOWNTO 0) := (OTHERS => '0');
|
||||
signa : IN std_logic := '1';
|
||||
signb : IN std_logic := '1';
|
||||
clk : IN std_logic := '0';
|
||||
aclr : IN std_logic := '0';
|
||||
ena : IN std_logic := '0';
|
||||
dataout : OUT std_logic_vector((dataa_width+datab_width)-1 DOWNTO 0);
|
||||
devclrn : IN std_logic := '1';
|
||||
devpor : IN std_logic := '1'
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_mac_out
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_mac_out
|
||||
GENERIC (
|
||||
dataa_width : integer := 1;
|
||||
output_clock : string := "none";
|
||||
TimingChecksOn : Boolean := True;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOnChecks : Boolean := DefMsgOnChecks;
|
||||
XOnChecks : Boolean := DefXOnChecks;
|
||||
InstancePath : STRING := "*";
|
||||
tipd_dataa : VitalDelayArrayType01(35 downto 0)
|
||||
:= (OTHERS => DefPropDelay01);
|
||||
tipd_clk : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_ena : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_aclr : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_dataa_dataout :VitalDelayArrayType01(36*36 -1 downto 0) :=(others => DefPropDelay01);
|
||||
tpd_aclr_dataout_posedge : VitalDelayArrayType01(35 downto 0) :=(others => DefPropDelay01);
|
||||
tpd_clk_dataout_posedge :VitalDelayArrayType01(35 downto 0) :=(others => DefPropDelay01);
|
||||
tsetup_dataa_clk_noedge_posedge : VitalDelayArrayType(35 downto 0) := (OTHERS => DefSetupHoldCnst);
|
||||
thold_dataa_clk_noedge_posedge : VitalDelayArrayType(35 downto 0) := (OTHERS => DefSetupHoldCnst);
|
||||
tsetup_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
thold_ena_clk_noedge_posedge : VitalDelayType := DefSetupHoldCnst;
|
||||
lpm_hint : string := "true";
|
||||
lpm_type : string := "cycloneive_mac_out");
|
||||
PORT (
|
||||
dataa : IN std_logic_vector(dataa_width-1 DOWNTO 0) := (OTHERS => '0');
|
||||
clk : IN std_logic := '0';
|
||||
aclr : IN std_logic := '0';
|
||||
ena : IN std_logic := '1';
|
||||
dataout : OUT std_logic_vector(dataa_width-1 DOWNTO 0);
|
||||
devclrn : IN std_logic := '1';
|
||||
devpor : IN std_logic := '1'
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_io_ibuf
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_io_ibuf
|
||||
GENERIC (
|
||||
tipd_i : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_ibar : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_i_o : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_ibar_o : VitalDelayType01 := DefPropDelay01;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
differential_mode : string := "false";
|
||||
bus_hold : string := "false";
|
||||
simulate_z_as : string := "Z";
|
||||
lpm_type : string := "cycloneive_io_ibuf"
|
||||
);
|
||||
PORT (
|
||||
i : IN std_logic := '0';
|
||||
ibar : IN std_logic := '0';
|
||||
o : OUT std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_io_obuf
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_io_obuf
|
||||
GENERIC (
|
||||
tipd_i : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_oe : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_seriesterminationcontrol : VitalDelayArrayType01(15 DOWNTO 0) := (others => DefPropDelay01 );
|
||||
tpd_i_o : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_oe_o : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_i_obar : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_oe_obar : VitalDelayType01 := DefPropDelay01;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
open_drain_output : string := "false";
|
||||
bus_hold : string := "false";
|
||||
lpm_type : string := "cycloneive_io_obuf"
|
||||
);
|
||||
PORT (
|
||||
i : IN std_logic := '0';
|
||||
oe : IN std_logic := '1';
|
||||
seriesterminationcontrol : IN std_logic_vector(15 DOWNTO 0) := (others => '0');
|
||||
devoe : IN std_logic := '1';
|
||||
o : OUT std_logic;
|
||||
obar : OUT std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_ddio_oe
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_ddio_oe
|
||||
generic(
|
||||
tipd_oe : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clk : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_ena : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_areset : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_sreset : VitalDelayType01 := DefPropDelay01;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
power_up : string := "low";
|
||||
async_mode : string := "none";
|
||||
sync_mode : string := "none";
|
||||
lpm_type : string := "cycloneive_ddio_oe"
|
||||
);
|
||||
PORT (
|
||||
oe : IN std_logic := '1';
|
||||
clk : IN std_logic := '0';
|
||||
ena : IN std_logic := '1';
|
||||
areset : IN std_logic := '0';
|
||||
sreset : IN std_logic := '0';
|
||||
dataout : OUT std_logic;
|
||||
dfflo : OUT std_logic;
|
||||
dffhi : OUT std_logic;
|
||||
devclrn : IN std_logic := '1';
|
||||
devpor : IN std_logic := '1'
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_ddio_out
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_ddio_out
|
||||
generic(
|
||||
tipd_datainlo : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_datainhi : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clk : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clkhi : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_clklo : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_muxsel : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_ena : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_areset : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_sreset : VitalDelayType01 := DefPropDelay01;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
power_up : string := "low";
|
||||
async_mode : string := "none";
|
||||
sync_mode : string := "none";
|
||||
use_new_clocking_model : string := "false";
|
||||
lpm_type : string := "cycloneive_ddio_out"
|
||||
);
|
||||
PORT (
|
||||
datainlo : IN std_logic := '0';
|
||||
datainhi : IN std_logic := '0';
|
||||
clk : IN std_logic := '0';
|
||||
clkhi : IN std_logic := '0';
|
||||
clklo : IN std_logic := '0';
|
||||
muxsel : IN std_logic := '0';
|
||||
ena : IN std_logic := '1';
|
||||
areset : IN std_logic := '0';
|
||||
sreset : IN std_logic := '0';
|
||||
dataout : OUT std_logic;
|
||||
dfflo : OUT std_logic;
|
||||
dffhi : OUT std_logic ;
|
||||
devclrn : IN std_logic := '1';
|
||||
devpor : IN std_logic := '1'
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_pseudo_diff_out
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_pseudo_diff_out
|
||||
GENERIC (
|
||||
tipd_i : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_i_o : VitalDelayType01 := DefPropDelay01;
|
||||
tpd_i_obar : VitalDelayType01 := DefPropDelay01;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
lpm_type : string := "cycloneive_pseudo_diff_out"
|
||||
);
|
||||
PORT (
|
||||
i : IN std_logic := '0';
|
||||
o : OUT std_logic;
|
||||
obar : OUT std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_io_pad
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_io_pad
|
||||
GENERIC (
|
||||
lpm_type : string := "cycloneive_io_pad");
|
||||
PORT (
|
||||
padin : IN std_logic := '0'; -- Input Pad
|
||||
padout : OUT std_logic); -- Output Pad
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_asmiblock
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_asmiblock
|
||||
generic (
|
||||
lpm_type : string := "cycloneive_asmiblock";
|
||||
enable_sim : string := "false"
|
||||
);
|
||||
port (
|
||||
dclkin : in std_logic;
|
||||
scein : in std_logic;
|
||||
oe : in std_logic;
|
||||
sdoin : in std_logic;
|
||||
data0out: out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_clkctrl
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_clkctrl
|
||||
generic (
|
||||
clock_type : STRING := "Auto";
|
||||
lpm_type : STRING := "cycloneive_clkctrl";
|
||||
ena_register_mode : STRING := "Falling Edge";
|
||||
TimingChecksOn : Boolean := True;
|
||||
MsgOn : Boolean := DefGlitchMsgOn;
|
||||
XOn : Boolean := DefGlitchXOn;
|
||||
MsgOnChecks : Boolean := DefMsgOnChecks;
|
||||
XOnChecks : Boolean := DefXOnChecks;
|
||||
InstancePath : STRING := "*";
|
||||
tpd_inclk_outclk : VitalDelayArrayType01(3 downto 0) := (OTHERS => DefPropDelay01);
|
||||
tipd_inclk : VitalDelayArrayType01(3 downto 0) := (OTHERS => DefPropDelay01);
|
||||
tipd_clkselect : VitalDelayArrayType01(1 downto 0) := (OTHERS => DefPropDelay01);
|
||||
tipd_ena : VitalDelayType01 := DefPropDelay01
|
||||
);
|
||||
port (
|
||||
inclk : in std_logic_vector(3 downto 0) := "0000";
|
||||
clkselect : in std_logic_vector(1 downto 0) := "00";
|
||||
ena : in std_logic := '1';
|
||||
devclrn : in std_logic := '1';
|
||||
devpor : in std_logic := '1';
|
||||
outclk : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_rublock
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_rublock
|
||||
generic
|
||||
(
|
||||
sim_init_config : string := "factory";
|
||||
sim_init_watchdog_value : integer := 0;
|
||||
sim_init_status : integer := 0;
|
||||
lpm_type : string := "cycloneive_rublock"
|
||||
);
|
||||
port
|
||||
(
|
||||
clk : in std_logic;
|
||||
shiftnld : in std_logic;
|
||||
captnupdt : in std_logic;
|
||||
regin : in std_logic;
|
||||
rsttimer : in std_logic;
|
||||
rconfig : in std_logic;
|
||||
regout : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_apfcontroller
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_apfcontroller
|
||||
generic
|
||||
(
|
||||
lpm_type: string := "cycloneive_apfcontroller"
|
||||
);
|
||||
port
|
||||
(
|
||||
usermode : out std_logic;
|
||||
nceout : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_termination
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_termination
|
||||
GENERIC (
|
||||
pullup_control_to_core: string := "false";
|
||||
power_down : string := "true";
|
||||
test_mode : string := "false";
|
||||
left_shift_termination_code : string := "false";
|
||||
pullup_adder : integer := 0;
|
||||
pulldown_adder : integer := 0;
|
||||
clock_divide_by : integer := 32; -- 1, 4, 32
|
||||
runtime_control : string := "false";
|
||||
shift_vref_rup : string := "true";
|
||||
shift_vref_rdn : string := "true";
|
||||
shifted_vref_control : string := "true";
|
||||
lpm_type : string := "cycloneive_termination");
|
||||
PORT (
|
||||
rup : IN std_logic := '0';
|
||||
rdn : IN std_logic := '0';
|
||||
terminationclock : IN std_logic := '0';
|
||||
terminationclear : IN std_logic := '0';
|
||||
devpor : IN std_logic := '1';
|
||||
devclrn : IN std_logic := '1';
|
||||
comparatorprobe : OUT std_logic;
|
||||
terminationcontrolprobe : OUT std_logic;
|
||||
calibrationdone : OUT std_logic;
|
||||
terminationcontrol : OUT std_logic_vector(15 DOWNTO 0));
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_jtag
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_jtag
|
||||
generic (
|
||||
lpm_type : string := "cycloneive_jtag"
|
||||
);
|
||||
port (
|
||||
tms : in std_logic := '0';
|
||||
tck : in std_logic := '0';
|
||||
tdi : in std_logic := '0';
|
||||
tdoutap : in std_logic := '0';
|
||||
tdouser : in std_logic := '0';
|
||||
tdo: out std_logic;
|
||||
tmsutap: out std_logic;
|
||||
tckutap: out std_logic;
|
||||
tdiutap: out std_logic;
|
||||
shiftuser: out std_logic;
|
||||
clkdruser: out std_logic;
|
||||
updateuser: out std_logic;
|
||||
runidleuser: out std_logic;
|
||||
usr1user: out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_crcblock
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_crcblock
|
||||
generic (
|
||||
oscillator_divider : integer := 1;
|
||||
lpm_type : string := "cycloneive_crcblock"
|
||||
);
|
||||
port (
|
||||
clk : in std_logic := '0';
|
||||
shiftnld : in std_logic := '0';
|
||||
ldsrc : in std_logic := '0';
|
||||
crcerror : out std_logic;
|
||||
regout : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
--
|
||||
-- cycloneive_oscillator
|
||||
--
|
||||
|
||||
COMPONENT cycloneive_oscillator
|
||||
generic
|
||||
(
|
||||
lpm_type: string := "cycloneive_oscillator";
|
||||
TimingChecksOn: Boolean := True;
|
||||
XOn: Boolean := DefGlitchXOn;
|
||||
MsgOn: Boolean := DefGlitchMsgOn;
|
||||
tpd_oscena_clkout_posedge : VitalDelayType01 := DefPropDelay01;
|
||||
tipd_oscena : VitalDelayType01 := DefPropDelay01
|
||||
);
|
||||
port
|
||||
(
|
||||
oscena : in std_logic;
|
||||
clkout : out std_logic
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
end cycloneive_components;
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,34 @@
|
||||
|
||||
|
||||
if {![file exists build]} {mkdir build}
|
||||
cd build
|
||||
if {![file exists altera]} {mkdir altera}
|
||||
cd altera
|
||||
|
||||
if {[file exists altera]} {vdel -lib altera -all}
|
||||
|
||||
vlib altera
|
||||
vcom -93 -work altera ../../altera/libsrc/altera/altera_primitives_components.vhd
|
||||
vcom -93 -work altera ../../altera/libsrc/altera/altera_primitives.vhd
|
||||
vcom -93 -work altera ../../altera/libsrc/altera/altera_internal_syn.vhd
|
||||
vcom -93 -work altera ../../altera/libsrc/altera/altera_europa_support_lib.vhd
|
||||
vcom -93 -work altera ../../altera/libsrc/altera/altera_standard_functions.vhd
|
||||
vcom -93 -work altera ../../altera/libsrc/altera/altera_syn_attributes.vhd
|
||||
|
||||
vlib altera_mf
|
||||
vcom -93 -work altera_mf ../../altera/libsrc/altera_mf/altera_mf_components.vhd
|
||||
vcom -93 -work altera_mf ../../altera/libsrc/altera_mf/altera_mf.vhd
|
||||
|
||||
vlib cycloneive
|
||||
vcom -93 -work cycloneive ../../altera/libsrc/cycloneive/cycloneive_atoms.vhd
|
||||
vcom -93 -work cycloneive ../../altera/libsrc/cycloneive/cycloneive_components.vhd
|
||||
|
||||
vlib altera_lnsim
|
||||
vcom -93 -work altera_lnsim ../../altera/libsrc/altera_lnsim/altera_lnsim_components.vhd
|
||||
|
||||
vlib cyclonev
|
||||
vcom -93 -work cyclonev ../../altera/libsrc/cyclonev/cyclonev_atoms.vhd
|
||||
vcom -93 -work cyclonev ../../altera/libsrc/cyclonev/cyclonev_components.vhd
|
||||
|
||||
cd ..
|
||||
cd ..
|
||||
@@ -0,0 +1,22 @@
|
||||
#
|
||||
# Compile script for Modeltech
|
||||
#
|
||||
|
||||
if {![file exists build]} {mkdir build}
|
||||
cd build
|
||||
|
||||
if {![file exists modelsim]} {mkdir modelsim}
|
||||
cd modelsim
|
||||
|
||||
if {[file exists modelsim]} {vdel -lib modelsim -all}
|
||||
|
||||
vlib ieee_proposed
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/standard_additions_c.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/standard_textio_additions_c.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/env_c.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/std_logic_1164_additions.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/numeric_std_additions.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/numeric_std_unsigned_c.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/fixed_float_types_c.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/fixed_pkg_c.vhdl
|
||||
vcom -work ieee_proposed ../../ieee_proposed/modelsim/float_pkg_c.vhdl
|
||||
@@ -1,6 +1,7 @@
|
||||
vlib simprim
|
||||
vlib build
|
||||
vlib build/xilinx
|
||||
|
||||
set XILINX C:/Programme/Xilinx101/ISE
|
||||
vlib build/xilinx/simprim
|
||||
|
||||
vcom -93 -work simprim $XILINX/vhdl/src/simprims/simprim_Vcomponents_mti.vhd
|
||||
vcom -93 -work simprim $XILINX/vhdl/src/simprims/simprim_Vpackage_mti.vhd
|
||||
|
||||
@@ -1,8 +1,15 @@
|
||||
if {![file exists build]} {mkdir build}
|
||||
cd build
|
||||
if {![file exists xilinx]} {mkdir xilinx}
|
||||
cd xilinx
|
||||
|
||||
if {[file exists unisim]} {vdel -lib unisim -all}
|
||||
vlib unisim
|
||||
|
||||
set XILINX C:/Programme/Xilinx101/ISE
|
||||
vcom -93 -work unisim ../../xilinx/libsrc/unisims/unisim_vpkg.vhd
|
||||
vcom -93 -work unisim ../../xilinx/libsrc/unisims/unisim_vcomp.vhd
|
||||
vcom -93 -work unisim ../../xilinx/libsrc/unisims/unisim_smodel.vhd
|
||||
vcom -93 -work unisim ../../xilinx/libsrc/unisims/unisim_vital.vhd
|
||||
|
||||
vcom -93 -work unisim $XILINX/vhdl/src/unisims/unisim_vpkg.vhd
|
||||
vcom -93 -work unisim $XILINX/vhdl/src/unisims/unisim_vcomp.vhd
|
||||
vcom -93 -work unisim $XILINX/vhdl/src/unisims/unisim_smodel.vhd
|
||||
vcom -93 -work unisim $XILINX/vhdl/src/unisims/unisim_vital.vhd
|
||||
cd ..
|
||||
cd ..
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# -------------------------------------------------
|
||||
# Compile script for GHDL
|
||||
# -------------------------------------------------
|
||||
include ../make/defs.mk
|
||||
|
||||
# -------------------------------------------------
|
||||
# Global options
|
||||
# -------------------------------------------------
|
||||
LANG_STD := 93c
|
||||
IEEE_STD := standard
|
||||
WORK_LIB := ieee_proposed
|
||||
TARGET := ieee_proposed
|
||||
|
||||
# -------------------------------------------------
|
||||
# Target options
|
||||
# -------------------------------------------------
|
||||
SRCS := $(LIB_PATH)/standard_additions_c.vhdl
|
||||
SRCS += $(LIB_PATH)/standard_textio_additions_c.vhdl
|
||||
SRCS += $(LIB_PATH)/env_c.vhdl
|
||||
SRCS += $(LIB_PATH)/std_logic_1164_additions.vhdl
|
||||
SRCS += $(LIB_PATH)/numeric_std_additions.vhdl
|
||||
SRCS += $(LIB_PATH)/numeric_std_unsigned_c.vhdl
|
||||
SRCS += $(LIB_PATH)/fixed_float_types_c.vhdl
|
||||
SRCS += $(LIB_PATH)/fixed_pkg_c.vhdl
|
||||
SRCS += $(LIB_PATH)/float_pkg_c.vhdl
|
||||
|
||||
include ../make/ghdl.mk
|
||||
|
||||
@@ -0,0 +1,173 @@
|
||||
|
||||
This is the "ieee_proposed" library. This is a compatability library,
|
||||
which is designed to provide all of the functionality of the VHDL-200X-FT
|
||||
packages in VHDL-93. The "_c" after the package name is used to denote
|
||||
that this is a 1993 compliant version of this package. Otherwise, the
|
||||
name of the file and the name of the package are the same.
|
||||
|
||||
Please compile the following files into a library named "ieee_proposed":
|
||||
standard_additions_c.vhdl
|
||||
env_c.vhdl
|
||||
standard_textio_additions_c.vhdl
|
||||
std_logic_1164_additions.vhdl
|
||||
numeric_std_additions.vhdl
|
||||
numeric_std_unsigned_c.vhdl
|
||||
fixed_pkg_c.vhdl
|
||||
float_pkg_c.vhdl
|
||||
|
||||
|
||||
New/Updated functions
|
||||
A) standard_additions -- Additions to the package "std.standard"
|
||||
Use model:
|
||||
use ieee_proposed.standard_additions.all;
|
||||
Dependancies: None.
|
||||
Notes: The functions "rising_edge" and "falling_edge" are defined in
|
||||
this package. If you use "numeric_bit" they are ALSO defined in that
|
||||
package, causing a conflict. The VHDL-200X-FT version of numeric_bit
|
||||
has these functions commented out, as well as the "sll", "srl", "ror"
|
||||
and "rol" functions which are implicit.
|
||||
New types defined in this package:
|
||||
REAL_VECTOR
|
||||
TIME_VECTOR
|
||||
INTEGER_VECTOR
|
||||
BOOLEAN_VECTOR
|
||||
New constants defined in this package:
|
||||
SIM_RESOLUTION : TIME - returns the simulator's resolution (1 ns default)
|
||||
1) "maximum" and "minimum" are defined for all default datatypes
|
||||
2) _reduce functions (and_reduce, nand_reduce, or_reduce ...) are defined
|
||||
These functions reduce a bit_vector to a single bit. Example:
|
||||
or_reduce ("0101") = '1'. In VHDL-2006 syntax these will be "or".
|
||||
3) "vector" and "bit" operations are defined. These will perform a
|
||||
boolean operation of a vector. Example:
|
||||
"1" xor "1010" = "0101";
|
||||
5) /??/ function is defined for "bit" ("??" operator is release)
|
||||
if (/??/('1')) then -- will return a "true".
|
||||
6) rising_edge and falling_edge functions are defined (see Notes).
|
||||
7) to_string function - Converts any of the base types into a string.
|
||||
Example:
|
||||
assert (bv = "101") report "result was " & to_string(bv) severity note;
|
||||
8) to_hstring and to_ostring function (bit_vector to hex or octal string)
|
||||
B) standard_textio_additions - Additions to the package "std.textio"
|
||||
Use model:
|
||||
use ieee_proposed.standard_textio_additions.all;
|
||||
Dependencies: std.textio, ieee_proposed.standard_additions
|
||||
1) tee - Echos the string to BOTH the file and the screen
|
||||
2) SREAD and SWRITE - String read and write routines (so you no longer
|
||||
need to do write (L, string'("ABCEDFG"));
|
||||
3) HREAD and HWRITE (Hex read and write) for bit_vector
|
||||
4) OREAD and OWRITE (octal read and write) for bit_vector
|
||||
5) BREAD and BWRITE (binary read and write, same as "READ" and "WRITE" for
|
||||
bit_vector
|
||||
6) justify - Justify a string left or right with a width. Example:
|
||||
justify ("ABCD", left, 6); will result in "ABCD "
|
||||
C) std_logic_1164_additions - Additions to the package "ieee.std_logic_1164"
|
||||
Usage model:
|
||||
use ieee.std_logic_1164.all;
|
||||
-- use ieee.std_logic_textio.all; -- Comment out, included in "_additions".
|
||||
use ieee_proposed.std_logic_1164_additions.all;
|
||||
Dependencies: ieee.std_logic_1164
|
||||
Note: The contents of the "std_logic_textio" package have now been
|
||||
included in the "std_logic_1164" package, and an EMPTY "std_logic_textio"
|
||||
package is provided in the new release.
|
||||
1) Short had aliases:
|
||||
a) to_bv - calls "to_BitVector"
|
||||
b) to_slv - calls "to_StdLogicVector"
|
||||
c) to_sulv - calls "to_stdULogicVector"
|
||||
2) Long hand aliases:
|
||||
a) to_bit_vector - calls "to_BitVector"
|
||||
b) to_std_logic_vector - calls "to_StdLogicVector"
|
||||
c) to_std_ulogic_vector - calls "to_StdULogicVector"
|
||||
3) _reduce functions (and_reduce, nand_reduce, or_reduce ...) are defined
|
||||
These functions reduce a std_logic_vector (or ulogic) to a single bit.
|
||||
In vhdl-2006 these will be unary "or", example "or "11011" = '1'"
|
||||
4) "vector" and "std_ulogic" operations are defined. These will perform a
|
||||
boolean operation of a vector. Example:
|
||||
"1" xor "1010" = "0101";
|
||||
5) "std_ulogic" and "boolean" operations are defined. Thus:
|
||||
if '1' and true then -- returns a "true".
|
||||
6) "\??\" function is defined for "std_ulogic" ("??" operator is release)
|
||||
if (bool('1')) then -- will return a "true".
|
||||
7) READ and WRITE procedures for "std_logic_vector", "std_ulogic_vector"
|
||||
and "std_ulogic" are defined.
|
||||
8) HREAD and HWRITE (Hex read and write) for std_logic_vector
|
||||
and std_ulogic_vector. These are more "forgiving" than the ones
|
||||
originally from "std_logic_textio"
|
||||
9) OREAD and OWRITE (octal read and write) for std_logic_vector
|
||||
and std_ulogic_vector. These are more "forgiving" than the ones
|
||||
originally from "std_logic_textio"
|
||||
10) BREAD and BWRITE (binary read and write, same as "READ" and "WRITE" for
|
||||
std_logic_vector and std_ulogic_vector.
|
||||
11) to_string function - Converts a "std_ulogic", "std_logic_vector" or
|
||||
"std_ulogic_vector" types into a string.
|
||||
Example:
|
||||
assert (slv = "101") report "result was " & to_string(slv) severity note;
|
||||
12) to_hstring and to_ostring function (std_(u)logic_vector to hex or octal
|
||||
string)
|
||||
D) numeric_std_additions - additions the the package "ieee.numeric_std"
|
||||
Usage Model:
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee_proposed.numeric_std_additions.all;
|
||||
Dependencies: ieee.std_logic_1164, ieee.numeric_std
|
||||
1) SIGNED or UNSIGNED + std_ulogic operators
|
||||
2) SIGNED or UNSIGNED - std_ulogic operators
|
||||
3) type UNRESOLVED_UNSIGNED (aliased to U_UNSIGNED) is an unresolved
|
||||
verion of UNSIGNED. It is aliased to "UNSIGNED" for compatability.
|
||||
4) type UNRESOLVED_SIGNED (aliased to U_SIGNED) is an unresolved
|
||||
verion of SIGNED. It is aliased to "SIGNED" for compatability.
|
||||
5) \?=\, \?/=\ - similar to "std_match", but return std_ulogic values.
|
||||
\?<\, \?<=\, \?>\, \?>=\ - compare functions which retrun std_ulogic.
|
||||
(these will be "?="... operators in the release)
|
||||
7) To_X01, To_X01Z, To_U01X, Is_X - same as std_logic_1164 functions,
|
||||
but overloaded for SIGNED and UNSIGNED.
|
||||
8) "sla" and "sra" - Mathmetically correct versions of these functions.
|
||||
9) minimum and maximum - smaller or larger of two SIGNED or UNSIGNED values.
|
||||
10) find_rightmost and find_leftmost - finds the first bit in a string.
|
||||
Example:
|
||||
find_leftmost (c12, '1'); -- returns the Log2 of "c12".
|
||||
returns -1 if not found.
|
||||
11) _reduce functions (and_reduce, nand_reduce, or_reduce ...) are defined
|
||||
These functions reduce a SIGNED or an UNSIGNED to a single bit.
|
||||
(will overload the "or" and "and", ... operators in the release)
|
||||
12) SIGNED or UNSIGNED and "std_ulogic" operations are defined.
|
||||
These will perform a boolean operation of a vector. Example:
|
||||
"1" xor "1010" = "0101";
|
||||
13) READ and WRITE procedures for "SIGNED", and "UNSIGNED" are defined.
|
||||
14) HREAD and HWRITE (Hex read and write) for SIGNED and UNSIGNED.
|
||||
These are more "forgiving" than the ones
|
||||
originally from "std_logic_textio"
|
||||
15) OREAD and OWRITE (octal read and write) for "SIGNED" and "UNSIGNED.
|
||||
These are more "forgiving" than the ones
|
||||
originally from "std_logic_textio"
|
||||
16) BREAD and BWRITE (binary read and write, same as "READ" and "WRITE" for
|
||||
SIGNED and UNSIGNED.
|
||||
17) to_string function - Converts a "SIGNED" or "UNSIGNED" types into a
|
||||
string. Example:
|
||||
assert (UNS = "101") report "result was " & to_string(UNS) severity note;
|
||||
18) to_hstring and to_ostring function (SIGNED or UNSIGNED to hex or octal
|
||||
string)
|
||||
E) numeric_std_unsigned - Simular to the "std_logic_unsigned" packages, but
|
||||
with all of the functionality of the "numeric_std" package.
|
||||
use model:
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee_proposed.numeric_std_unsigned.all;
|
||||
dependencies: ieee.numeric_std, ieee_proposed.numeric_std_additions
|
||||
|
||||
F) For fixed point package:
|
||||
use model:
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee_proposed.fixed_float_types.all;
|
||||
use ieee_proposed.fixed_pkg.all;
|
||||
See fixed point package documentation
|
||||
http://www.vhdl.org/vhdl-200x/vhdl-200x-ft/packages/Fixed_ug.pdf
|
||||
|
||||
G) For floating point package:
|
||||
use model:
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee_proposed.fixed_float_types.all;
|
||||
use ieee_proposed.fixed_pkg.all;
|
||||
use ieee_proposed.float_pkg.all;
|
||||
See floating point package documentation
|
||||
http://www.vhdl.org/vhdl-200x/vhdl-200x-ft/packages/Float_ug.pdf
|
||||
@@ -0,0 +1,14 @@
|
||||
#
|
||||
# Compile script for Modeltech
|
||||
#
|
||||
vlib ieee_proposed.lib
|
||||
vmap ieee_proposed ieee_proposed.lib
|
||||
vcom -work ieee_proposed standard_additions_c.vhdl
|
||||
vcom -work ieee_proposed standard_textio_additions_c.vhdl
|
||||
vcom -work ieee_proposed env_c.vhdl
|
||||
vcom -work ieee_proposed std_logic_1164_additions.vhdl
|
||||
vcom -work ieee_proposed numeric_std_additions.vhdl
|
||||
vcom -work ieee_proposed numeric_std_unsigned_c.vhdl
|
||||
vcom -work ieee_proposed fixed_float_types_c.vhdl
|
||||
vcom -work ieee_proposed fixed_pkg_c.vhdl
|
||||
vcom -work ieee_proposed float_pkg_c.vhdl
|
||||
@@ -0,0 +1,48 @@
|
||||
package ENV is
|
||||
|
||||
procedure STOP (STATUS : INTEGER);
|
||||
procedure FINISH (STATUS : INTEGER);
|
||||
|
||||
function RESOLUTION_LIMIT return DELAY_LENGTH;
|
||||
|
||||
end package ENV;
|
||||
library ieee_proposed;
|
||||
use ieee_proposed.standard_additions.all;
|
||||
package body ENV is
|
||||
|
||||
procedure STOP (STATUS : INTEGER) is
|
||||
begin
|
||||
report "Procedure STOP called with status: " & INTEGER'image(STATUS)
|
||||
severity failure;
|
||||
end procedure STOP;
|
||||
procedure FINISH (STATUS : INTEGER) is
|
||||
begin
|
||||
report "Procedure FINISH called with status: " & INTEGER'image(STATUS)
|
||||
severity failure;
|
||||
end procedure FINISH;
|
||||
|
||||
constant BASE_TIME_ARRAY : time_vector :=
|
||||
(
|
||||
1 fs, 10 fs, 100 fs,
|
||||
1 ps, 10 ps, 100 ps,
|
||||
1 ns, 10 ns, 100 ns,
|
||||
1 us, 10 us, 100 us,
|
||||
1 ms, 10 ms, 100 ms,
|
||||
1 sec, 10 sec, 100 sec,
|
||||
1 min, 10 min, 100 min,
|
||||
1 hr, 10 hr, 100 hr
|
||||
) ;
|
||||
|
||||
function RESOLUTION_LIMIT return DELAY_LENGTH is
|
||||
begin
|
||||
for i in BASE_TIME_ARRAY'range loop
|
||||
if BASE_TIME_ARRAY(i) > 0 hr then
|
||||
return BASE_TIME_ARRAY(i);
|
||||
end if;
|
||||
end loop;
|
||||
report "STANDATD.RESOLUTION_LIMIT: Simulator resolution not less than 100 hr"
|
||||
severity failure;
|
||||
return 1 ns;
|
||||
end function RESOLUTION_LIMIT;
|
||||
|
||||
end package body ENV;
|
||||
@@ -0,0 +1,34 @@
|
||||
-- --------------------------------------------------------------------
|
||||
-- "fixed_float_types" package contains types used in the fixed and floating
|
||||
-- point packages..
|
||||
-- Please see the documentation for the floating point package.
|
||||
-- This package should be compiled into "ieee_proposed" and used as follows:
|
||||
--
|
||||
-- This verison is designed to work with the VHDL-93 compilers. Please
|
||||
-- note the "%%%" comments. These are where we diverge from the
|
||||
-- VHDL-200X LRM.
|
||||
--
|
||||
-- --------------------------------------------------------------------
|
||||
-- Version : $Revision: 1.1 $
|
||||
-- Date : $Date: 2010/09/22 18:44:20 $
|
||||
-- --------------------------------------------------------------------
|
||||
|
||||
package fixed_float_types is
|
||||
|
||||
-- Types used for generics of fixed_generic_pkg
|
||||
|
||||
type fixed_round_style_type is (fixed_round, fixed_truncate);
|
||||
|
||||
type fixed_overflow_style_type is (fixed_saturate, fixed_wrap);
|
||||
|
||||
-- Type used for generics of float_generic_pkg
|
||||
|
||||
-- These are the same as the C FE_TONEAREST, FE_UPWARD, FE_DOWNWARD,
|
||||
-- and FE_TOWARDZERO floating point rounding macros.
|
||||
|
||||
type round_type is (round_nearest, -- Default, nearest LSB '0'
|
||||
round_inf, -- Round toward positive infinity
|
||||
round_neginf, -- Round toward negative infinity
|
||||
round_zero); -- Round toward zero (truncate)
|
||||
|
||||
end package fixed_float_types;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,736 @@
|
||||
-- Synthesis test for the fixed point math package
|
||||
-- This test is designed to be synthesizable and exercise much of the package.
|
||||
-- Created for vhdl-200x by David Bishop (dbishop@vhdl.org)
|
||||
-- --------------------------------------------------------------------
|
||||
-- modification history : Last Modified $Date: 2006-06-08 10:49:35-04 $
|
||||
-- Version $Id: fixed_synth.vhdl,v 1.1 2006-06-08 10:49:35-04 l435385 Exp $
|
||||
-- --------------------------------------------------------------------
|
||||
|
||||
|
||||
library ieee, ieee_proposed;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee_proposed.fixed_float_types.all;
|
||||
use ieee_proposed.fixed_pkg.all;
|
||||
entity fixed_synth is
|
||||
|
||||
port (
|
||||
in1, in2 : in STD_LOGIC_VECTOR (15 downto 0); -- inputs
|
||||
out1 : out STD_LOGIC_VECTOR (15 downto 0); -- output
|
||||
cmd : in STD_LOGIC_VECTOR (3 downto 0);
|
||||
clk, rst_n : in STD_ULOGIC); -- clk and reset
|
||||
|
||||
end entity fixed_synth;
|
||||
|
||||
architecture rtl of fixed_synth is
|
||||
|
||||
subtype sfixed7 is sfixed (3 downto -3); -- 7 bit
|
||||
subtype sfixed16 is sfixed (7 downto -8); -- 16 bit
|
||||
type cmd_type is array (1 to 15) of STD_ULOGIC_VECTOR (cmd'range); -- cmd
|
||||
signal cmdarray : cmd_type; -- command pipeline
|
||||
type cry_type is array (0 to 4) of sfixed16; -- arrays
|
||||
signal outarray0, outarray1, outarray2, outarray3, outarray4,
|
||||
outarray5, outarray6, outarray7, outarray8, outarray9, outarray10,
|
||||
outarray11, outarray12, outarray13, outarray14, outarray15 : sfixed16;
|
||||
signal in1reg3, in2reg3 : sfixed16; -- register stages
|
||||
begin -- architecture rtl
|
||||
|
||||
-- purpose: "0000" test the "+" operator
|
||||
cmd0reg : process (clk, rst_n) is
|
||||
variable in1pin2 : sfixed (SFixed_high(7, -8, '+', 7, -8) downto
|
||||
SFixed_low(7, -8, '+', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray0 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray0 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
in1pin2 := in1array(3) + in2array(3);
|
||||
outarray(0) := resize (in1pin2, outarray(0));
|
||||
end if;
|
||||
end process cmd0reg;
|
||||
|
||||
-- purpose: "0001" test the "-" operator
|
||||
cmd1reg : process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
variable in1min2 : sfixed (SFixed_high(in1array(0), '-', in2array(0)) downto
|
||||
SFixed_low(in1array(0), '-', in2array(0)));
|
||||
-- variable in1min2 : sfixed (SFixed_high(7, -8, '-', 7, -8) downto
|
||||
-- SFixed_low(7, -8, '-', 7, -8));
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray1 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray1 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
in1min2 := in1array(3) - in2array(3);
|
||||
outarray(0) := resize (in1min2, outarray(0));
|
||||
end if;
|
||||
end process cmd1reg;
|
||||
|
||||
-- purpose: "0010" test the "*" operator
|
||||
cmd2reg : process (clk, rst_n) is
|
||||
-- variable in1min2 : sfixed (SFixed_high(in1reg3, '*', in2reg3) downto
|
||||
-- SFixed_low(in1reg3, '*', in2reg3));
|
||||
variable in1min2 : sfixed (SFixed_high(7, -8, '*', 7, -8) downto
|
||||
SFixed_low(7, -8, '*', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray2 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray2 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
in1min2 := in1array(3) * in2array(3);
|
||||
outarray(0) := resize (in1min2, outarray(0));
|
||||
end if;
|
||||
end process cmd2reg;
|
||||
|
||||
-- purpose: "0011" test the "/" operator
|
||||
cmd3reg : process (clk, rst_n) is
|
||||
variable in1min2 : sfixed (SFixed_high(in1reg3'high, in1reg3'low,
|
||||
'/', in2reg3'high, in2reg3'low)
|
||||
downto
|
||||
SFixed_low(in1reg3'high, in1reg3'low,
|
||||
'/', in2reg3'high, in2reg3'low));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd3reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray3 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := to_sfixed(1, in2array(0));
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray3 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
if (in2reg3 = 0) then
|
||||
in2array(0) := to_sfixed(1, in2array(0));
|
||||
else
|
||||
in2array(0) := in2reg3;
|
||||
end if;
|
||||
in1min2 := in1array(3) / in2array(3);
|
||||
outarray(0) := resize (in1min2, outarray(0));
|
||||
end if;
|
||||
end process cmd3reg;
|
||||
|
||||
-- purpose: "0100" test the "+" operator
|
||||
cmd4reg : process (clk, rst_n) is
|
||||
variable in1pin2 : ufixed (uFixed_high(7, -8, '+', 7, -8) downto
|
||||
uFixed_low(7, -8, '+', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray4 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray4 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
in1pin2 := ufixed(in1array(3)) + ufixed(in2array(3));
|
||||
outarray(0) := sfixed (resize (in1pin2, outarray4'high, outarray4'low));
|
||||
end if;
|
||||
end process cmd4reg;
|
||||
|
||||
-- purpose: "0101" test the "-" operator
|
||||
cmd5reg : process (clk, rst_n) is
|
||||
variable in1min2 : ufixed (uFixed_high(7, -8, '-', 7, -8) downto
|
||||
uFixed_low(7, -8, '-', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray5 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray5 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
in1min2 := ufixed(in1array(3)) - ufixed(in2array(3));
|
||||
outarray(0) := sfixed(resize (in1min2, outarray5'high, outarray5'low));
|
||||
end if;
|
||||
end process cmd5reg;
|
||||
|
||||
-- purpose: "0110" test the "*" operator
|
||||
cmd6reg : process (clk, rst_n) is
|
||||
variable in1min2 : ufixed (uFixed_high(7, -8, '*', 7, -8) downto
|
||||
uFixed_low(7, -8, '*', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray6 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray6 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
in1min2 := ufixed(in1array(3)) * ufixed(in2array(3));
|
||||
outarray(0) := sfixed(resize (in1min2, outarray6'high, outarray6'low));
|
||||
end if;
|
||||
end process cmd6reg;
|
||||
|
||||
-- purpose: "0111" test the "/" operator
|
||||
cmd7reg : process (clk, rst_n) is
|
||||
variable in1min2 : ufixed (uFixed_high(7, -8, '/', 7, -8) downto
|
||||
uFixed_low(7, -8, '/', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray7 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := sfixed(to_ufixed(1, in2reg3'high, in2reg3'low));
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray7 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
if (in2reg3 = 0) then
|
||||
in2array(0) := sfixed(to_ufixed(1, in2reg3'high, in2reg3'low));
|
||||
else
|
||||
in2array(0) := in2reg3;
|
||||
end if;
|
||||
in1min2 := ufixed(in1array(3)) / ufixed(in2array(3));
|
||||
outarray(0) := sfixed(resize (in1min2, outarray7'high, outarray7'low));
|
||||
end if;
|
||||
end process cmd7reg;
|
||||
|
||||
-- purpose: "1000" test the resize test
|
||||
cmd8reg : process (clk, rst_n) is
|
||||
variable tmpfp71, tmpfp72 : sfixed7; -- 8 bit fp number
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray8 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray8 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
-- Resize test Convert inputs into two 8 bit numbers
|
||||
tmpfp71 := resize (in1array(3), tmpfp71'high, tmpfp71'low,
|
||||
fixed_wrap, fixed_truncate);
|
||||
tmpfp72 := resize (in2array(3), tmpfp72'high, tmpfp72'low,
|
||||
fixed_saturate, fixed_round);
|
||||
outarray(0) := (others => '0');
|
||||
fx1 : for i in tmpfp71'range loop
|
||||
outarray(0)(i+4) := tmpfp71(i);
|
||||
end loop fx1;
|
||||
fx2 : for i in tmpfp72'range loop
|
||||
outarray(0)(i-4) := tmpfp72(i);
|
||||
end loop fx2;
|
||||
end if;
|
||||
end process cmd8reg;
|
||||
|
||||
-- purpose: "1001" test the to_signed/unsigned test
|
||||
cmd9reg : process (clk, rst_n) is
|
||||
variable tmp : STD_LOGIC_VECTOR (1 downto 0); -- temp
|
||||
variable tmpsig : SIGNED (7 downto 0); -- signed number
|
||||
variable tmpuns : UNSIGNED (15 downto 0); -- unsigned number
|
||||
variable tmpint : INTEGER;
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray9 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray9 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
tmp := to_slv (in2array(3)(in2reg3'high downto in2reg3'high-1));
|
||||
if (tmp = "00") then
|
||||
-- Signed to sfixed and back
|
||||
tmpsig := to_signed (in1array(3), tmpsig'length);
|
||||
outarray(0) := to_sfixed (tmpsig, outarray(0));
|
||||
elsif (tmp = "01") then
|
||||
-- unsigned to ufixed and back
|
||||
tmpuns := to_unsigned (ufixed(in1array(3)), tmpuns'length);
|
||||
outarray(0) := sfixed(to_ufixed (tmpuns, outarray(0)'high,
|
||||
outarray(0)'low));
|
||||
elsif (tmp = "10") then
|
||||
tmpint := to_integer (in1array(3));
|
||||
outarray(0) := to_sfixed (tmpint, outarray(0));
|
||||
else
|
||||
tmpint := to_integer (ufixed(in1array(3)));
|
||||
outarray(0) := sfixed(to_ufixed (tmpint, outarray(0)'high,
|
||||
outarray(0)'low));
|
||||
|
||||
end if;
|
||||
end if;
|
||||
end process cmd9reg;
|
||||
|
||||
-- purpose: "1010" test the reciprocal, abs, - test
|
||||
cmd10reg : process (clk, rst_n) is
|
||||
variable tmp : STD_LOGIC_VECTOR (1 downto 0); -- temp
|
||||
variable in1recip : sfixed (-in1reg3'low+1 downto -in1reg3'high);
|
||||
variable uin1recip : ufixed (-in1reg3'low downto -in1reg3'high-1);
|
||||
variable in1pin2 : sfixed (SFixed_high(7, -8, '+', 7, -8) downto
|
||||
SFixed_low(7, -8, '+', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray10 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := to_sfixed(1, in1reg3);
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray10 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
if (in1reg3 = 0) then
|
||||
in1array(0) := to_sfixed(1, in1reg3);
|
||||
else
|
||||
in1array(0) := in1reg3;
|
||||
end if;
|
||||
in2array(0) := in2reg3;
|
||||
tmp := to_slv (in2array(3)(in2reg3'high downto in2reg3'high-1));
|
||||
if (tmp = "00") then
|
||||
in1recip := reciprocal (in1array(3));
|
||||
outarray(0) := resize (in1recip, outarray(0)'high,
|
||||
outarray(0)'low);
|
||||
elsif (tmp = "01") then
|
||||
uin1recip := reciprocal (ufixed(in1array(3)));
|
||||
outarray(0) := sfixed(resize (uin1recip, outarray(0)'high,
|
||||
outarray(0)'low));
|
||||
elsif (tmp = "10") then
|
||||
-- abs
|
||||
in1pin2 := abs(in1array(3));
|
||||
outarray(0) := resize (in1pin2,
|
||||
outarray(0)'high,
|
||||
outarray(0)'low);
|
||||
else
|
||||
-- -
|
||||
in1pin2 := - in1array(3);
|
||||
outarray(0) := resize (in1pin2,
|
||||
outarray(0)'high,
|
||||
outarray(0)'low);
|
||||
end if;
|
||||
end if;
|
||||
end process cmd10reg;
|
||||
|
||||
-- purpose: "1011" test the mod operator
|
||||
cmd11reg : process (clk, rst_n) is
|
||||
variable in1min2 : sfixed (SFixed_high(7, -8, 'M', 7, -8) downto
|
||||
SFixed_low(7, -8, 'm', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray11 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := to_sfixed(1, in2array(0));
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray11 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
if (in2reg3 = 0) then
|
||||
in2array(0) := to_sfixed(1, in2array(0));
|
||||
else
|
||||
in2array(0) := in2reg3;
|
||||
end if;
|
||||
in1min2 := in1array(3) mod in2array(3);
|
||||
outarray(0) := resize (in1min2, outarray(0));
|
||||
end if;
|
||||
end process cmd11reg;
|
||||
|
||||
-- purpose: "1100" test the rem operator
|
||||
cmd12reg : process (clk, rst_n) is
|
||||
variable in1min2 : sfixed (SFixed_high(7, -8, 'R', 7, -8) downto
|
||||
SFixed_low(7, -8, 'r', 7, -8));
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray12 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := to_sfixed(1, in2array(0));
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray12 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
if (in2reg3 = 0) then
|
||||
in2array(0) := to_sfixed(1, in2array(0));
|
||||
else
|
||||
in2array(0) := in2reg3;
|
||||
end if;
|
||||
in1min2 := in1array(3) rem in2array(3);
|
||||
outarray(0) := resize (in1min2, outarray(0));
|
||||
end if;
|
||||
end process cmd12reg;
|
||||
|
||||
-- purpose: "1101" test the srl operator
|
||||
cmd13reg : process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray13 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray13 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
outarray(0) := in1array(3) srl to_integer(in2array(3));
|
||||
end if;
|
||||
end process cmd13reg;
|
||||
|
||||
-- purpose: "1110" test the sra operator
|
||||
cmd14reg : process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray14 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray14 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
outarray(0) := in1array(3) sra to_integer(in2array(3));
|
||||
end if;
|
||||
end process cmd14reg;
|
||||
|
||||
-- purpose: "1111" test the sra operator
|
||||
cmd15reg : process (clk, rst_n) is
|
||||
constant match_data : sfixed16 := "01HL----10HL----"; -- for ?= command
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable in1array, in2array : cry_type; -- array for input
|
||||
begin -- process cmd0reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outarray15 <= (others => '0');
|
||||
jrloop : for j in 0 to 4 loop
|
||||
outarray (j) := (others => '0');
|
||||
in1array (j) := (others => '0');
|
||||
in2array (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outarray15 <= outarray(4);
|
||||
jcloop : for j in 4 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
j1loop : for j in 3 downto 1 loop
|
||||
in1array (j) := in1array(j-1);
|
||||
end loop j1loop;
|
||||
j2loop : for j in 3 downto 1 loop
|
||||
in2array (j) := in2array(j-1);
|
||||
end loop j2loop;
|
||||
in1array(0) := in1reg3;
|
||||
in2array(0) := in2reg3;
|
||||
-- compare test
|
||||
if (in1array(3) = in2array(3)) then
|
||||
outarray(0)(-8) := '1';
|
||||
else
|
||||
outarray(0)(-8) := '0';
|
||||
end if;
|
||||
if (in1array(3) /= in2array(3)) then
|
||||
outarray(0)(-7) := '1';
|
||||
else
|
||||
outarray(0)(-7) := '0';
|
||||
end if;
|
||||
if (in1array(3) < in2array(3)) then
|
||||
outarray(0)(-6) := '1';
|
||||
else
|
||||
outarray(0)(-6) := '0';
|
||||
end if;
|
||||
if (in1array(3) > in2array(3)) then
|
||||
outarray(0)(-5) := '1';
|
||||
else
|
||||
outarray(0)(-5) := '0';
|
||||
end if;
|
||||
if (in1array(3) <= in2array(3)) then
|
||||
outarray(0)(-4) := '1';
|
||||
else
|
||||
outarray(0)(-4) := '0';
|
||||
end if;
|
||||
if (in1array(3) >= in2array(3)) then
|
||||
outarray(0)(-3) := '1';
|
||||
else
|
||||
outarray(0)(-3) := '0';
|
||||
end if;
|
||||
if (in1array(3) = 45) then
|
||||
outarray(0)(-2) := '1';
|
||||
else
|
||||
outarray(0)(-2) := '0';
|
||||
end if;
|
||||
if (in1array(3) = 3.125) then
|
||||
outarray(0)(-1) := '1';
|
||||
else
|
||||
outarray(0)(-1) := '0';
|
||||
end if;
|
||||
-- add integer and real
|
||||
outarray(0)(0) := \?=\ (in1array(3), in2array(3) + 45);
|
||||
if (in1array(3) = in2array(3) + 3.125) then
|
||||
outarray(0)(1) := '1';
|
||||
else
|
||||
outarray(0)(1) := '0';
|
||||
end if;
|
||||
if (std_match (in1array(3), match_data)) then
|
||||
outarray(0)(2) := '1';
|
||||
else
|
||||
outarray(0)(2) := '0';
|
||||
end if;
|
||||
outarray(0)(3) := nor_reduce (in1array(3) or in2array(3));
|
||||
outarray(0)(4) := xnor_reduce (in1array(3) xor in2array(3));
|
||||
outarray(0)(5) := nand_reduce (not in1array(3));
|
||||
outarray(0)(6) := or_reduce ('1' and ufixed(in1array(3)));
|
||||
if find_leftmost(in1array(3), '1') = 3 then
|
||||
outarray(0)(7) := '1';
|
||||
else
|
||||
outarray(0)(7) := '0';
|
||||
end if;
|
||||
end if;
|
||||
end process cmd15reg;
|
||||
|
||||
-- purpose: register the inputs and the outputs
|
||||
-- type : sequential
|
||||
-- inputs : clk, rst_n, in1, in2
|
||||
-- outputs: out1
|
||||
cmdreg : process (clk, rst_n) is
|
||||
variable outreg : sfixed16; -- register stages
|
||||
variable in1reg, in2reg : sfixed16; -- register stages
|
||||
variable in1reg2, in2reg2 : sfixed16; -- register stages
|
||||
begin -- process mulreg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
in1reg := (others => '0');
|
||||
in2reg := (others => '0');
|
||||
in1reg2 := (others => '0');
|
||||
in2reg2 := (others => '0');
|
||||
in1reg3 <= (others => '0');
|
||||
in2reg3 <= (others => '0');
|
||||
out1 <= (others => '0');
|
||||
outreg := (others => '0');
|
||||
rcloop : for i in 1 to 15 loop
|
||||
cmdarray (i) <= (others => '0');
|
||||
end loop rcloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
out1 <= to_slv (outreg);
|
||||
outregc : case cmdarray (13) is
|
||||
when "0000" => outreg := outarray0;
|
||||
when "0001" => outreg := outarray1;
|
||||
when "0010" => outreg := outarray2;
|
||||
when "0011" => outreg := outarray3;
|
||||
when "0100" => outreg := outarray4;
|
||||
when "0101" => outreg := outarray5;
|
||||
when "0110" => outreg := outarray6;
|
||||
when "0111" => outreg := outarray7;
|
||||
when "1000" => outreg := outarray8;
|
||||
when "1001" => outreg := outarray9;
|
||||
when "1010" => outreg := outarray10;
|
||||
when "1011" => outreg := outarray11;
|
||||
when "1100" => outreg := outarray12;
|
||||
when "1101" => outreg := outarray13;
|
||||
when "1110" => outreg := outarray14;
|
||||
when "1111" => outreg := outarray15;
|
||||
when others => null;
|
||||
end case outregc;
|
||||
cmdpipe : for i in 15 downto 3 loop
|
||||
cmdarray (i) <= cmdarray (i-1);
|
||||
end loop cmdpipe;
|
||||
cmdarray (2) <= STD_ULOGIC_VECTOR(cmd);
|
||||
in1reg3 <= in1reg2;
|
||||
in2reg3 <= in2reg2;
|
||||
in1reg2 := in1reg;
|
||||
in2reg2 := in2reg;
|
||||
in1reg := to_sfixed (in1, in1reg);
|
||||
in2reg := to_sfixed (in2, in2reg);
|
||||
end if;
|
||||
end process cmdreg;
|
||||
|
||||
end architecture rtl;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,709 @@
|
||||
-------------------------------------------------------------------------------
|
||||
-- Synthesis test for the floating point math package
|
||||
-- This test is designed to be synthesizable and exercise much of the package.
|
||||
-- Created for vhdl-200x by David Bishop (dbishop@vhdl.org)
|
||||
-- --------------------------------------------------------------------
|
||||
-- modification history : Last Modified $Date: 2006-06-08 10:50:32-04 $
|
||||
-- Version $Id: float_synth.vhdl,v 1.1 2006-06-08 10:50:32-04 l435385 Exp $
|
||||
-------------------------------------------------------------------------------
|
||||
library ieee, ieee_proposed;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee_proposed.fixed_float_types.all;
|
||||
use ieee_proposed.fixed_pkg.all;
|
||||
use ieee_proposed.float_pkg.all;
|
||||
use ieee.math_real.all;
|
||||
entity float_synth is
|
||||
|
||||
port (
|
||||
in1, in2 : in std_logic_vector (31 downto 0); -- inputs
|
||||
out1 : out std_logic_vector (31 downto 0); -- output
|
||||
cmd : in std_logic_vector (3 downto 0);
|
||||
clk, rst_n : in std_ulogic); -- clk and reset
|
||||
|
||||
end entity float_synth;
|
||||
|
||||
architecture rtl of float_synth is
|
||||
subtype fp16 is float (6 downto -9); -- 16 bit
|
||||
|
||||
type cmd_type is array (1 to 15) of std_ulogic_vector (cmd'range); -- cmd
|
||||
signal cmdarray : cmd_type; -- command pipeline
|
||||
type cry_type is array (0 to 15) of float32; -- arrays
|
||||
signal outx : cry_type;
|
||||
signal in1reg3, in2reg3 : float32; -- register stages
|
||||
|
||||
begin -- architecture rtl
|
||||
|
||||
-- purpose: "0000" test the "+" operator
|
||||
cmd0reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd0reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(0) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(0) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
outarray(0) := in1reg3 + in2reg3;
|
||||
end if;
|
||||
|
||||
end process cmd0reg;
|
||||
|
||||
-- purpose: "0001" test the "-" operator
|
||||
cmd1reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd1reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(1) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(1) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
outarray(0) := in1reg3 - in2reg3;
|
||||
end if;
|
||||
|
||||
end process cmd1reg;
|
||||
|
||||
-- purpose: "0010" test the "*" operator
|
||||
cmd2reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(2) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(2) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
outarray(0) := in1reg3 * in2reg3;
|
||||
end if;
|
||||
|
||||
end process cmd2reg;
|
||||
|
||||
-- purpose: "0011" performs test the "/" operator
|
||||
cmd3reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd1reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(3) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(3) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
if (cmdarray(4) = "0011") then
|
||||
outarray(0) := in1reg3 / in2reg3;
|
||||
else
|
||||
outarray(0) := (others => '0');
|
||||
end if;
|
||||
end if;
|
||||
end process cmd3reg;
|
||||
|
||||
-- purpose: "0100" test the "resize" function
|
||||
cmd4reg: process (clk, rst_n) is
|
||||
variable tmpfp161, tmpfp162 : fp16; -- 16 bit fp number
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
begin -- process cmd1reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(4) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(4) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low,
|
||||
denormalize_in => true,
|
||||
denormalize => false,
|
||||
round_style => round_zero);
|
||||
when "001" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
-- size_res => tmpfp161,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low,
|
||||
denormalize_in => false,
|
||||
denormalize => false);
|
||||
when "010" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low,
|
||||
denormalize_in => false,
|
||||
denormalize => false);
|
||||
when "011" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
-- size_res => tmpfp161,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low,
|
||||
denormalize_in => true,
|
||||
denormalize => false,
|
||||
round_style => round_inf);
|
||||
when "100" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low,
|
||||
denormalize_in => true,
|
||||
denormalize => false,
|
||||
round_style => round_neginf);
|
||||
when "101" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
-- size_res => tmpfp161,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low,
|
||||
denormalize_in => true,
|
||||
denormalize => false,
|
||||
check_error => false,
|
||||
round_style => round_zero);
|
||||
when "110" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low);
|
||||
when "111" =>
|
||||
tmpfp161 := resize ( arg => in1reg3,
|
||||
exponent_width => tmpfp161'high,
|
||||
fraction_width => -tmpfp161'low
|
||||
-- size_res => tmpfp161
|
||||
);
|
||||
when others => null;
|
||||
end case;
|
||||
outarray(0)(-8 downto -23) := tmpfp161;
|
||||
outarray(0)(8 downto 6) := float(tmpcmd);
|
||||
outarray(0)(6 downto -7) := (others => '0');
|
||||
end if;
|
||||
end process cmd4reg;
|
||||
|
||||
-- purpose: "0101" Conversion function test
|
||||
cmd5reg: process (clk, rst_n) is
|
||||
variable uns : unsigned (15 downto 0); -- unsigned number
|
||||
variable s : signed (15 downto 0); -- signed number
|
||||
variable uf : ufixed (8 downto -7); -- unsigned fixed
|
||||
variable sf : sfixed (8 downto -7); -- signed fixed point
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
begin -- process cmd1reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(5) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(5) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
uns := to_unsigned (in1reg3, uns'length);
|
||||
outarray(0)(-8 downto -23) := float(std_logic_vector(uns));
|
||||
when "001" =>
|
||||
uns := to_unsigned (in1reg3, uns);
|
||||
outarray(0)(-8 downto -23) := float(std_logic_vector(uns));
|
||||
when "010" =>
|
||||
s := to_signed (in1reg3, s'length);
|
||||
outarray(0)(-8 downto -23) := float(std_logic_vector(s));
|
||||
when "011" =>
|
||||
s := to_signed (in1reg3, s);
|
||||
outarray(0)(-8 downto -23) := float(std_logic_vector(s));
|
||||
when "100" =>
|
||||
uf := to_ufixed (in1reg3, uf'high, uf'low);
|
||||
outarray(0)(-8 downto -23) := float(to_slv(uf));
|
||||
when "101" =>
|
||||
uf := to_ufixed (in1reg3, uf);
|
||||
outarray(0)(-8 downto -23) := float(to_slv(uf));
|
||||
when "110" =>
|
||||
sf := to_sfixed (in1reg3, sf'high, sf'low);
|
||||
outarray(0)(-8 downto -23) := float(to_slv(sf));
|
||||
when "111" =>
|
||||
sf := to_sfixed (in1reg3, sf);
|
||||
outarray(0)(-8 downto -23) := float(to_slv(sf));
|
||||
when others => null;
|
||||
end case;
|
||||
outarray(0)(8 downto 6) := float(tmpcmd);
|
||||
outarray(0)(5 downto -7) := (others => '0');
|
||||
end if;
|
||||
end process cmd5reg;
|
||||
|
||||
-- purpose: "0110" to_float()
|
||||
cmd6reg: process (clk, rst_n) is
|
||||
variable uns : unsigned (15 downto 0); -- unsigned number
|
||||
variable s : signed (15 downto 0); -- signed number
|
||||
variable uf : ufixed (8 downto -7); -- unsigned fixed
|
||||
variable sf : sfixed (8 downto -7); -- signed fixed point
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
begin -- process cmd1reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(6) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(6) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
uns := UNSIGNED (to_slv (in1reg3(-8 downto -23)));
|
||||
outarray(0) := to_float(uns, 8, 23);
|
||||
when "001" =>
|
||||
uns := UNSIGNED (to_slv (in1reg3(-8 downto -23)));
|
||||
outarray(0) := to_float(uns, in1reg3);
|
||||
when "010" =>
|
||||
s := SIGNED (to_slv (in1reg3(-8 downto -23)));
|
||||
outarray(0) := to_float(s, 8, 23);
|
||||
when "011" =>
|
||||
s := SIGNED (to_slv (in1reg3(-8 downto -23)));
|
||||
outarray(0) := to_float(s, in1reg3);
|
||||
when "100" =>
|
||||
uf := to_ufixed (to_slv (in1reg3(-8 downto -23)), uf'high, uf'low);
|
||||
outarray(0) := to_float(uf, 8, 23);
|
||||
when "101" =>
|
||||
uf := to_ufixed (to_slv (in1reg3(-8 downto -23)), uf);
|
||||
outarray(0) := to_float(uf, in1reg3);
|
||||
when "110" =>
|
||||
sf := to_sfixed (to_slv (in1reg3(-8 downto -23)), sf'high, sf'low);
|
||||
outarray(0) := to_float(sf, 8, 23);
|
||||
when "111" =>
|
||||
sf := to_sfixed (to_slv (in1reg3(-8 downto -23)), sf);
|
||||
outarray(0) := to_float(sf, in1reg3);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end process cmd6reg;
|
||||
|
||||
-- purpose: "0111" mod function
|
||||
cmd7reg: process (clk, rst_n) is
|
||||
variable tmpuns : unsigned (31 downto 0); -- unsigned number
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd1reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(7) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(7) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
outarray(0) := in1reg3 mod in2reg3;
|
||||
end if;
|
||||
end process cmd7reg;
|
||||
|
||||
-- purpose: "1000" rem function
|
||||
cmd8reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(8) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(8) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
outarray(0) := in1reg3 rem in2reg3;
|
||||
end if;
|
||||
|
||||
end process cmd8reg;
|
||||
|
||||
-- purpose: "1001" to_float (constants) test
|
||||
cmd9reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(9) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(9) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
outarray(0) := to_float(0, 8, 23);
|
||||
when "001" =>
|
||||
outarray(0) := to_float(0.0, 8, 23);
|
||||
when "010" =>
|
||||
outarray(0) := to_float(8, in1reg3);
|
||||
when "011" =>
|
||||
outarray(0) := to_float(8.0, in1reg3);
|
||||
when "100" =>
|
||||
outarray(0) := to_float(-8, 8, 23);
|
||||
when "101" =>
|
||||
outarray(0) := to_float(-8.0, 8, 23);
|
||||
when "110" =>
|
||||
outarray(0) := to_float(27000, in2reg3);
|
||||
when "111" =>
|
||||
-- outarray(0) := "01000000010010010000111111011011";
|
||||
outarray(0) := to_float(MATH_PI, in2reg3);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
end process cmd9reg;
|
||||
|
||||
-- purpose: "1010" data manipulation (+, -, scalb, etc)
|
||||
cmd10reg: process (clk, rst_n) is
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
variable s : SIGNED (7 downto 0); -- signed number
|
||||
variable outarray : cry_type; -- array for output
|
||||
constant posinf : float32 := "01111111100000000000000000000000"; -- +inf
|
||||
constant neginf : float32 := "11111111100000000000000000000000"; -- +inf
|
||||
constant onept5 : float32 := "00111111110000000000000000000000"; -- 1.5
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(10) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(10) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
outarray(0) := - in1reg3;
|
||||
when "001" =>
|
||||
outarray(0) := abs( in1reg3);
|
||||
when "010" =>
|
||||
if (cmdarray(4) = "1010") then
|
||||
s := resize (SIGNED (to_slv (in2reg3(8 downto 5))), s'length);
|
||||
outarray(0) := Scalb (in1reg3, s);
|
||||
else
|
||||
outarray(0) := (others => '0');
|
||||
end if;
|
||||
when "011" =>
|
||||
if (cmdarray(4) = "1010") then
|
||||
s := logb (in1reg3);
|
||||
outarray(0) := (others => '0');
|
||||
outarray(0)(-16 downto -23) := float(std_logic_vector(s));
|
||||
else
|
||||
outarray(0) := (others => '0');
|
||||
end if;
|
||||
when "100" =>
|
||||
outarray(0) := Nextafter ( in1reg3, onept5);
|
||||
when "101" =>
|
||||
outarray(0) := Nextafter ( in1reg3, -onept5);
|
||||
when "110" =>
|
||||
outarray(0) := Nextafter ( x => in1reg3, y => posinf,
|
||||
check_error => false,
|
||||
denormalize => false);
|
||||
when "111" =>
|
||||
outarray(0) := Nextafter (x => in1reg3, y => neginf,
|
||||
check_error => false,
|
||||
denormalize => false);
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
end process cmd10reg;
|
||||
|
||||
-- purpose "1011" copysign
|
||||
cmd11reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd2reg
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(11) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(11) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
outarray(0) := Copysign (in1reg3, in2reg3);
|
||||
end if;
|
||||
end process cmd11reg;
|
||||
|
||||
-- purpose "1100" compare test
|
||||
cmd12reg: process (clk, rst_n) is
|
||||
variable outarray : cry_type; -- array for output
|
||||
constant fifteenpt5 : float32 := "01000001011110000000000000000000";-- 15.5
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(12) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(12) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
outarray(0) := (others => '0');
|
||||
if (in1reg3 = in2reg3) then
|
||||
outarray(0)(outarray(0)'high) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high) := '0';
|
||||
end if;
|
||||
if (in1reg3 /= in2reg3) then
|
||||
outarray(0)(outarray(0)'high-1) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-1) := '0';
|
||||
end if;
|
||||
if (in1reg3 > in2reg3) then
|
||||
outarray(0)(outarray(0)'high-2) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-2) := '0';
|
||||
end if;
|
||||
if (in1reg3 < in2reg3) then
|
||||
outarray(0)(outarray(0)'high-3) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-3) := '0';
|
||||
end if;
|
||||
if (in1reg3 >= in2reg3) then
|
||||
outarray(0)(outarray(0)'high-4) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-4) := '0';
|
||||
end if;
|
||||
if (in1reg3 <= in2reg3) then
|
||||
outarray(0)(outarray(0)'high-5) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-5) := '0';
|
||||
end if;
|
||||
outarray(0)(outarray(0)'high-6) := \?=\ (in1reg3, 15);
|
||||
outarray(0)(outarray(0)'high-7) := \?=\ (in1reg3, 15.5);
|
||||
if (Unordered (in1reg3, in2reg3)) then
|
||||
outarray(0)(outarray(0)'high-8) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-8) := '0';
|
||||
end if;
|
||||
if (Finite (in1reg3)) then
|
||||
outarray(0)(outarray(0)'high-9) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-9) := '0';
|
||||
end if;
|
||||
if (Isnan (in1reg3)) then
|
||||
outarray(0)(outarray(0)'high-10) := '1';
|
||||
else
|
||||
outarray(0)(outarray(0)'high-10) := '0';
|
||||
end if;
|
||||
end if;
|
||||
|
||||
end process cmd12reg;
|
||||
|
||||
-- purpose "1101" boolean test
|
||||
cmd13reg: process (clk, rst_n) is
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(13) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(13) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
outarray(0) := not (in1reg3);
|
||||
when "001" =>
|
||||
outarray(0) := in1reg3 and in2reg3;
|
||||
when "010" =>
|
||||
outarray(0) := in1reg3 or in2reg3;
|
||||
when "011" =>
|
||||
outarray(0) := in1reg3 nand in2reg3;
|
||||
when "100" =>
|
||||
outarray(0) := in1reg3 nor in2reg3;
|
||||
when "101" =>
|
||||
outarray(0) := in1reg3 xor in2reg3;
|
||||
when "110" =>
|
||||
outarray(0) := in1reg3 xnor in2reg3;
|
||||
when "111" =>
|
||||
outarray(0) := in1reg3 xor '1';
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
end process cmd13reg;
|
||||
|
||||
-- purpose "1110" reduce and vector test
|
||||
cmd14reg: process (clk, rst_n) is
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(14) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(14) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
outarray(0) := (others => '0');
|
||||
outarray(0)(outarray(0)'high) := and_reduce (in1reg3);
|
||||
outarray(0)(outarray(0)'high-1) := nand_reduce (in1reg3);
|
||||
outarray(0)(outarray(0)'high-2) := or_reduce (in1reg3);
|
||||
outarray(0)(outarray(0)'high-3) := nor_reduce (in1reg3);
|
||||
outarray(0)(outarray(0)'high-4) := xor_reduce (in1reg3);
|
||||
outarray(0)(outarray(0)'high-5) := xnor_reduce (in1reg3);
|
||||
when "001" =>
|
||||
outarray(0) := in1reg3 and in2reg3(in2reg3'high);
|
||||
when "010" =>
|
||||
outarray(0) := in1reg3 or in2reg3(in2reg3'high);
|
||||
when "011" =>
|
||||
outarray(0) := in1reg3 nand in2reg3(in2reg3'high);
|
||||
when "100" =>
|
||||
outarray(0) := in1reg3 nor in2reg3(in2reg3'high);
|
||||
when "101" =>
|
||||
outarray(0) := in2reg3(in2reg3'high) xor in1reg3;
|
||||
when "110" =>
|
||||
outarray(0) := in2reg3(in2reg3'high) xnor in1reg3;
|
||||
when "111" =>
|
||||
outarray(0) := in2reg3(in2reg3'high) and in1reg3;
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
end process cmd14reg;
|
||||
|
||||
-- purpose "1111" + constant
|
||||
cmd15reg: process (clk, rst_n) is
|
||||
variable tmpcmd : STD_LOGIC_VECTOR (2 downto 0);
|
||||
variable outarray : cry_type; -- array for output
|
||||
begin -- process cmd2reg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
outx(15) <= ( others => '0');
|
||||
jrloop: for j in 0 to 7 loop
|
||||
outarray (j) := (others => '0');
|
||||
end loop jrloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
outx(15) <= outarray(7);
|
||||
jcloop: for j in 7 downto 1 loop
|
||||
outarray (j) := outarray(j-1);
|
||||
end loop jcloop;
|
||||
tmpcmd := to_slv (in2reg3 (in2reg3'low+2 downto in2reg3'low));
|
||||
case tmpcmd is
|
||||
when "000" =>
|
||||
outarray(0) := in1reg3 + 1;
|
||||
when "001" =>
|
||||
outarray(0) := 1 + in1reg3;
|
||||
when "010" =>
|
||||
outarray(0) := in1reg3 + 1.0;
|
||||
when "011" =>
|
||||
outarray(0) := 1.0 + in1reg3;
|
||||
when "100" =>
|
||||
outarray(0) := in1reg3 * 1;
|
||||
when "101" =>
|
||||
outarray(0) := 1 * in1reg3;
|
||||
when "110" =>
|
||||
outarray(0) := in1reg3 * 1.0;
|
||||
when "111" =>
|
||||
outarray(0) := 1.0 * in1reg3;
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
|
||||
end process cmd15reg;
|
||||
|
||||
-- purpose: multiply floating point
|
||||
-- type : sequential
|
||||
-- inputs : clk, rst_n, in1, in2
|
||||
-- outputs: out1
|
||||
cmdreg: process (clk, rst_n) is
|
||||
variable outreg : float32; -- register stages
|
||||
variable in1reg, in2reg : float32; -- register stages
|
||||
variable in1reg2, in2reg2 : float32; -- register stages
|
||||
begin -- process mulreg
|
||||
|
||||
if rst_n = '0' then -- asynchronous reset (active low)
|
||||
in1reg := ( others => '0');
|
||||
in2reg := ( others => '0');
|
||||
in1reg2 := ( others => '0');
|
||||
in2reg2 := ( others => '0');
|
||||
in1reg3 <= ( others => '0');
|
||||
in2reg3 <= ( others => '0');
|
||||
out1 <= ( others => '0');
|
||||
outreg := (others => '0');
|
||||
rcloop: for i in 1 to 15 loop
|
||||
cmdarray (i) <= (others => '0');
|
||||
end loop rcloop;
|
||||
elsif rising_edge(clk) then -- rising clock edge
|
||||
out1 <= to_slv (outreg);
|
||||
outregc: case cmdarray (13) is
|
||||
when "0000" => outreg := outx (0);
|
||||
when "0001" => outreg := outx (1);
|
||||
when "0010" => outreg := outx (2);
|
||||
when "0011" => outreg := outx (3);
|
||||
when "0100" => outreg := outx (4);
|
||||
when "0101" => outreg := outx (5);
|
||||
when "0110" => outreg := outx (6);
|
||||
when "0111" => outreg := outx (7);
|
||||
when "1000" => outreg := outx (8);
|
||||
when "1001" => outreg := outx (9);
|
||||
when "1010" => outreg := outx (10);
|
||||
when "1011" => outreg := outx (11);
|
||||
when "1100" => outreg := outx (12);
|
||||
when "1101" => outreg := outx (13);
|
||||
when "1110" => outreg := outx (14);
|
||||
when "1111" => outreg := outx (15);
|
||||
when others => null;
|
||||
end case outregc;
|
||||
cmdpipe: for i in 15 downto 3 loop
|
||||
cmdarray (i) <= cmdarray (i-1);
|
||||
end loop cmdpipe;
|
||||
cmdarray (2) <= std_ulogic_vector(cmd);
|
||||
in1reg3 <= in1reg2;
|
||||
in2reg3 <= in2reg2;
|
||||
in1reg2 := in1reg;
|
||||
in2reg2 := in2reg;
|
||||
in1reg := to_float (in1, in1reg);
|
||||
in2reg := to_float (in2, in2reg);
|
||||
end if;
|
||||
|
||||
end process cmdreg;
|
||||
|
||||
end architecture rtl;
|
||||
@@ -0,0 +1,16 @@
|
||||
<pre>
|
||||
Tested with Modeltech 6.5b
|
||||
|
||||
When you compile you will get a warning:
|
||||
(vcom-1246) Range 0 downto 1 is null.
|
||||
To suppress this warning compile with "-suppress 1236"
|
||||
In the MTI install you will find a premapped library called
|
||||
"floatfixlib". This contains an old version of "fixed_pkg" and "float_pkg".
|
||||
The versions in this release are newer.
|
||||
|
||||
To compile: source the "compile.mti" script. This will create the
|
||||
IEEE_PROPOSED VHDL library.
|
||||
|
||||
See the README for an explination of the new functions in these packages.
|
||||
|
||||
</pre>
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,478 @@
|
||||
------------------------------------------------------------------------------
|
||||
-- "standard_textio_additions" package contains the additions to the built in
|
||||
-- "standard.textio" package.
|
||||
-- This package should be compiled into "ieee_proposed" and used as follows:
|
||||
-- use ieee_proposed.standard_textio_additions.all;
|
||||
-- Last Modified: $Date: 2007/03/13 18:25:58 $
|
||||
-- RCS ID: $Id: standard_textio_additions_c.vhdl,v 1.5 2007/03/13 18:25:58 l435385 Exp $
|
||||
--
|
||||
-- Created for VHDL-200X par, David Bishop (dbishop@vhdl.org)
|
||||
------------------------------------------------------------------------------
|
||||
use std.textio.all;
|
||||
package standard_textio_additions is
|
||||
|
||||
-- procedure DEALLOCATE (P : inout LINE);
|
||||
|
||||
procedure FLUSH (file F : TEXT);
|
||||
|
||||
function MINIMUM (L, R : SIDE) return SIDE;
|
||||
function MAXIMUM (L, R : SIDE) return SIDE;
|
||||
|
||||
function TO_STRING (VALUE : SIDE) return STRING;
|
||||
|
||||
function JUSTIFY (VALUE : STRING; JUSTIFIED : SIDE := right; FIELD : WIDTH := 0) return STRING;
|
||||
|
||||
procedure SREAD (L : inout LINE; VALUE : out STRING; STRLEN : out NATURAL);
|
||||
alias STRING_READ is SREAD [LINE, STRING, NATURAL];
|
||||
alias BREAD is READ [LINE, BIT_VECTOR, BOOLEAN];
|
||||
alias BREAD is READ [LINE, BIT_VECTOR];
|
||||
alias BINARY_READ is READ [LINE, BIT_VECTOR, BOOLEAN];
|
||||
alias BINARY_READ is READ [LINE, BIT_VECTOR];
|
||||
procedure OREAD (L : inout LINE; VALUE : out BIT_VECTOR; GOOD : out BOOLEAN);
|
||||
procedure OREAD (L : inout LINE; VALUE : out BIT_VECTOR);
|
||||
alias OCTAL_READ is OREAD [LINE, BIT_VECTOR, BOOLEAN];
|
||||
alias OCTAL_READ is OREAD [LINE, BIT_VECTOR];
|
||||
procedure HREAD (L : inout LINE; VALUE : out BIT_VECTOR; GOOD : out BOOLEAN);
|
||||
procedure HREAD (L : inout LINE; VALUE : out BIT_VECTOR);
|
||||
alias HEX_READ is HREAD [LINE, BIT_VECTOR, BOOLEAN];
|
||||
alias HEX_READ is HREAD [LINE, BIT_VECTOR];
|
||||
procedure TEE (file F : TEXT; L : inout LINE);
|
||||
procedure WRITE (L : inout LINE; VALUE : in REAL;
|
||||
FORMAT : in STRING);
|
||||
alias SWRITE is WRITE [LINE, STRING, SIDE, WIDTH];
|
||||
alias STRING_WRITE is WRITE [LINE, STRING, SIDE, WIDTH];
|
||||
alias BWRITE is WRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
|
||||
alias BINARY_WRITE is WRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
|
||||
procedure OWRITE (L : inout LINE; VALUE : in BIT_VECTOR;
|
||||
JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
|
||||
alias OCTAL_WRITE is OWRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
|
||||
procedure HWRITE (L : inout LINE; VALUE : in BIT_VECTOR;
|
||||
JUSTIFIED : in SIDE := right; FIELD : in WIDTH := 0);
|
||||
alias HEX_WRITE is HWRITE [LINE, BIT_VECTOR, SIDE, WIDTH];
|
||||
|
||||
end package standard_textio_additions;
|
||||
|
||||
library ieee_proposed;
|
||||
use ieee_proposed.standard_additions.all;
|
||||
|
||||
package body standard_textio_additions is
|
||||
-- pragma synthesis_off
|
||||
constant NUS : STRING(2 to 1) := (others => ' '); -- NULL array
|
||||
constant NBSP : CHARACTER := CHARACTER'val(160); -- space character
|
||||
|
||||
-- Writes L to a file without modifying the contents of the line
|
||||
procedure TEE (file F : TEXT; L : inout LINE) is
|
||||
begin
|
||||
write (OUTPUT, L.all & LF);
|
||||
writeline(F, L);
|
||||
end procedure TEE;
|
||||
|
||||
procedure FLUSH (file F: TEXT) is -- Implicit
|
||||
begin
|
||||
file_close (F);
|
||||
end procedure FLUSH;
|
||||
|
||||
-- Read and Write procedure for strings
|
||||
procedure SREAD (L : inout LINE;
|
||||
VALUE : out STRING;
|
||||
STRLEN : out natural) is
|
||||
variable ok : BOOLEAN;
|
||||
variable c : CHARACTER;
|
||||
-- Result is padded with space characters
|
||||
variable result : STRING (1 to VALUE'length) := (others => ' ');
|
||||
begin
|
||||
VALUE := result;
|
||||
loop -- skip white space
|
||||
read(L, c, ok);
|
||||
exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
|
||||
end loop;
|
||||
-- Bail out if there was a bad read
|
||||
if not ok then
|
||||
STRLEN := 0;
|
||||
return;
|
||||
end if;
|
||||
result (1) := c;
|
||||
STRLEN := 1;
|
||||
for i in 2 to VALUE'length loop
|
||||
read(L, c, ok);
|
||||
if (ok = false) or ((c = ' ') or (c = NBSP) or (c = HT)) then
|
||||
exit;
|
||||
else
|
||||
result (i) := c;
|
||||
end if;
|
||||
STRLEN := i;
|
||||
end loop;
|
||||
VALUE := result;
|
||||
end procedure SREAD;
|
||||
|
||||
-- Hex Read and Write procedures for bit_vector.
|
||||
-- Procedure only visible internally.
|
||||
procedure Char2QuadBits (C : CHARACTER;
|
||||
RESULT : out BIT_VECTOR(3 downto 0);
|
||||
GOOD : out BOOLEAN;
|
||||
ISSUE_ERROR : in BOOLEAN) is
|
||||
begin
|
||||
case c is
|
||||
when '0' => result := x"0"; good := true;
|
||||
when '1' => result := x"1"; good := true;
|
||||
when '2' => result := x"2"; good := true;
|
||||
when '3' => result := x"3"; good := true;
|
||||
when '4' => result := x"4"; good := true;
|
||||
when '5' => result := x"5"; good := true;
|
||||
when '6' => result := x"6"; good := true;
|
||||
when '7' => result := x"7"; good := true;
|
||||
when '8' => result := x"8"; good := true;
|
||||
when '9' => result := x"9"; good := true;
|
||||
when 'A' | 'a' => result := x"A"; good := true;
|
||||
when 'B' | 'b' => result := x"B"; good := true;
|
||||
when 'C' | 'c' => result := x"C"; good := true;
|
||||
when 'D' | 'd' => result := x"D"; good := true;
|
||||
when 'E' | 'e' => result := x"E"; good := true;
|
||||
when 'F' | 'f' => result := x"F"; good := true;
|
||||
when others =>
|
||||
assert not ISSUE_ERROR report
|
||||
"TEXTIO.HREAD Error: Read a '" & c &
|
||||
"', expected a Hex character (0-F)." severity error;
|
||||
GOOD := false;
|
||||
end case;
|
||||
end procedure Char2QuadBits;
|
||||
|
||||
procedure HREAD (L : inout LINE;
|
||||
VALUE : out BIT_VECTOR;
|
||||
GOOD : out BOOLEAN) is
|
||||
variable ok : BOOLEAN;
|
||||
variable c : CHARACTER;
|
||||
constant ne : INTEGER := (VALUE'length+3)/4;
|
||||
constant pad : INTEGER := ne*4 - VALUE'length;
|
||||
variable sv : BIT_VECTOR (0 to ne*4 - 1) := (others => '0');
|
||||
variable s : STRING(1 to ne-1);
|
||||
begin
|
||||
VALUE := (VALUE'range => '0');
|
||||
loop -- skip white space
|
||||
read(l, c, ok);
|
||||
exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
|
||||
end loop;
|
||||
-- Bail out if there was a bad read
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
Char2QuadBits(c, sv(0 to 3), ok, false);
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
for i in 1 to ne-1 loop
|
||||
Char2QuadBits(s(i), sv(4*i to 4*i+3), ok, false);
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
if or_reduce (sv (0 to pad-1)) = '1' then
|
||||
GOOD := false; -- vector was truncated.
|
||||
else
|
||||
GOOD := true;
|
||||
VALUE := sv (pad to sv'high);
|
||||
end if;
|
||||
end procedure HREAD;
|
||||
|
||||
procedure HREAD (L : inout LINE;
|
||||
VALUE : out BIT_VECTOR) is
|
||||
variable ok : BOOLEAN;
|
||||
variable c : CHARACTER;
|
||||
constant ne : INTEGER := (VALUE'length+3)/4;
|
||||
constant pad : INTEGER := ne*4 - VALUE'length;
|
||||
variable sv : BIT_VECTOR(0 to ne*4 - 1) := (others => '0');
|
||||
variable s : STRING(1 to ne-1);
|
||||
begin
|
||||
VALUE := (VALUE'range => '0');
|
||||
loop -- skip white space
|
||||
read(l, c, ok);
|
||||
exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
|
||||
end loop;
|
||||
-- Bail out if there was a bad read
|
||||
if not ok then
|
||||
report "TEXTIO.HREAD Error: Failed skipping white space"
|
||||
severity error;
|
||||
return;
|
||||
end if;
|
||||
Char2QuadBits(c, sv(0 to 3), ok, true);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
report "TEXTIO.HREAD Error: Failed to read the STRING"
|
||||
severity error;
|
||||
return;
|
||||
end if;
|
||||
for i in 1 to ne-1 loop
|
||||
Char2QuadBits(s(i), sv(4*i to 4*i+3), ok, true);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
if or_reduce (sv (0 to pad-1)) = '1' then
|
||||
report "TEXTIO.HREAD Error: Vector truncated"
|
||||
severity error;
|
||||
else
|
||||
VALUE := sv (pad to sv'high);
|
||||
end if;
|
||||
end procedure HREAD;
|
||||
|
||||
procedure HWRITE (L : inout LINE;
|
||||
VALUE : in BIT_VECTOR;
|
||||
JUSTIFIED : in SIDE := right;
|
||||
FIELD : in WIDTH := 0) is
|
||||
begin
|
||||
write (L => L,
|
||||
VALUE => to_hstring(VALUE),
|
||||
JUSTIFIED => JUSTIFIED,
|
||||
FIELD => FIELD);
|
||||
end procedure HWRITE;
|
||||
|
||||
-- Procedure only visible internally.
|
||||
procedure Char2TriBits (C : CHARACTER;
|
||||
RESULT : out BIT_VECTOR(2 downto 0);
|
||||
GOOD : out BOOLEAN;
|
||||
ISSUE_ERROR : in BOOLEAN) is
|
||||
begin
|
||||
case c is
|
||||
when '0' => result := o"0"; good := true;
|
||||
when '1' => result := o"1"; good := true;
|
||||
when '2' => result := o"2"; good := true;
|
||||
when '3' => result := o"3"; good := true;
|
||||
when '4' => result := o"4"; good := true;
|
||||
when '5' => result := o"5"; good := true;
|
||||
when '6' => result := o"6"; good := true;
|
||||
when '7' => result := o"7"; good := true;
|
||||
when others =>
|
||||
assert not ISSUE_ERROR
|
||||
report
|
||||
"TEXTIO.OREAD Error: Read a '" & c &
|
||||
"', expected an Octal character (0-7)."
|
||||
severity error;
|
||||
GOOD := false;
|
||||
end case;
|
||||
end procedure Char2TriBits;
|
||||
|
||||
-- Read and Write procedures for Octal values
|
||||
procedure OREAD (L : inout LINE;
|
||||
VALUE : out BIT_VECTOR;
|
||||
GOOD : out BOOLEAN) is
|
||||
variable ok : BOOLEAN;
|
||||
variable c : CHARACTER;
|
||||
constant ne : INTEGER := (VALUE'length+2)/3;
|
||||
constant pad : INTEGER := ne*3 - VALUE'length;
|
||||
variable sv : BIT_VECTOR(0 to ne*3 - 1) := (others => '0');
|
||||
variable s : STRING(1 to ne-1);
|
||||
begin
|
||||
VALUE := (VALUE'range => '0');
|
||||
loop -- skip white space
|
||||
read(l, c, ok);
|
||||
exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
|
||||
end loop;
|
||||
-- Bail out if there was a bad read
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
Char2TriBits(c, sv(0 to 2), ok, false);
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
for i in 1 to ne-1 loop
|
||||
Char2TriBits(s(i), sv(3*i to 3*i+2), ok, false);
|
||||
if not ok then
|
||||
GOOD := false;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
if or_reduce (sv (0 to pad-1)) = '1' then
|
||||
GOOD := false; -- vector was truncated.
|
||||
else
|
||||
GOOD := true;
|
||||
VALUE := sv (pad to sv'high);
|
||||
end if;
|
||||
end procedure OREAD;
|
||||
|
||||
procedure OREAD (L : inout LINE;
|
||||
VALUE : out BIT_VECTOR) is
|
||||
variable c : CHARACTER;
|
||||
variable ok : BOOLEAN;
|
||||
constant ne : INTEGER := (VALUE'length+2)/3;
|
||||
constant pad : INTEGER := ne*3 - VALUE'length;
|
||||
variable sv : BIT_VECTOR(0 to ne*3 - 1) := (others => '0');
|
||||
variable s : STRING(1 to ne-1);
|
||||
begin
|
||||
VALUE := (VALUE'range => '0');
|
||||
loop -- skip white space
|
||||
read(l, c, ok);
|
||||
exit when (ok = false) or ((c /= ' ') and (c /= NBSP) and (c /= HT));
|
||||
end loop;
|
||||
-- Bail out if there was a bad read
|
||||
if not ok then
|
||||
report "TEXTIO.OREAD Error: Failed skipping white space"
|
||||
severity error;
|
||||
return;
|
||||
end if;
|
||||
Char2TriBits(c, sv(0 to 2), ok, true);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
read(L, s, ok);
|
||||
if not ok then
|
||||
report "TEXTIO.OREAD Error: Failed to read the STRING"
|
||||
severity error;
|
||||
return;
|
||||
end if;
|
||||
for i in 1 to ne-1 loop
|
||||
Char2TriBits(s(i), sv(3*i to 3*i+2), ok, true);
|
||||
if not ok then
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
if or_reduce (sv (0 to pad-1)) = '1' then
|
||||
report "TEXTIO.OREAD Error: Vector truncated"
|
||||
severity error;
|
||||
else
|
||||
VALUE := sv (pad to sv'high);
|
||||
end if;
|
||||
end procedure OREAD;
|
||||
|
||||
procedure OWRITE (L : inout LINE;
|
||||
VALUE : in BIT_VECTOR;
|
||||
JUSTIFIED : in SIDE := right;
|
||||
FIELD : in WIDTH := 0) is
|
||||
begin
|
||||
write (L => L,
|
||||
VALUE => to_ostring(VALUE),
|
||||
JUSTIFIED => JUSTIFIED,
|
||||
FIELD => FIELD);
|
||||
end procedure OWRITE;
|
||||
|
||||
-- read and write for vector versions
|
||||
-- These versions produce "value1, value2, value3 ...."
|
||||
procedure read (L : inout LINE;
|
||||
VALUE : out boolean_vector;
|
||||
GOOD : out BOOLEAN) is
|
||||
variable dummy : CHARACTER;
|
||||
variable igood : BOOLEAN := true;
|
||||
begin
|
||||
for i in VALUE'range loop
|
||||
read (L => L,
|
||||
VALUE => VALUE(i),
|
||||
GOOD => igood);
|
||||
if (igood) and (i /= value'right) then
|
||||
read (L => L,
|
||||
VALUE => dummy, -- Toss the comma or seperator
|
||||
good => igood);
|
||||
end if;
|
||||
if (not igood) then
|
||||
good := false;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
good := true;
|
||||
end procedure read;
|
||||
|
||||
procedure read (L : inout LINE;
|
||||
VALUE : out boolean_vector) is
|
||||
variable dummy : CHARACTER;
|
||||
variable igood : BOOLEAN;
|
||||
begin
|
||||
for i in VALUE'range loop
|
||||
read (L => L,
|
||||
VALUE => VALUE(i),
|
||||
good => igood);
|
||||
if (igood) and (i /= value'right) then
|
||||
read (L => L,
|
||||
VALUE => dummy, -- Toss the comma or seperator
|
||||
good => igood);
|
||||
end if;
|
||||
if (not igood) then
|
||||
report "STANDARD.STD_TEXTIO(BOOLEAN_VECTOR) "
|
||||
& "Read error ecounted during vector read" severity error;
|
||||
return;
|
||||
end if;
|
||||
end loop;
|
||||
end procedure read;
|
||||
|
||||
procedure write (L : inout LINE;
|
||||
VALUE : in boolean_vector;
|
||||
JUSTIFIED : in SIDE := right;
|
||||
FIELD : in WIDTH := 0) is
|
||||
begin
|
||||
for i in VALUE'range loop
|
||||
write (L => L,
|
||||
VALUE => VALUE(i),
|
||||
JUSTIFIED => JUSTIFIED,
|
||||
FIELD => FIELD);
|
||||
if (i /= value'right) then
|
||||
swrite (L, ", ");
|
||||
end if;
|
||||
end loop;
|
||||
end procedure write;
|
||||
|
||||
procedure WRITE (L: inout LINE; VALUE: in REAL;
|
||||
FORMAT: in STRING) is
|
||||
begin
|
||||
swrite ( L => L,
|
||||
VALUE => to_string (VALUE, FORMAT));
|
||||
end procedure WRITE;
|
||||
|
||||
function justify (
|
||||
value : STRING;
|
||||
justified : SIDE := right;
|
||||
field : width := 0)
|
||||
return STRING is
|
||||
constant VAL_LEN : INTEGER := value'length;
|
||||
variable result : STRING (1 to field) := (others => ' ');
|
||||
begin -- function justify
|
||||
-- return value if field is too small
|
||||
if VAL_LEN >= field then
|
||||
return value;
|
||||
end if;
|
||||
if justified = left then
|
||||
result(1 to VAL_LEN) := value;
|
||||
elsif justified = right then
|
||||
result(field - VAL_LEN + 1 to field) := value;
|
||||
end if;
|
||||
return result;
|
||||
end function justify;
|
||||
|
||||
function to_string (
|
||||
VALUE : SIDE) return STRING is
|
||||
begin
|
||||
return SIDE'image(VALUE);
|
||||
end function to_string;
|
||||
|
||||
-- pragma synthesis_on
|
||||
-- Will be implicit
|
||||
function minimum (L, R : SIDE) return SIDE is
|
||||
begin
|
||||
if L > R then return R;
|
||||
else return L;
|
||||
end if;
|
||||
end function minimum;
|
||||
|
||||
function maximum (L, R : SIDE) return SIDE is
|
||||
begin
|
||||
if L > R then return L;
|
||||
else return R;
|
||||
end if;
|
||||
end function maximum;
|
||||
|
||||
end package body standard_textio_additions;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,439 @@
|
||||
-- Test vectors for the synthesis test for the fixed point math package
|
||||
-- This test is designed to test fixed_synth and exercise much of the entity.
|
||||
-- Created for vhdl-200x by David Bishop (dbishop@vhdl.org)
|
||||
-- --------------------------------------------------------------------
|
||||
-- modification history : Last Modified $Date: 2006-06-08 10:55:54-04 $
|
||||
-- Version $Id: test_fixed_synth.vhdl,v 1.1 2006-06-08 10:55:54-04 l435385 Exp $
|
||||
-- --------------------------------------------------------------------
|
||||
|
||||
entity test_fixed_synth is
|
||||
generic (
|
||||
quiet : boolean := false); -- make the simulation quiet
|
||||
end entity test_fixed_synth;
|
||||
|
||||
library ieee, ieee_proposed;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee_proposed.fixed_pkg.all;
|
||||
architecture testbench of test_fixed_synth is
|
||||
|
||||
procedure report_error (
|
||||
constant errmes : in string; -- error message
|
||||
actual : in sfixed; -- data from algorithm
|
||||
constant expected : in sfixed) is -- reference data
|
||||
begin -- function report_error
|
||||
assert actual = expected
|
||||
report errmes & CR
|
||||
& "Actual: " & to_string(actual)
|
||||
& " (" & real'image(to_real(actual)) & ")" & CR
|
||||
& " /= " & to_string(expected)
|
||||
& " (" & real'image(to_real(expected)) & ")"
|
||||
severity error;
|
||||
return;
|
||||
end procedure report_error;
|
||||
|
||||
-- Device under test. Note that all inputs and outputs are std_logic_vector.
|
||||
-- This entity can be use both pre and post synthesis.
|
||||
component fixed_synth is
|
||||
port (
|
||||
in1, in2 : in std_logic_vector (15 downto 0); -- inputs
|
||||
out1 : out std_logic_vector (15 downto 0); -- output
|
||||
cmd : in std_logic_vector (3 downto 0);
|
||||
clk, rst_n : in std_ulogic); -- clk and reset
|
||||
end component fixed_synth;
|
||||
constant clock_period : time := 500 ns; -- clock period
|
||||
subtype sfixed7 is sfixed (3 downto -3); -- 7 bit
|
||||
subtype sfixed16 is sfixed (7 downto -8); -- 16 bit
|
||||
signal stop_clock : boolean := false; -- stop the clock
|
||||
signal clk, rst_n : std_ulogic; -- clk and reset
|
||||
signal in1slv, in2slv, out1slv : std_logic_vector(15 downto 0);
|
||||
signal in1, in2 : sfixed16; -- inputs
|
||||
signal out1 : sfixed16; -- output
|
||||
signal cmd : std_logic_vector (3 downto 0); -- command string
|
||||
begin -- architecture testbench
|
||||
|
||||
-- From fixed point to Std_logic_vector
|
||||
in1slv <= to_slv(in1);
|
||||
in2slv <= to_slv(in2);
|
||||
-- Std_logic_vector to fixed point.
|
||||
out1 <= to_sfixed(out1slv, out1'high, out1'low);
|
||||
DUT: fixed_synth
|
||||
port map (
|
||||
in1 => in1slv, -- [in std_logic_vector (15 downto 0)] inputs
|
||||
in2 => in2slv, -- [in std_logic_vector (15 downto 0)] inputs
|
||||
out1 => out1slv, -- [out std_logic_vector (15 downto 0)] output
|
||||
cmd => cmd, -- [in std_logic_vector (2 downto 0)]
|
||||
clk => clk, -- [in std_ulogic] clk and reset
|
||||
rst_n => rst_n); -- [in std_ulogic] clk and reset
|
||||
|
||||
-- purpose: clock driver
|
||||
clkprc: process is
|
||||
begin -- process clkprc
|
||||
if (not stop_clock) then
|
||||
clk <= '0';
|
||||
wait for clock_period/2.0;
|
||||
clk <= '1';
|
||||
wait for clock_period/2.0;
|
||||
else
|
||||
wait;
|
||||
end if;
|
||||
end process clkprc;
|
||||
|
||||
-- purpose: reset driver
|
||||
reset_proc: process is
|
||||
begin -- process reset_proc
|
||||
rst_n <= '0';
|
||||
wait for clock_period * 2.0;
|
||||
rst_n <= '1';
|
||||
wait;
|
||||
end process reset_proc;
|
||||
|
||||
-- purpose: main test loop
|
||||
tester: process is
|
||||
begin -- process tester
|
||||
cmd <= "0000"; -- add mode
|
||||
in1 <= (others => '0');
|
||||
in2 <= (others => '0');
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
in1 <= "0000011010000000"; -- 6.5
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0001"; -- subtract mode
|
||||
in1 <= "0000011010000000"; -- 6.5
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0010"; -- multiply mode
|
||||
in1 <= "0000011010000000"; -- 6.5
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0000"; -- add mode
|
||||
in1 <= "0000000010000000"; -- 0.5
|
||||
in2 <= "0000000010000000"; -- 0.5
|
||||
wait for clock_period;
|
||||
in1 <= to_sfixed (3.14, sfixed16'high, sfixed16'low);
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0011"; -- divide
|
||||
in1 <= "0000000010000000"; -- 0.5
|
||||
in2 <= "0000000010000000"; -- 0.5
|
||||
wait for clock_period;
|
||||
in1 <= to_sfixed (-0.5, sfixed16'high, sfixed16'low); -- -0.5
|
||||
in2 <= "0000000010000000"; -- 0.5
|
||||
wait for clock_period;
|
||||
cmd <= "0100"; -- unsigned add
|
||||
in1 <= "0000011010000000"; -- 6.5
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0101"; -- subtract mode
|
||||
in1 <= "0000011010000000"; -- 6.5
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0110"; -- multiply mode
|
||||
in1 <= "0000011010000000"; -- 6.5
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0100"; -- add mode
|
||||
in1 <= "0000000010000000"; -- 0.5
|
||||
in2 <= "0000000010000000"; -- 0.5
|
||||
wait for clock_period;
|
||||
in1 <= to_sfixed (3.14, sfixed16'high, sfixed16'low);
|
||||
in2 <= "0000001100000000"; -- 3
|
||||
wait for clock_period;
|
||||
cmd <= "0111"; -- divide
|
||||
in1 <= "0000000010000000"; -- 0.5
|
||||
in2 <= "0000000010000000"; -- 0.5
|
||||
wait for clock_period;
|
||||
in1 <= to_sfixed (6.5, sfixed16'high, sfixed16'low); -- 6.5
|
||||
in2 <= "0000000010000000"; -- 0.5
|
||||
wait for clock_period;
|
||||
-- resize
|
||||
cmd <= "1000";
|
||||
in1 <= to_sfixed (5.25, in1);
|
||||
in2 <= to_sfixed (-5.25, in2);
|
||||
wait for clock_period;
|
||||
in1 <= to_sfixed (21.125, in1);
|
||||
in2 <= to_sfixed (21.125, in2);
|
||||
wait for clock_period;
|
||||
in2 <= (in2'high => '0', in2'high-1 => '0', others => '0');
|
||||
cmd <= "1001"; -- SIGNED
|
||||
in1 <= to_sfixed (6.25, in1);
|
||||
wait for clock_period;
|
||||
in2 <= (in2'high => '0', in2'high-1 => '1', others => '0');
|
||||
cmd <= "1001"; -- UNSIGNED
|
||||
in1 <= to_sfixed (7.25, in1);
|
||||
wait for clock_period;
|
||||
in2 <= (in2'high => '1', in2'high-1 => '0', others => '0');
|
||||
cmd <= "1001"; -- SIGNED
|
||||
in1 <= to_sfixed (6.25, in1);
|
||||
wait for clock_period;
|
||||
in2 <= (in2'high => '1', in2'high-1 => '1', others => '0');
|
||||
cmd <= "1001"; -- UNSIGNED
|
||||
in1 <= to_sfixed (7.25, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1010";
|
||||
in2 <= (in2'high => '0', in2'high-1 => '0', others => '0');
|
||||
in1 <= to_sfixed (3, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1010";
|
||||
in2 <= (in2'high => '0', in2'high-1 => '1', others => '0');
|
||||
in1 <= to_sfixed (5, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1010";
|
||||
in2 <= (in2'high => '1', in2'high-1 => '0', others => '0');
|
||||
in1 <= to_sfixed (-5.5, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1010";
|
||||
in2 <= (in2'high => '1', in2'high-1 => '1', others => '0');
|
||||
in1 <= to_sfixed (7.25, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1010"; -- abs (mod)
|
||||
in2 <= (in2'high => '1', in2'high-1 => '0', others => '0');
|
||||
in1 <= to_sfixed (-42, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1011"; -- mod
|
||||
in1 <= to_sfixed (6.25, in1);
|
||||
in2 <= to_sfixed (6, in2);
|
||||
wait for clock_period;
|
||||
cmd <= "1100"; -- REM
|
||||
in1 <= to_sfixed (6.25, in1);
|
||||
in2 <= to_sfixed (6, in2);
|
||||
wait for clock_period;
|
||||
cmd <= "1101"; -- srl
|
||||
in1 <= to_sfixed (5.25, in1);
|
||||
in2 <= to_sfixed (-1, in2);
|
||||
wait for clock_period;
|
||||
cmd <= "1110"; -- sra
|
||||
in1 <= to_sfixed (-7.25, in1);
|
||||
in2 <= to_sfixed (1, in2);
|
||||
wait for clock_period;
|
||||
cmd <= "1111"; -- compare
|
||||
in1 <= to_sfixed (42, in1);
|
||||
in2 <= to_sfixed (42, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_sfixed (45, in1);
|
||||
in2 <= to_sfixed (90, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_sfixed (3.125, in1);
|
||||
in2 <= (others => '0');
|
||||
wait for clock_period;
|
||||
in1 <= "0110111110101111";
|
||||
in2 <= "1111111111111111";
|
||||
wait for clock_period;
|
||||
in1 <= (others => '0');
|
||||
in2 <= (others => '0');
|
||||
wait for clock_period;
|
||||
in1 <= "0000111000000000";
|
||||
in2 <= "0000111000000000";
|
||||
wait for clock_period;
|
||||
in1 <= (others => '1');
|
||||
in2 <= (others => '1');
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
|
||||
wait for clock_period;
|
||||
cmd <= "0000"; -- add mode
|
||||
in1 <= (others => '0');
|
||||
in2 <= (others => '0');
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait;
|
||||
end process tester;
|
||||
|
||||
-- purpose: check the output of the tester
|
||||
-- type : combinational
|
||||
-- inputs :
|
||||
-- outputs:
|
||||
checktest: process is
|
||||
constant fxzero : sfixed16 := (others => '0'); -- zero
|
||||
variable chks16 : sfixed16; -- variable
|
||||
variable sm1, sm2 : sfixed7; -- small fixed point
|
||||
begin -- process checktest
|
||||
wait for clock_period/2.0;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
waitloop: while (out1 = fxzero) loop
|
||||
wait for clock_period;
|
||||
end loop waitloop;
|
||||
chks16 := to_sfixed ((3.0+6.5), sfixed16'high, sfixed16'low);
|
||||
report_error ( "3.0 + 6.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed ((6.5 - 3.0), sfixed16'high, sfixed16'low);
|
||||
report_error ( "6.5 - 3.0 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed ((6.5 * 3.0), sfixed16'high, sfixed16'low);
|
||||
report_error ( "6.5 * 3.0 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed (1, sfixed16'high, sfixed16'low);
|
||||
report_error ( "0.5 + 0.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed (6.14, sfixed16'high, sfixed16'low);
|
||||
report_error ( "3.14 + 3 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := "0000000100000000";
|
||||
report_error ( "0.5/0.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed (-1, sfixed16'high, sfixed16'low);
|
||||
report_error ( "-0.5/0.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed ((3.0+6.5), sfixed16'high, sfixed16'low);
|
||||
report_error ( "3.0 + 6.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed ((6.5 - 3.0), sfixed16'high, sfixed16'low);
|
||||
report_error ( "6.5 - 3.0 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed ((6.5 * 3.0), sfixed16'high, sfixed16'low);
|
||||
report_error ( "6.5 * 3.0 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed (1, sfixed16'high, sfixed16'low);
|
||||
report_error ( "0.5 + 0.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed (6.14, sfixed16'high, sfixed16'low);
|
||||
report_error ( "3.14 + 3 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := "0000000100000000";
|
||||
report_error ( "0.5/0.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
chks16 := to_sfixed (13, sfixed16'high, sfixed16'low);
|
||||
report_error ( "6.5/0.5 error",
|
||||
out1,
|
||||
chks16);
|
||||
wait for clock_period;
|
||||
-- resize test
|
||||
sm1 := out1 (7 downto 1);
|
||||
sm2 := to_sfixed (5.25, sm2);
|
||||
report_error ( "resize 1 error", sm1, sm2);
|
||||
sm1 := out1 (-1 downto -7);
|
||||
sm2 := to_sfixed (-5.25, sm2);
|
||||
report_error ( "resize 2 error", sm1, sm2);
|
||||
wait for clock_period;
|
||||
sm1 := out1 (7 downto 1);
|
||||
sm2 := "0101001"; -- wrapped
|
||||
-- sm2 := to_sfixed (21.125, sm2, 0, false, false); -- wrap, no round
|
||||
report_error ( "resize 1 error", sm1, sm2);
|
||||
sm1 := out1 (-1 downto -7);
|
||||
sm2 := "0111111"; -- saturate
|
||||
report_error ( "resize 2 error", sm1, sm2);
|
||||
wait for clock_period;
|
||||
-- to_signed and back
|
||||
report_error ("to_signed(6.25)", out1, to_sfixed (6, out1));
|
||||
wait for clock_period;
|
||||
-- to_unsigned and back
|
||||
report_error ("to_unsigned(7.25)", out1, to_sfixed (7, out1));
|
||||
wait for clock_period;
|
||||
-- to_integer and back
|
||||
report_error ("to_signed(6.25)", out1, to_sfixed (6, out1));
|
||||
wait for clock_period;
|
||||
-- to_integer(ufixed) and back
|
||||
report_error ("to_unsigned(7.25)", out1, to_sfixed (7, out1));
|
||||
wait for clock_period;
|
||||
report_error ("1/3", out1, to_sfixed (1.0/3.0, out1'high, -7));
|
||||
wait for clock_period;
|
||||
report_error ("unsigned 1/5", out1, to_sfixed (1.0/5.0, out1));
|
||||
wait for clock_period;
|
||||
report_error ("abs (-5.5)", out1, to_sfixed (5.5, out1));
|
||||
wait for clock_period;
|
||||
report_error ("-7.25", out1, to_sfixed (-7.25, out1));
|
||||
wait for clock_period;
|
||||
report_error ("abs(-42)", out1, to_sfixed (42, out1));
|
||||
wait for clock_period;
|
||||
report_error ("6.25 mod 6", out1, to_sfixed (0.25, out1));
|
||||
wait for clock_period;
|
||||
report_error ("6.25 rem 6", out1, to_sfixed (0.25, out1));
|
||||
wait for clock_period;
|
||||
chks16 := "0000101010000000";
|
||||
report_error ("5.25 srl -1", out1, chks16);
|
||||
wait for clock_period;
|
||||
chks16 := "1111110001100000";
|
||||
report_error ("-7.25 sra 1", out1, chks16);
|
||||
wait for clock_period;
|
||||
-- 7654321012345678
|
||||
chks16 := "0111000000110001";
|
||||
assert (std_match (out1, chks16))
|
||||
report "42=42 compare " & CR
|
||||
& "Actual " & to_string(out1) & CR
|
||||
& "Expected " & to_string(chks16) severity error;
|
||||
wait for clock_period;
|
||||
chks16 := "------0001010110";
|
||||
assert (std_match (out1, chks16))
|
||||
report "45=90 compare " & CR
|
||||
& "Actual " & to_string(out1) & CR
|
||||
& "Expected " & to_string(chks16) severity error;
|
||||
wait for clock_period;
|
||||
chks16 := "------1010101010";
|
||||
assert (std_match (out1, chks16))
|
||||
report "3.125=0 compare " & CR
|
||||
& "Actual " & to_string(out1) & CR
|
||||
& "Expected " & to_string(chks16) severity error;
|
||||
wait for clock_period;
|
||||
-- 7654321012345678
|
||||
chks16 := "0--1010000101010";
|
||||
assert (std_match (out1, chks16))
|
||||
report "pattern1 compare " & CR
|
||||
& "Actual " & to_string(out1) & CR
|
||||
& "Expected " & to_string(chks16) severity error;
|
||||
wait for clock_period;
|
||||
-- 7654321012345678
|
||||
chks16 := "0001100000110001";
|
||||
assert (std_match (out1, chks16))
|
||||
report "zero = zero " & CR
|
||||
& "Actual " & to_string(out1) & CR
|
||||
& "Expected " & to_string(chks16) severity error;
|
||||
wait for clock_period;
|
||||
-- 7654321012345678
|
||||
chks16 := "1111000000110001";
|
||||
assert (std_match (out1, chks16))
|
||||
report "pattern2 compare " & CR
|
||||
& "Actual " & to_string(out1) & CR
|
||||
& "Expected " & to_string(chks16) severity error;
|
||||
wait for clock_period;
|
||||
-- 7654321012345678
|
||||
chks16 := "0111000000110001";
|
||||
assert (std_match (out1, chks16))
|
||||
report "-1 = -1 " & CR
|
||||
& "Actual " & to_string(out1) & CR
|
||||
& "Expected " & to_string(chks16) severity error;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
assert (false) report "Testing complete" severity note;
|
||||
stop_clock <= true;
|
||||
wait;
|
||||
end process checktest;
|
||||
end architecture testbench;
|
||||
@@ -0,0 +1,892 @@
|
||||
-------------------------------------------------------------------------------
|
||||
-- test routine for the post synthesis 32 bit multiply
|
||||
-------------------------------------------------------------------------------
|
||||
|
||||
entity test_float_synth is
|
||||
generic (
|
||||
quiet : BOOLEAN := false);
|
||||
end entity test_float_synth;
|
||||
|
||||
use std.textio.all;
|
||||
library ieee, ieee_proposed;
|
||||
use ieee.math_real.all;
|
||||
use ieee.std_logic_1164.all;
|
||||
use ieee.numeric_std.all;
|
||||
use ieee_proposed.fixed_float_types.all;
|
||||
use ieee_proposed.fixed_pkg.all;
|
||||
use ieee_proposed.float_pkg.all;
|
||||
|
||||
--library modelsim_lib;
|
||||
--use modelsim_lib.util.all;
|
||||
|
||||
architecture testbench of test_float_synth is
|
||||
subtype fp16 is float (6 downto -9); -- 16 bit
|
||||
function reverse (
|
||||
inpvec : STD_LOGIC_VECTOR (0 to 31))
|
||||
return float32 is
|
||||
variable result : float32;
|
||||
begin
|
||||
for i in 0 to 31 loop
|
||||
result (i-23) := inpvec(i);
|
||||
end loop; -- i
|
||||
return result;
|
||||
end function reverse;
|
||||
|
||||
-- purpose: converts an float32 into a std_logic_vector
|
||||
-- function to_slv (
|
||||
-- input : float32) -- float32 input
|
||||
-- return std_logic_vector is
|
||||
-- variable result : std_logic_vector (31 downto 0); -- result
|
||||
-- begin -- function to_slv
|
||||
-- floop: for i in float32'range loop
|
||||
-- result (i + fp_fraction_width) := input (i);
|
||||
-- end loop floop;
|
||||
-- return result;
|
||||
-- end function to_slv;
|
||||
|
||||
-- purpose: converts a std_logic_vector to an float32
|
||||
function to_float32x (
|
||||
signal input : STD_LOGIC_VECTOR (31 downto 0))
|
||||
return float32 is
|
||||
variable result : float32;
|
||||
begin -- function to_float32x
|
||||
return to_float (input, float32'high, -float32'low);
|
||||
end function to_float32x;
|
||||
|
||||
procedure report_error (
|
||||
constant errmes : STRING; -- error message
|
||||
actual : in float32; -- data from algorithm
|
||||
constant expected : float32) is -- reference data
|
||||
begin -- function report_error
|
||||
assert actual = expected
|
||||
report errmes & " miscompare" & CR &
|
||||
"Actual " & to_string (actual) & " ("
|
||||
& REAL'image(to_real(actual))& ") /= " & CR &
|
||||
"Expected " & to_string (expected) & " ("
|
||||
& REAL'image(to_real(expected))& ")"
|
||||
severity error;
|
||||
return;
|
||||
end procedure report_error;
|
||||
procedure report_error16 (
|
||||
constant errmes : STRING; -- error message
|
||||
actual : in fp16; -- data from algorithm
|
||||
constant expected : fp16) is -- reference data
|
||||
begin -- function report_error
|
||||
assert actual = expected
|
||||
report errmes & " miscompare" & CR &
|
||||
"Actual " & to_string (actual) & " ("
|
||||
& REAL'image(to_real(actual))& ") /= " & CR &
|
||||
"Expected " & to_string (expected) & " ("
|
||||
& REAL'image(to_real(expected))& ")"
|
||||
severity error;
|
||||
return;
|
||||
end procedure report_error16;
|
||||
|
||||
component float_synth is
|
||||
port (
|
||||
in1, in2 : in STD_LOGIC_VECTOR(31 downto 0); -- inputs
|
||||
out1 : out STD_LOGIC_VECTOR(31 downto 0); -- output
|
||||
cmd : in STD_LOGIC_VECTOR (3 downto 0);
|
||||
clk, rst_n : in STD_ULOGIC); -- clk and reset
|
||||
end component float_synth;
|
||||
for all : float_synth
|
||||
use entity work.float_synth(rtl);
|
||||
constant clock_period : TIME := 500 ns; -- clock period
|
||||
signal stop_clock : BOOLEAN := false; -- stop the clock
|
||||
signal out1real : REAL; -- real version
|
||||
signal in1, in2 : float32; -- inputs
|
||||
signal out1 : float32; -- output
|
||||
constant zero0 : float32 := (others => '0'); -- zero
|
||||
signal cmd : STD_LOGIC_VECTOR (3 downto 0); -- command
|
||||
signal clk, rst_n : STD_ULOGIC; -- clk and reset
|
||||
signal in1slv, in2slv, out1slv : STD_LOGIC_VECTOR(31 downto 0);
|
||||
signal indelay : float32; -- spied signal
|
||||
begin -- architecture testbench
|
||||
out1real <= to_real (out1);
|
||||
in1slv <= to_slv(in1);
|
||||
in2slv <= to_slv(in2);
|
||||
out1 <= to_float32x(out1slv);
|
||||
DUT : float_synth
|
||||
port map (
|
||||
in1 => in1slv, -- [in float32] inputs
|
||||
in2 => in2slv, -- [in float32] inputs
|
||||
out1 => out1slv, -- [out float32] output
|
||||
cmd => cmd,
|
||||
clk => clk, -- [in std_ulogic] clk and reset
|
||||
rst_n => rst_n); -- [in std_ulogic] clk and reset
|
||||
|
||||
-- spy_process : process
|
||||
-- begin
|
||||
-- signal_force ("/DUT/in2reg3", "00000000000000000000000000000000",
|
||||
-- 500 ns, freeze, 5000 ns, 1);
|
||||
-- wait;
|
||||
-- end process spy_process;
|
||||
|
||||
-- purpose: clock driver
|
||||
-- type : combinational
|
||||
-- inputs :
|
||||
-- outputs:
|
||||
clkprc : process is
|
||||
|
||||
begin -- process clkprc
|
||||
if (not stop_clock) then
|
||||
clk <= '0';
|
||||
wait for clock_period/2.0;
|
||||
clk <= '1';
|
||||
wait for clock_period/2.0;
|
||||
else
|
||||
wait;
|
||||
end if;
|
||||
end process clkprc;
|
||||
|
||||
-- purpose: reset driver
|
||||
-- type : combinational
|
||||
-- inputs :
|
||||
-- outputs:
|
||||
reset_proc : process is
|
||||
|
||||
begin -- process reset_proc
|
||||
|
||||
rst_n <= '0';
|
||||
wait for clock_period * 2.0;
|
||||
rst_n <= '1';
|
||||
wait;
|
||||
end process reset_proc;
|
||||
|
||||
-- purpose: main test loop
|
||||
-- type : combinational
|
||||
-- inputs :
|
||||
-- outputs:
|
||||
tester : process is
|
||||
|
||||
begin -- process tester
|
||||
cmd <= "0110"; -- 16 bit to float32 mode
|
||||
in1 <= "10000000000000000000001000101111"; -- 4.33 ufixed
|
||||
in2 <= "00000000000000000000000000000100"; -- 4
|
||||
floop1: for i in 1 to 100 loop
|
||||
wait for clock_period;
|
||||
end loop floop1;
|
||||
cmd <= "0110"; -- 16 bit to float32 mode
|
||||
in1 <= "10000000000000000000001000101011"; -- 4.33 ufixed
|
||||
in2 <= "00000000000000000000000000000100"; -- 4
|
||||
floop2: for i in 1 to 100 loop
|
||||
wait for clock_period;
|
||||
end loop floop2;
|
||||
cmd <= "0010";
|
||||
in1 <= reverse("00000000000000000000101100000010"); -- 6.5
|
||||
in2 <= reverse("00000000000000000001010001000010"); -- 42
|
||||
wait for clock_period;
|
||||
in1 <= reverse("00000000000000000001010001000010"); -- 42
|
||||
in2 <= reverse("00000000000000000000101100000010"); -- 6.5
|
||||
wait for clock_period;
|
||||
in1 <= reverse("00000000000000000000101100000010"); -- 6.5
|
||||
in2 <= reverse("00000000000000000000101100000010"); -- 6.5
|
||||
wait for clock_period;
|
||||
in1 <= reverse("00000000000000000001010001000010"); -- 42
|
||||
in2 <= "01000000000000000000000000000000"; -- 2
|
||||
wait for clock_period;
|
||||
in1 <= "00111110101010101010101010101011"; -- 1/3
|
||||
in2 <= "01000000000000000000000000000000"; -- 2
|
||||
wait for clock_period;
|
||||
in1 <= reverse("00000000000000000001010001000010"); -- 42
|
||||
in2 <= reverse("00000000000000000000101100000011"); -- -6.5
|
||||
wait for clock_period;
|
||||
in1 <= reverse("10000000000000000000000000000000"); -- 2**-149
|
||||
in2 <= "11000000000000000000000000000000"; -- -2.0
|
||||
wait for clock_period;
|
||||
in1 <= reverse("00000000000000000000001000000000"); -- 2**-127
|
||||
in2 <= "00111110100000000000000000000000"; -- 0.25
|
||||
wait for clock_period;
|
||||
in1 <= reverse("00000000000000000001010001000010"); -- 42
|
||||
in2 <= reverse("00000000000000000000101100000010"); -- 6.5
|
||||
wait for clock_period;
|
||||
cmd <= "0001"; -- subtract mode
|
||||
in2 <= "01001011111001110011000110011011"; -- 30303030
|
||||
in1 <= "01001011111001110011000110011100"; -- 30303033
|
||||
wait for clock_period;
|
||||
in1 <= reverse("00000000000000000000101100000010"); -- 6.5
|
||||
in2 <= "01000000100000000000000000000000"; -- 4
|
||||
wait for clock_period;
|
||||
in2 <= reverse("00000000000000000000101100000010"); -- 6.5
|
||||
in1 <= "01000000100000000000000000000000"; -- 4
|
||||
wait for clock_period;
|
||||
in1 <= "01000000100010101010101010101011"; -- 4.333333
|
||||
in2 <= "00111110101010101010101010101011"; -- 1/3
|
||||
wait for clock_period;
|
||||
cmd <= "0000"; -- add mode
|
||||
in1 <= "00111110101010101010101010101011"; -- 1/3
|
||||
in2 <= "01000000000000000000000000000000"; -- 2
|
||||
wait for clock_period;
|
||||
in2 <= "00111110101010101010101010101011"; -- 1/3
|
||||
in1 <= "01000000000000000000000000000000"; -- 2
|
||||
wait for clock_period;
|
||||
in1 <= "00000000100000000000000000000001"; -- 2**-126
|
||||
in2 <= "01000000100000000000000000000001"; -- 4+
|
||||
wait for clock_period;
|
||||
cmd <= "0011"; -- divide mode
|
||||
in1 <= "00111111100000000000000000000000"; -- 1.0
|
||||
in2 <= "01000000010000000000000000000000"; -- 3.0
|
||||
wait for clock_period;
|
||||
in1 <= "01001100000011001011110001001111"; -- 36892987
|
||||
in2 <= "00000000010000000000000000000000"; -- 2**-127
|
||||
wait for clock_period;
|
||||
in1 <= "10111110101010101010101010101011"; -- -1/3
|
||||
in2 <= "01000000000000000000000000000000"; -- 2
|
||||
wait for clock_period;
|
||||
cmd <= "0100"; -- 32 to 16 conversion mode
|
||||
in1 <= "00111111100000000000000000000000"; -- 1.0
|
||||
in2 <= (others => '0');
|
||||
wait for clock_period;
|
||||
in1 <= "10111110101010101010101010101011"; -- -1/3, no round
|
||||
wait for clock_period;
|
||||
in1 <= "10111110101010101010101010101011"; -- -1/3
|
||||
in2 <= "00000000000000000000000000000001"; -- opcode 1
|
||||
wait for clock_period;
|
||||
cmd <= "0101"; -- conversion mode
|
||||
in1 <= "00111111100000000000000000000000"; -- 1.0
|
||||
in2 <= "01000000000000000000000000000000"; -- opcode zero
|
||||
wait for clock_period;
|
||||
in1 <= "01000010001010000000000000000000"; -- 42.0
|
||||
in2 <= "00000000000000000000000000000001"; -- opcode 1
|
||||
wait for clock_period;
|
||||
in1 <= "10111111100000000000000000000000"; -- -1.0
|
||||
in2 <= "00000000000000000000000000000010"; -- 2
|
||||
wait for clock_period;
|
||||
in1 <= "00111111100000000000000000000000"; -- 1.0
|
||||
in2 <= "00000000000000000000000000000011"; -- 3
|
||||
wait for clock_period;
|
||||
in1 <= "01000000100010101010101010101011"; -- 4.333333
|
||||
in2 <= "00000000000000000000000000000100"; -- 4
|
||||
wait for clock_period;
|
||||
in1 <= "00111111100000000000000000000000"; -- 1.0
|
||||
in2 <= "00000000000000000000000000000101"; -- 5
|
||||
wait for clock_period;
|
||||
in1 <= "11000000100010101010101010101011"; -- -4.333333
|
||||
in2 <= "00000000000000000000000000000110"; -- 6 to_sfixed
|
||||
wait for clock_period;
|
||||
in1 <= "00111111100000000000000000000000"; -- 1.0
|
||||
in2 <= "00000000000000000000000000000111"; -- 7 to_sfixed
|
||||
wait for clock_period;
|
||||
cmd <= "0110"; -- 16 bit to float32 mode
|
||||
in1 <= "00000000000000000000000000000011"; -- 3
|
||||
in2 <= "01000000000000000000000000000000"; -- mode 0
|
||||
wait for clock_period;
|
||||
in1 <= "00000000000000000000000000000100"; -- 4
|
||||
in2 <= "01000000000000000000000000000001"; -- 1
|
||||
wait for clock_period;
|
||||
in1 <= "00000000000000001111111111111110"; -- -2
|
||||
in2 <= "01000000000000000000000000000010"; -- 2 to_float(signed)
|
||||
wait for clock_period;
|
||||
in1 <= "00000000000000000000000000000100"; -- 4
|
||||
in2 <= "01000000000000000000000000000011"; -- mode 3
|
||||
wait for clock_period;
|
||||
in1 <= "10000000000000000000001000101011"; -- 4.33 ufixed
|
||||
in2 <= "00000000000000000000000000000100"; -- 4
|
||||
wait for clock_period;
|
||||
in1 <= "10100000000000000000000010000000"; -- 1.0 ufixed
|
||||
in2 <= "00000000000000000000000000000101"; -- 5
|
||||
wait for clock_period;
|
||||
in1 <= "11000000000000001111110111010101"; -- -4.333 sfixed
|
||||
in2 <= "00000000000000000000000000000110"; -- 6
|
||||
wait for clock_period;
|
||||
in1 <= "10100000000000000000000010000000"; -- 1.0 sfixed
|
||||
in2 <= "00000000000000000000000000000111"; -- 7
|
||||
wait for clock_period;
|
||||
cmd <= "0111"; -- Mod
|
||||
in1 <= "00000000000000000000000000000011"; --
|
||||
in2 <= "00000000000000000000000000000011"; --
|
||||
wait for clock_period;
|
||||
in1 <= "00000010001100101111000100111011"; -- 36892987
|
||||
in2 <= "00000010001100101111000100111011"; -- 36892987
|
||||
wait for clock_period;
|
||||
in1 <= "11000000100010101010101010101011"; -- -4.333333
|
||||
in2 <= "01000000100000000000000000000000"; -- 4
|
||||
wait for clock_period;
|
||||
cmd <= "1000"; -- rem
|
||||
in1 <= "00000000000000000000000000000011"; --
|
||||
in2 <= "00000000000000000000000000000011"; --
|
||||
wait for clock_period;
|
||||
in1 <= "00000010001100101111000100111011"; -- 36892987
|
||||
in2 <= "00000010001100101111000100111011"; -- 36892987
|
||||
wait for clock_period;
|
||||
in1 <= "11000000100010101010101010101011"; -- -4.333333
|
||||
in2 <= "01000000100000000000000000000000"; -- 4
|
||||
wait for clock_period;
|
||||
cmd <= "1001"; -- constants conversion
|
||||
in2 <= "11000000000000000000000000000000"; -- command 0
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000001"; -- command 1
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000010"; -- command 2
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000011"; -- command 3
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000100"; -- command 4
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000101"; -- command 5
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000110"; -- command 6
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000111"; -- command 7
|
||||
wait for clock_period;
|
||||
cmd <= "1010"; -- conversions
|
||||
in1 <= to_float (1, in1);
|
||||
in2 <= "11000000000000000000000000000000"; -- command 0
|
||||
wait for clock_period;
|
||||
in1 <= to_float (-2, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000001"; -- command 1
|
||||
wait for clock_period;
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "00010000000000000000000000000010"; -- command 2 scalb
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11110000000000000000000000000010"; -- command 2 scalb
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000011"; -- command 3 logb
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000011"; -- command 3 logb
|
||||
in1 <= to_float (0.25, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000100"; -- 4 nextafter
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (4, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000101"; -- 5 nextafter
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (-4, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000110"; -- 6 nextafter
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (4, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "11000000000000000000000000000111"; -- 7 nextafter
|
||||
in1 <= to_float (1, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (-4, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1011"; -- copy sign
|
||||
in1 <= to_float (2, in1);
|
||||
in2 <= to_float (2, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (-3, in1);
|
||||
in2 <= to_float (3, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (4, in1);
|
||||
in2 <= to_float (-4, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (-5, in1);
|
||||
in2 <= to_float (-5, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1100"; -- compare test
|
||||
in1 <= to_float (15, in1);
|
||||
in2 <= to_float (15, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (15.5, in1);
|
||||
in2 <= to_float (-2, in1);
|
||||
wait for clock_period;
|
||||
in1 <= to_float (-2, in1);
|
||||
in2 <= to_float (2, in1);
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= to_float (-2, in1);
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000001"; -- NAN
|
||||
in2 <= to_float (-2, in1);
|
||||
wait for clock_period;
|
||||
cmd <= "1101"; -- boolean test
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000000"; -- command 0 , not
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000001"; -- command 1, and
|
||||
wait for clock_period;
|
||||
in1 <= "01111111000000000000000000000000"; -- + inf
|
||||
in2 <= "00111111000000000000000000000010"; -- command 2, or
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000011"; -- command 3, nand
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000100"; -- command 4, nor
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000101"; -- command 5, xor
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000110"; -- command 6, xnor
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000111"; -- command 7, xor '1'
|
||||
wait for clock_period;
|
||||
cmd <= "1110"; -- reduce and vector test test
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000000"; -- command 0,
|
||||
wait for clock_period;
|
||||
in1 <= "11111111111111111111111111111111"; -- all 1
|
||||
wait for clock_period;
|
||||
in1 <= "10000000000000000000000000000000"; -- -0
|
||||
wait for clock_period;
|
||||
in1 <= "00000000000000000000000000000000"; -- 0
|
||||
wait for clock_period;
|
||||
in1 <= "01111111100000000000000000000000"; -- + inf
|
||||
in2 <= "00111111100000000000000000000001"; -- command 1, and '0'
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000001"; -- command 1, and '1'
|
||||
wait for clock_period;
|
||||
in2 <= "00111111100000000000000000000010"; -- command 2, or '0'
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000010"; -- command 2, or '1'
|
||||
wait for clock_period;
|
||||
in2 <= "00111111100000000000000000000011"; -- command 3, nand '0'
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000011"; -- command 3, nand '1'
|
||||
wait for clock_period;
|
||||
in2 <= "00111111100000000000000000000100"; -- command 4, nor '0'
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000100"; -- command 4, nor '1'
|
||||
wait for clock_period;
|
||||
in2 <= "00111111100000000000000000000101"; -- command 5, xor '0'
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000101"; -- command 5, xor '1'
|
||||
wait for clock_period;
|
||||
in2 <= "00111111100000000000000000000110"; -- command 6, xnor '0'
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000110"; -- command 6, xnor '1'
|
||||
wait for clock_period;
|
||||
in2 <= "00111111100000000000000000000111"; -- command 7, and '0'
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000111"; -- command 7, and '1'
|
||||
wait for clock_period;
|
||||
cmd <= "1111"; -- add and mult by constant
|
||||
in2 <= "10111111100000000000000000000000"; -- command 0, + 1
|
||||
in1 <= to_float (2, in1);
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000001"; -- command 1, 1 +
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000010"; -- command 2, + 1.0
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000011"; -- command 3, 1.0 +
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000100"; -- command 4, * 1
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000101"; -- command 5, 1 *
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000110"; -- command 6, * 1.0
|
||||
wait for clock_period;
|
||||
in2 <= "10111111100000000000000000000111"; -- command 7, 1.0 *
|
||||
wait for clock_period;
|
||||
|
||||
|
||||
wait for clock_period;
|
||||
cmd <= "0000"; -- add mode
|
||||
in1 <= (others => '0');
|
||||
in2 <= (others => '0');
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait for clock_period;
|
||||
wait;
|
||||
end process tester;
|
||||
|
||||
-- purpose: check the output of the tester
|
||||
-- type : combinational
|
||||
-- inputs :
|
||||
-- outputs:
|
||||
checktest : process is
|
||||
variable out16, out16t : fp16; -- 16 bit fp variables
|
||||
variable out1t, out2t : float32; -- 32 bit float
|
||||
variable s16, s16t : SIGNED(7 downto 0); -- 7 bit SIGNED
|
||||
variable latency : INTEGER := 0;
|
||||
begin -- process checktest
|
||||
wait for clock_period/2.0;
|
||||
floop3: for i in 1 to 100 loop
|
||||
wait for clock_period;
|
||||
end loop floop3;
|
||||
latency := 0;
|
||||
out2t := "01000000100010101100000000000000";
|
||||
wl1: while out1 /= out2t loop
|
||||
wait for clock_period;
|
||||
latency := latency + 1;
|
||||
assert latency /= 100 report "After 100 loops, pattern never found"
|
||||
severity failure;
|
||||
end loop wl1;
|
||||
report "Latency was " & INTEGER'image(latency) severity note;
|
||||
floop4: for i in 1 to 100 loop
|
||||
wait for clock_period;
|
||||
end loop floop4;
|
||||
report_error ("42 * 6.5 error",
|
||||
out1,
|
||||
to_float (273, out1));
|
||||
wait for clock_period;
|
||||
report_error ("6.5 * 42 error",
|
||||
out1,
|
||||
to_float (273, out1'high, -out1'low));
|
||||
wait for clock_period;
|
||||
report_error ("Multiply 42.25 miscompare",
|
||||
out1,
|
||||
"01000010001010010000000000000000"); -- 42.25
|
||||
wait for clock_period;
|
||||
report_error ("Multiply 84 miscompare",
|
||||
out1,
|
||||
"01000010101010000000000000000000"); -- 84
|
||||
wait for clock_period;
|
||||
report_error ("Multiply 2/3 miscompare",
|
||||
out1,
|
||||
"00111111001010101010101010101011"); -- 2/3
|
||||
wait for clock_period;
|
||||
report_error ("Multiply -273 miscompare",
|
||||
out1,
|
||||
"11000011100010001000000000000000"); -- -273
|
||||
wait for clock_period;
|
||||
report_error ("mult 2**-148 test miscompare",
|
||||
out1,
|
||||
reverse("01000000000000000000000000000001")); -- -2*-148
|
||||
wait for clock_period;
|
||||
report_error ("Multiply 2**-129 miscompare",
|
||||
out1,
|
||||
reverse("00000000000000000000100000000000")); -- 2**-129
|
||||
wait for clock_period;
|
||||
report_error ("6.5 * 42 error",
|
||||
out1,
|
||||
to_float (273, out1));
|
||||
wait for clock_period;
|
||||
report_error ("Subtract 30303033 - 30303030 miscompare",
|
||||
out1,
|
||||
"01000000000000000000000000000000"); -- 2 (not 3, rounding)
|
||||
wait for clock_period;
|
||||
report_error ("Subtract 6.5 - 4 miscompare",
|
||||
out1,
|
||||
"01000000001000000000000000000000"); -- 2.5
|
||||
wait for clock_period;
|
||||
report_error ("Subtract 4 - 6.5 miscompare",
|
||||
out1,
|
||||
"11000000001000000000000000000000"); -- -2.5
|
||||
wait for clock_period;
|
||||
report_error ("Subtract 4.333 - 1/3 miscompare",
|
||||
out1,
|
||||
"01000000100000000000000000000000"); -- 4
|
||||
wait for clock_period;
|
||||
report_error ("Add 2.333 miscompare",
|
||||
out1,
|
||||
"01000000000101010101010101010101"); -- 2.333333
|
||||
wait for clock_period;
|
||||
report_error ("Add 2.333 rev miscompare",
|
||||
out1,
|
||||
"01000000000101010101010101010101"); -- 2.333333
|
||||
wait for clock_period;
|
||||
report_error ("Add 4 + miscompare",
|
||||
out1,
|
||||
"01000000100000000000000000000001"); -- 4
|
||||
wait for clock_period;
|
||||
report_error ("div 1/3 test miscompare",
|
||||
out1,
|
||||
"00111110101010101010101010101011"); -- 1/3
|
||||
wait for clock_period;
|
||||
report_error ("div 369297/2**-126 test miscompare",
|
||||
out1,
|
||||
"01111111100000000000000000000000");
|
||||
wait for clock_period;
|
||||
report_error ("-1/6 test miscompare",
|
||||
out1, "10111110001010101010101010101011"); -- -1/6
|
||||
wait for clock_period;
|
||||
-- resize function
|
||||
out16 := to_float (to_slv (out1(-8 downto -23)), 6, 9);
|
||||
out16t := to_float (1, out16t);
|
||||
report_error16 ("1.0 fp16 converserion",
|
||||
out16, out16t);
|
||||
wait for clock_period;
|
||||
out16 := to_float (to_slv (out1(-8 downto -23)), 6, 9);
|
||||
out16t := to_float (arg => -1.0/3.0, size_res => out16t,
|
||||
round_style => round_zero);
|
||||
report_error16 ("-1/3 not rounded fp16 converserion",
|
||||
out16, out16t);
|
||||
wait for clock_period;
|
||||
out16 := to_float (to_slv (out1(-8 downto -23)), 6, 9);
|
||||
out16t := to_float (-1.0/3.0, out16t);
|
||||
report_error16 ("-1/3 fp16 converserion",
|
||||
out16, out16t);
|
||||
-- conversion test
|
||||
wait for clock_period;
|
||||
report_error ("1.0 to unsigned miscompare",
|
||||
out1, "00000000000000000000000000000001");
|
||||
wait for clock_period;
|
||||
report_error ("42 to unsigned miscompare",
|
||||
out1, "00100000000000000000000000101010");
|
||||
wait for clock_period;
|
||||
report_error ("-1.0 to signed miscompare",
|
||||
out1, "01000000000000001111111111111111");
|
||||
wait for clock_period;
|
||||
report_error ("1.0 to signed miscompare",
|
||||
out1, "01100000000000000000000000000001");
|
||||
wait for clock_period;
|
||||
report_error ("4.33 to ufixed miscompare",
|
||||
out1, "10000000000000000000001000101011");
|
||||
wait for clock_period;
|
||||
report_error ("1.0 to ufixed miscompare",
|
||||
out1, "10100000000000000000000010000000");
|
||||
wait for clock_period;
|
||||
report_error ("4.333 to sfixed miscompare",
|
||||
out1, "11000000000000001111110111010101");
|
||||
wait for clock_period;
|
||||
report_error ("1.0 to sfixed miscompare",
|
||||
out1, "11100000000000000000000010000000");
|
||||
wait for clock_period;
|
||||
report_error ("unsigned 3 to float miscompare",
|
||||
out1, to_float(3, out1));
|
||||
wait for clock_period;
|
||||
report_error ("unsigned 4 to float miscompare",
|
||||
out1, to_float(4, out1));
|
||||
wait for clock_period;
|
||||
report_error ("signed -2 to float miscompare",
|
||||
out1, to_float(-2, out1));
|
||||
wait for clock_period;
|
||||
report_error ("signed 4 to float miscompare",
|
||||
out1, to_float(4, out1));
|
||||
wait for clock_period;
|
||||
report_error ("ufixed 4.333 to float miscompare",
|
||||
out1, "01000000100010101100000000000000"); -- 4.333333
|
||||
wait for clock_period;
|
||||
report_error ("ufixed 1.0 to float miscompare",
|
||||
out1, "00111111100000000000000000000000"); -- 1.0
|
||||
wait for clock_period;
|
||||
report_error ("sfixed -4.333 to float miscompare",
|
||||
out1, "11000000100010101100000000000000"); -- -4.333333
|
||||
wait for clock_period;
|
||||
report_error ("sfixed 1.0 to float miscompare",
|
||||
out1, "00111111100000000000000000000000"); -- 1.0
|
||||
wait for clock_period;
|
||||
report_error ("denormal mod denormal miscompare",
|
||||
out1, zero0);
|
||||
wait for clock_period;
|
||||
report_error ("large mod large miscompare",
|
||||
out1, zero0);
|
||||
wait for clock_period;
|
||||
report_error ("-4.333 mod 4 miscompare",
|
||||
out1,
|
||||
from_string ("01000000011010101010101010101010", out1));
|
||||
wait for clock_period;
|
||||
report_error ("denormal rem denormal miscompare",
|
||||
out1, zero0);
|
||||
wait for clock_period;
|
||||
report_error ("large rem large miscompare",
|
||||
out1, zero0);
|
||||
wait for clock_period;
|
||||
out1t := "10111110101010101010101010110000";
|
||||
report_error ("-4.333 rem 4 miscompare",
|
||||
out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("to_float(0) miscompare",
|
||||
out1, zero0);
|
||||
wait for clock_period;
|
||||
report_error ("to_float(0.0) miscompare",
|
||||
out1, zero0);
|
||||
wait for clock_period;
|
||||
report_error ("to_float(8) miscompare",
|
||||
out1, to_float(8.0, out1));
|
||||
wait for clock_period;
|
||||
report_error ("to_float(8.0) miscompare",
|
||||
out1, to_float(8, out1));
|
||||
wait for clock_period;
|
||||
report_error ("to_float(-8) miscompare",
|
||||
out1, to_float(-8.0, out1));
|
||||
wait for clock_period;
|
||||
report_error ("to_float(-8.0) miscompare",
|
||||
out1, to_float(-8, out1));
|
||||
wait for clock_period;
|
||||
report_error ("to_float(27000) miscompare",
|
||||
out1, to_float(27000.0, out1));
|
||||
wait for clock_period;
|
||||
report_error ("to_float(PI) miscompare",
|
||||
out1, to_float(3.141592653589, out1));
|
||||
-- Conversion test
|
||||
wait for clock_period;
|
||||
report_error ("-1 miscompare",
|
||||
out1, to_float(-1, out1));
|
||||
wait for clock_period;
|
||||
report_error ("-(-2) miscompare",
|
||||
out1, to_float(2, out1));
|
||||
wait for clock_period;
|
||||
report_error ("abs(-2) miscompare",
|
||||
out1, to_float(2, out1));
|
||||
wait for clock_period;
|
||||
report_error ("abs(1) miscompare",
|
||||
out1, to_float(1, out1));
|
||||
wait for clock_period;
|
||||
report_error ("scalb (1, 1) miscompare",
|
||||
out1, to_float(2, out1));
|
||||
wait for clock_period;
|
||||
report_error ("scalb (1, -1) miscompare",
|
||||
out1, to_float(0.5, out1));
|
||||
wait for clock_period;
|
||||
s16 := SIGNED (to_slv (out1(-16 downto -23)));
|
||||
assert (s16 = 0) report "logb (1) returned "
|
||||
& to_string(to_sfixed(s16)) severity error;
|
||||
wait for clock_period;
|
||||
s16 := SIGNED (to_slv (out1(-16 downto -23)));
|
||||
assert (s16 = -2) report "logb (0.25) returned "
|
||||
& to_string(to_sfixed(s16)) severity error;
|
||||
wait for clock_period;
|
||||
out1t := "00111111100000000000000000000001";
|
||||
report_error ("nextafter (1, 1.5)", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01000000011111111111111111111111";
|
||||
report_error ("nextafter (4, 1.5)", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "00111111011111111111111111111111";
|
||||
report_error ("nextafter (1, -1.5)", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "11000000011111111111111111111111";
|
||||
report_error ("nextafter (-4, -1.5)", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "00111111100000000000000000000001";
|
||||
report_error ("nextafter (1, inf)", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01000000100000000000000000000001";
|
||||
report_error ("nextafter (4, inf)", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "00111111011111111111111111111111";
|
||||
report_error ("nextafter (1, neginf)", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "11000000100000000000000000000001";
|
||||
report_error ("nextafter (-4, neginf)", out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("Copysign (2,2)", out1, to_float(2, out1));
|
||||
wait for clock_period;
|
||||
report_error ("Copysign (-3,3)", out1, to_float(3, out1));
|
||||
wait for clock_period;
|
||||
report_error ("Copysign (4,-4)", out1, to_float(-4, out1));
|
||||
wait for clock_period;
|
||||
report_error ("Copysign (-5,-5)", out1, to_float(-5, out1));
|
||||
wait for clock_period;
|
||||
out1t := "10001110000000000000000000000000";
|
||||
report_error ("compare test 15, 15", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01101001000000000000000000000000";
|
||||
report_error ("compare test 15.5, -2", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01010100000000000000000000000000";
|
||||
report_error ("compare test -2, 2", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01101000010000000000000000000000";
|
||||
report_error ("compare test inf, -2", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01000000101000000000000000000000";
|
||||
report_error ("compare test NAN, -2", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10000000011111111111111111111111"; -- not + inf
|
||||
report_error ("not +inf", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "00111111100000000000000000000000"; -- and
|
||||
report_error ("and +inf", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01111111000000000000000000000010"; -- or
|
||||
report_error ("or +inf", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "11000000011111111111111111111111"; -- nand
|
||||
report_error ("nand +inf", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10000000011111111111111111111011"; -- nor
|
||||
report_error ("nor +inf", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01000000000000000000000000000101"; -- xor
|
||||
report_error ("xor +inf", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10111111111111111111111111111001"; -- xnor
|
||||
report_error ("xnor +inf", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10000000011111111111111111111111"; -- xnor '1'
|
||||
report_error ("+inf xor '1'", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01100100000000000000000000000000"; -- reduce test
|
||||
report_error ("_reduce test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10100100000000000000000000000000"; -- reduce test
|
||||
report_error ("_reduce all 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01101000000000000000000000000000"; -- reduce test
|
||||
report_error ("_reduce -0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01010100000000000000000000000000"; -- reduce test
|
||||
report_error ("_reduce 0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "00000000000000000000000000000000"; -- 0
|
||||
report_error ("and 0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01111111100000000000000000000000"; -- + inf
|
||||
report_error ("and 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01111111100000000000000000000000"; -- + inf
|
||||
report_error ("or 0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "11111111111111111111111111111111"; -- all 1
|
||||
assert (to_slv (out1) = to_slv (out1t))
|
||||
report "or 1 test error " & to_string (out1) & " /= "
|
||||
& to_string (out1t) severity error;
|
||||
wait for clock_period;
|
||||
out1t := "11111111111111111111111111111111"; -- all 1
|
||||
assert (to_slv (out1) = to_slv (out1t))
|
||||
report "nand 0 test error " & to_string (out1) & " /= "
|
||||
& to_string (out1t) severity error;
|
||||
wait for clock_period;
|
||||
out1t := "10000000011111111111111111111111"; -- - denormal
|
||||
report_error ("nand 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10000000011111111111111111111111"; -- - denormal
|
||||
report_error ("nor 0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "00000000000000000000000000000000"; -- 0
|
||||
report_error ("nor 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01111111100000000000000000000000"; -- + inf
|
||||
report_error ("xor 0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10000000011111111111111111111111"; -- - denormal
|
||||
report_error ("xor 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "10000000011111111111111111111111"; -- - denormal
|
||||
report_error ("xnor 0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01111111100000000000000000000000"; -- + inf
|
||||
report_error ("xnor 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "00000000000000000000000000000000"; -- 0
|
||||
report_error ("and 0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := "01111111100000000000000000000000"; -- + inf
|
||||
report_error ("and 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := to_float(3, out1t);
|
||||
report_error ("2 + 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("1 + 2 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("2 + 1.0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("1.0 + 2 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
out1t := to_float(2, out1t);
|
||||
report_error ("2 * 1 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("1 * 2 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("2 * 1.0 test", out1, out1t);
|
||||
wait for clock_period;
|
||||
report_error ("1.0 * 2 test", out1, out1t);
|
||||
|
||||
wait for clock_period;
|
||||
assert (false) report "Testing complete" severity note;
|
||||
stop_clock <= true;
|
||||
wait;
|
||||
end process checktest;
|
||||
end architecture testbench;
|
||||
@@ -0,0 +1,26 @@
|
||||
# -------------------------------------------------
|
||||
# Compile script for GHDL
|
||||
# -------------------------------------------------
|
||||
include ../make/defs.mk
|
||||
|
||||
# -------------------------------------------------
|
||||
# Global options
|
||||
# -------------------------------------------------
|
||||
LANG_STD := 93c
|
||||
IEEE_STD := standard
|
||||
WORK_LIB := unisim
|
||||
TARGET := unisim
|
||||
|
||||
# -------------------------------------------------
|
||||
# Target options
|
||||
# -------------------------------------------------
|
||||
SRCS := $(LIB_PATH)/unisims/unisim_VPKG.vhd
|
||||
SRCS += $(LIB_PATH)/unisims/unisim_VCOMP.vhd
|
||||
SRCS += $(LIB_PATH)/unisims/unisim_SMODEL.vhd
|
||||
SRCS += $(LIB_PATH)/unisims/unisim_VITAL.vhd
|
||||
|
||||
GHDL_OPTS := -fsynopsys -fexplicit
|
||||
|
||||
include ../make/ghdl.mk
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,23 @@
|
||||
FOLDER ?= lib
|
||||
|
||||
TARGETS = $(shell find $(FOLDER)/ -name "*.make")
|
||||
INSTR := $(foreach number,$(TARGETS),make -C $(shell dirname $(number)) -f $(shell basename $(number)) $(MAKECMDGOALS) &&) true
|
||||
|
||||
all:
|
||||
$(INSTR)
|
||||
|
||||
elaborate:
|
||||
$(INSTR)
|
||||
|
||||
run:
|
||||
$(INSTR)
|
||||
|
||||
run_wave:
|
||||
$(INSTR)
|
||||
|
||||
clean:
|
||||
$(INSTR)
|
||||
|
||||
mrproper:
|
||||
$(INSTR)
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
## NOTE: Do not edit this file.
|
||||
##
|
||||
vlib work
|
||||
vcom -explicit -93 "../src/core/ram_2c_2r_2w.vhd"
|
||||
vcom -explicit -93 "../src/core/j1.vhd"
|
||||
vcom -explicit -93 "../src/tb_j1.vhd"
|
||||
|
||||
vmap work
|
||||
|
||||
vsim -t 1ps -lib work tb_j1
|
||||
do {tb_j1.wave.do}
|
||||
view wave
|
||||
view structure
|
||||
view signals
|
||||
run 1us
|
||||
@@ -0,0 +1,58 @@
|
||||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -format Logic /tb_j1/sys_clk_i
|
||||
add wave -noupdate -format Logic /tb_j1/sys_rst_i
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/io_din
|
||||
add wave -noupdate -format Logic /tb_j1/io_rd
|
||||
add wave -noupdate -format Logic /tb_j1/io_wr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/io_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/io_dout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/inst_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/inst_din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/data_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/data_din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/data_dout
|
||||
add wave -noupdate -format Logic /tb_j1/data_we
|
||||
add wave -noupdate -format Logic /tb_j1/data_en
|
||||
add wave -noupdate -divider {J1 internals}
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/insn
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/immediate
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/ramrd
|
||||
add wave -noupdate -format Literal /tb_j1/uut/dsp
|
||||
add wave -noupdate -format Literal /tb_j1/uut/dsp2
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/st0
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/st02
|
||||
add wave -noupdate -format Logic /tb_j1/uut/dstkw2
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/pc
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/pc2
|
||||
add wave -noupdate -format Literal /tb_j1/uut/rsp
|
||||
add wave -noupdate -format Literal /tb_j1/uut/rsp2
|
||||
add wave -noupdate -format Logic /tb_j1/uut/rstkw2
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/rstkd2
|
||||
add wave -noupdate -format Logic /tb_j1/uut/ramwe2
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/pc_plus_1
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/dstack
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/rstack
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/st1
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_j1/uut/rst0
|
||||
add wave -noupdate -format Literal /tb_j1/uut/st0sel
|
||||
add wave -noupdate -format Logic /tb_j1/uut/is_alu
|
||||
add wave -noupdate -format Logic /tb_j1/uut/is_lit
|
||||
add wave -noupdate -format Literal /tb_j1/uut/dd
|
||||
add wave -noupdate -format Literal /tb_j1/uut/rd
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {1600185 ps} 0}
|
||||
configure wave -namecolwidth 150
|
||||
configure wave -valuecolwidth 100
|
||||
configure wave -justifyvalue left
|
||||
configure wave -signalnamewidth 1
|
||||
configure wave -snapdistance 10
|
||||
configure wave -datasetprefix 0
|
||||
configure wave -rowmargin 4
|
||||
configure wave -childrowmargin 2
|
||||
configure wave -gridoffset 0
|
||||
configure wave -gridperiod 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
update
|
||||
WaveRestoreZoom {0 ps} {1050 ns}
|
||||
@@ -0,0 +1,187 @@
|
||||
module j1(
|
||||
input sys_clk_i, input sys_rst_i, input [15:0] io_din,
|
||||
output io_rd, output io_wr, output [15:0] io_addr, output [15:0] io_dout);
|
||||
|
||||
wire [15:0] insn;
|
||||
wire [15:0] immediate = { 1'b0, insn[14:0] };
|
||||
|
||||
wire [15:0] ramrd;
|
||||
|
||||
reg [4:0] dsp; // Data stack pointer
|
||||
reg [4:0] _dsp;
|
||||
reg [15:0] st0; // Return stack pointer
|
||||
reg [15:0] _st0;
|
||||
wire _dstkW; // D stack write
|
||||
|
||||
reg [12:0] pc;
|
||||
reg [12:0] _pc;
|
||||
reg [4:0] rsp;
|
||||
reg [4:0] _rsp;
|
||||
reg _rstkW; // R stack write
|
||||
reg [15:0] _rstkD;
|
||||
wire _ramWE; // RAM write enable
|
||||
|
||||
wire [15:0] pc_plus_1;
|
||||
assign pc_plus_1 = pc + 1;
|
||||
|
||||
// The D and R stacks
|
||||
reg [15:0] dstack[0:31];
|
||||
reg [15:0] rstack[0:31];
|
||||
always @(posedge sys_clk_i)
|
||||
begin
|
||||
if (_dstkW)
|
||||
dstack[_dsp] = st0;
|
||||
if (_rstkW)
|
||||
rstack[_rsp] = _rstkD;
|
||||
end
|
||||
wire [15:0] st1 = dstack[dsp];
|
||||
wire [15:0] rst0 = rstack[rsp];
|
||||
|
||||
// st0sel is the ALU operation. For branch and call the operation
|
||||
// is T, for 0branch it is N. For ALU ops it is loaded from the instruction
|
||||
// field.
|
||||
reg [3:0] st0sel;
|
||||
always @*
|
||||
begin
|
||||
case (insn[14:13])
|
||||
2'b00: st0sel = 0; // ubranch
|
||||
2'b10: st0sel = 0; // call
|
||||
2'b01: st0sel = 1; // 0branch
|
||||
2'b11: st0sel = insn[11:8]; // ALU
|
||||
default: st0sel = 4'bxxxx;
|
||||
endcase
|
||||
end
|
||||
|
||||
`define RAMS 3
|
||||
|
||||
genvar i;
|
||||
|
||||
`define w (16 >> `RAMS)
|
||||
`define w1 (`w - 1)
|
||||
|
||||
generate
|
||||
for (i = 0; i < (1 << `RAMS); i=i+1) begin : ram
|
||||
// RAMB16_S18_S18
|
||||
RAMB16_S2_S2
|
||||
ram(
|
||||
.DIA(0),
|
||||
// .DIPA(0),
|
||||
.DOA(insn[`w*i+`w1:`w*i]),
|
||||
.WEA(0),
|
||||
.ENA(1),
|
||||
.CLKA(sys_clk_i),
|
||||
.ADDRA({_pc}),
|
||||
|
||||
.DIB(st1[`w*i+`w1:`w*i]),
|
||||
// .DIPB(2'b0),
|
||||
.WEB(_ramWE & (_st0[15:14] == 0)),
|
||||
.ENB(|_st0[15:14] == 0),
|
||||
.CLKB(sys_clk_i),
|
||||
.ADDRB(_st0[15:1]),
|
||||
.DOB(ramrd[`w*i+`w1:`w*i]));
|
||||
end
|
||||
endgenerate
|
||||
|
||||
// Compute the new value of T.
|
||||
always @*
|
||||
begin
|
||||
if (insn[15])
|
||||
_st0 = immediate;
|
||||
else
|
||||
case (st0sel)
|
||||
4'b0000: _st0 = st0;
|
||||
4'b0001: _st0 = st1;
|
||||
4'b0010: _st0 = st0 + st1;
|
||||
4'b0011: _st0 = st0 & st1;
|
||||
4'b0100: _st0 = st0 | st1;
|
||||
4'b0101: _st0 = st0 ^ st1;
|
||||
4'b0110: _st0 = ~st0;
|
||||
4'b0111: _st0 = {16{(st1 == st0)}};
|
||||
4'b1000: _st0 = {16{($signed(st1) < $signed(st0))}};
|
||||
4'b1001: _st0 = st1 >> st0[3:0];
|
||||
4'b1010: _st0 = st0 - 1;
|
||||
4'b1011: _st0 = rst0;
|
||||
4'b1100: _st0 = |st0[15:14] ? io_din : ramrd;
|
||||
4'b1101: _st0 = st1 << st0[3:0];
|
||||
4'b1110: _st0 = {rsp, 3'b000, dsp};
|
||||
4'b1111: _st0 = {16{(st1 < st0)}};
|
||||
default: _st0 = 16'hxxxx;
|
||||
endcase
|
||||
end
|
||||
|
||||
wire is_alu = (insn[15:13] == 3'b011);
|
||||
wire is_lit = (insn[15]);
|
||||
|
||||
assign io_rd = (is_alu & (insn[11:8] == 4'hc));
|
||||
assign io_wr = _ramWE;
|
||||
assign io_addr = st0;
|
||||
assign io_dout = st1;
|
||||
|
||||
assign _ramWE = is_alu & insn[5];
|
||||
assign _dstkW = is_lit | (is_alu & insn[7]);
|
||||
|
||||
wire [1:0] dd = insn[1:0]; // D stack delta
|
||||
wire [1:0] rd = insn[3:2]; // R stack delta
|
||||
|
||||
always @*
|
||||
begin
|
||||
if (is_lit) begin // literal
|
||||
_dsp = dsp + 1;
|
||||
_rsp = rsp;
|
||||
_rstkW = 0;
|
||||
_rstkD = _pc;
|
||||
end else if (is_alu) begin
|
||||
_dsp = dsp + {dd[1], dd[1], dd[1], dd};
|
||||
_rsp = rsp + {rd[1], rd[1], rd[1], rd};
|
||||
_rstkW = insn[6];
|
||||
_rstkD = st0;
|
||||
end else begin // jump/call
|
||||
// predicated jump is like DROP
|
||||
if (insn[15:13] == 3'b001) begin
|
||||
_dsp = dsp - 1;
|
||||
end else begin
|
||||
_dsp = dsp;
|
||||
end
|
||||
if (insn[15:13] == 3'b010) begin // call
|
||||
_rsp = rsp + 1;
|
||||
_rstkW = 1;
|
||||
_rstkD = {pc_plus_1[14:0], 1'b0};
|
||||
end else begin
|
||||
_rsp = rsp;
|
||||
_rstkW = 0;
|
||||
_rstkD = _pc;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
always @*
|
||||
begin
|
||||
if (sys_rst_i)
|
||||
_pc = pc;
|
||||
else
|
||||
if ((insn[15:13] == 3'b000) |
|
||||
((insn[15:13] == 3'b001) & (|st0 == 0)) |
|
||||
(insn[15:13] == 3'b010))
|
||||
_pc = insn[12:0];
|
||||
else if (is_alu & insn[12])
|
||||
_pc = rst0[15:1];
|
||||
else
|
||||
_pc = pc_plus_1;
|
||||
end
|
||||
|
||||
always @(posedge sys_clk_i)
|
||||
begin
|
||||
if (sys_rst_i) begin
|
||||
pc <= 0;
|
||||
dsp <= 0;
|
||||
st0 <= 0;
|
||||
rsp <= 0;
|
||||
end else begin
|
||||
dsp <= _dsp;
|
||||
pc <= _pc;
|
||||
st0 <= _st0;
|
||||
rsp <= _rsp;
|
||||
end
|
||||
end
|
||||
|
||||
endmodule // j1
|
||||
@@ -0,0 +1,282 @@
|
||||
LIBRARY ieee;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
USE ieee.numeric_std.ALL;
|
||||
|
||||
entity j1 is
|
||||
Generic
|
||||
(
|
||||
R_STACK_SIZE : natural := 32;
|
||||
D_STACK_SIZE : natural := 32
|
||||
|
||||
);
|
||||
Port
|
||||
(
|
||||
sys_clk_i : in std_logic;
|
||||
sys_rst_i : in std_logic;
|
||||
io_din : in unsigned(15 downto 0);
|
||||
io_rd : out std_logic;
|
||||
io_wr : out std_logic;
|
||||
io_addr : out unsigned(15 downto 0);
|
||||
io_dout : out unsigned(15 downto 0);
|
||||
inst_din : in unsigned(15 downto 0);
|
||||
inst_addr : out unsigned(12 downto 0);
|
||||
data_addr : out unsigned(12 downto 0);
|
||||
data_we : out std_logic;
|
||||
data_en : out std_logic;
|
||||
data_din : in unsigned(15 downto 0);
|
||||
data_dout : out unsigned(15 downto 0)
|
||||
|
||||
);
|
||||
end j1;
|
||||
|
||||
architecture behave of j1 is
|
||||
|
||||
signal insn : unsigned(15 downto 0);
|
||||
signal immediate : unsigned(15 downto 0);
|
||||
signal ramrd : unsigned(15 downto 0);
|
||||
|
||||
signal dsp : unsigned(4 downto 0); -- Data stack pointer (register)
|
||||
signal dsp2 : unsigned(4 downto 0); -- register
|
||||
signal st0 : unsigned(15 downto 0); -- Return stack pointer (register)
|
||||
signal st02 : unsigned(15 downto 0); -- register
|
||||
|
||||
signal dstkW2 : std_logic; -- D stack write
|
||||
|
||||
signal pc : unsigned(12 downto 0); -- register
|
||||
signal pc2 : unsigned(12 downto 0); -- register
|
||||
signal rsp : unsigned(4 downto 0); -- register
|
||||
signal rsp2 : unsigned(4 downto 0); -- register
|
||||
|
||||
signal rstkW2 : std_logic; -- register
|
||||
signal rstkD2 : unsigned(15 downto 0); -- register
|
||||
signal ramWE2 : std_logic; -- RAM write enable
|
||||
|
||||
signal pc_plus_1 : unsigned(15 downto 0);
|
||||
|
||||
type stack_t is array (integer range <>) of unsigned(15 downto 0);
|
||||
|
||||
signal dstack : stack_t(0 to D_STACK_SIZE-1); -- register
|
||||
signal rstack : stack_t(0 to R_STACK_SIZE-1); -- register
|
||||
|
||||
signal st1 : unsigned(15 downto 0);
|
||||
signal rst0 : unsigned(15 downto 0);
|
||||
|
||||
signal st0sel : unsigned(3 downto 0);
|
||||
|
||||
signal is_alu : BOOLEAN;
|
||||
signal is_lit : BOOLEAN;
|
||||
|
||||
signal dd : unsigned(1 downto 0); -- D stack delta
|
||||
signal rd : unsigned(1 downto 0); -- R stack delta
|
||||
|
||||
signal stack_ram_en : std_logic; -- helper for RAM R/W
|
||||
signal stack_ram_we : std_logic; -- helper for RAM R/W
|
||||
|
||||
begin
|
||||
|
||||
-- LINE 25:
|
||||
pc_plus_1 <= ("000" & pc) + 1;
|
||||
|
||||
-- LINE 37:
|
||||
st1 <= dstack(to_integer(dsp));
|
||||
rst0 <= rstack(to_integer(rsp));
|
||||
immediate <= '1' & insn(14 downto 0);
|
||||
|
||||
-- LINE 112:
|
||||
is_alu <= (insn(15 downto 13) = "011");
|
||||
is_lit <= (insn(15) = '1');
|
||||
|
||||
|
||||
-- LINE 115:
|
||||
io_rd <= '1' when (is_alu and (insn(11 downto 8) = X"C")) else '0';
|
||||
io_wr <= ramWE2;
|
||||
io_addr <= st0;
|
||||
io_dout <= st1;
|
||||
ramWE2 <= '1' when (is_alu and (insn(5) = '1')) else '0';
|
||||
dstkW2 <= '1' when (is_lit or (is_alu and insn(7) = '1')) else '0';
|
||||
dd <= insn(1 downto 0);
|
||||
rd <= insn(3 downto 2);
|
||||
|
||||
|
||||
-- LINE 27:
|
||||
-- The D and R stacks
|
||||
proc_d_and_r_stack:
|
||||
process(sys_clk_i)
|
||||
begin
|
||||
if rising_edge(sys_clk_i) then
|
||||
if dstkW2 = '1' then
|
||||
dstack(to_integer(dsp2)) <= st0;
|
||||
end if;
|
||||
if rstkW2 = '1' then
|
||||
rstack(to_integer(rsp2)) <= rstkD2;
|
||||
end if;
|
||||
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
-- LINE 40:
|
||||
-- st0sel is the ALU operation. For branch and call the operation
|
||||
-- is T, for 0branch it is N. For ALU ops it is loaded from the instruction
|
||||
-- field.
|
||||
|
||||
proc_aluop_sel:
|
||||
process(insn)
|
||||
begin
|
||||
|
||||
|
||||
case insn(14 downto 13) is
|
||||
|
||||
when "00" => st0sel <= "0000";
|
||||
when "10" => st0sel <= "0000";
|
||||
when "01" => st0sel <= "0001";
|
||||
when "11" => st0sel <= insn(11 downto 8);
|
||||
when others => st0sel <= "XXXX";
|
||||
|
||||
end case;
|
||||
end process;
|
||||
|
||||
|
||||
-- LINE 55:
|
||||
-- define RAMS outside this module
|
||||
insn <= inst_din;
|
||||
inst_addr <= pc2(12 downto 0);
|
||||
data_en <= not (st02(15) or st02(14));
|
||||
data_we <= ramWE2 and not (st02(15) or st02(14));
|
||||
ramrd <= data_din;
|
||||
data_dout <= st1;
|
||||
data_addr <= st02(13 downto 1);
|
||||
|
||||
|
||||
-- LINE 85:
|
||||
-- Compute the new value of T.
|
||||
proc_alu:
|
||||
process(insn, immediate, st0sel, st0, st1, rst0, rsp, dsp)
|
||||
begin
|
||||
|
||||
if insn(15) = '1' then
|
||||
st02 <= immediate;
|
||||
else
|
||||
case st0sel is
|
||||
|
||||
when "0000" => st02 <= st0;
|
||||
when "0001" => st02 <= st1;
|
||||
when "0010" => st02 <= st0 + st1;
|
||||
when "0011" => st02 <= st0 and st1;
|
||||
when "0100" => st02 <= st0 or st1;
|
||||
when "0101" => st02 <= st0 xor st1;
|
||||
when "0110" => st02 <= not st0;
|
||||
when "0111" =>
|
||||
if st1 = st0 then
|
||||
st02 <= X"FFFF";
|
||||
else
|
||||
st02 <= X"0000";
|
||||
end if;
|
||||
|
||||
when "1000" =>
|
||||
if signed(st1) < signed(st0) then
|
||||
st02 <= X"FFFF";
|
||||
else
|
||||
st02 <= X"0000";
|
||||
end if;
|
||||
|
||||
when "1001" => st02 <= st1 srl to_integer(st0(3 downto 0));
|
||||
when "1010" => st02 <= st0 - 1;
|
||||
when "1011" => st02 <= rst0;
|
||||
when "1100" =>
|
||||
if st0(15) = '1' or st0(14) = '1' then -- LINE 104: ????
|
||||
st02 <= io_din;
|
||||
else
|
||||
st02 <= ramrd;
|
||||
end if;
|
||||
|
||||
when "1101" => st02 <= st1 sll to_integer(st0(3 downto 0));
|
||||
when "1110" => st02 <= "000" & rsp & "000" & dsp; -- LINE 106: ????
|
||||
when "1111" =>
|
||||
if st1 < st0 then
|
||||
st02 <= X"FFFF";
|
||||
else
|
||||
st02 <= X"0000";
|
||||
end if;
|
||||
when others => st02 <= "XXXXXXXXXXXXXXXX";
|
||||
|
||||
end case;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- LINE 126:
|
||||
proc_stack_ctrl:
|
||||
process(is_lit, is_alu, pc2, dd, rd, insn, st0, pc_plus_1, rsp, dsp)
|
||||
begin
|
||||
if is_lit then -- literal
|
||||
dsp2 <= dsp + 1;
|
||||
rsp2 <= rsp;
|
||||
rstkW2 <= '0';
|
||||
rstkD2 <= "000" & pc2;
|
||||
elsif is_alu then
|
||||
dsp2 <= dsp + (dd(1) & dd(1) & dd(1) & dd);
|
||||
rsp2 <= rsp + (rd(1) & rd(1) & rd(1) & rd);
|
||||
rstkW2 <= insn(6);
|
||||
rstkD2 <= st0;
|
||||
else -- jump/call
|
||||
-- predicated jump is like DROP
|
||||
if insn(15 downto 13) = "001" then
|
||||
dsp2 <= dsp - 1;
|
||||
else
|
||||
dsp2 <= dsp; -- *default
|
||||
end if;
|
||||
if insn(15 downto 13) = "010" then -- call
|
||||
rsp2 <= rsp + 1;
|
||||
rstkW2 <= '1';
|
||||
rstkD2 <= pc_plus_1(14 downto 0) & '0';
|
||||
else
|
||||
rsp2 <= rsp; -- *default
|
||||
rstkW2 <= '0'; -- *default
|
||||
rstkD2 <= "000" & pc2; -- *default
|
||||
end if;
|
||||
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- LINE 157:
|
||||
proc_pc:
|
||||
process(sys_rst_i, is_alu, insn, pc, st0, rst0, pc_plus_1)
|
||||
begin
|
||||
|
||||
if sys_rst_i = '1' then
|
||||
pc2 <= pc;
|
||||
else
|
||||
if ((insn(15 downto 13) = "000")
|
||||
or ((insn(15 downto 13) = "001")
|
||||
and (st0 = X"0000"))
|
||||
or (insn(15 downto 13) = "010")) then
|
||||
pc2 <= insn(12 downto 0);
|
||||
elsif is_alu and (insn(12) = '1') then -- return
|
||||
pc2 <= rst0(13 downto 1); -- LINE 167: ????
|
||||
else
|
||||
pc2 <= pc_plus_1(12 downto 0); -- LINE 169: truncation ????
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
-- LINE 172:
|
||||
proc_next:
|
||||
process(sys_clk_i)
|
||||
begin
|
||||
|
||||
if rising_edge(sys_clk_i) then
|
||||
if sys_rst_i = '1' then
|
||||
pc <= (others => '0');
|
||||
dsp <= (others => '0');
|
||||
st0 <= (others => '0');
|
||||
rsp <= (others => '0');
|
||||
else
|
||||
dsp <= dsp2;
|
||||
pc <= pc2;
|
||||
st0 <= st02;
|
||||
rsp <= rsp2;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end behave;
|
||||
@@ -0,0 +1,84 @@
|
||||
--------------------------------------------------------------------------
|
||||
-- Project: Generic RAM. Infers BlockRAM for Xilinx
|
||||
-- This file: On-chip RAM
|
||||
--
|
||||
-- Copyright (C) 2007 J. Ahrensfeld
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- For questions and ideas, please contact the author at jens@jayfield.org
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.numeric_std.ALL;
|
||||
|
||||
entity ram_2c_2r_2w is
|
||||
Generic
|
||||
(
|
||||
addr_width : integer := 3;
|
||||
data_width : integer := 8
|
||||
);
|
||||
Port (
|
||||
clka : in STD_LOGIC;
|
||||
clkb : in STD_LOGIC;
|
||||
en_a : in STD_LOGIC;
|
||||
en_b : in STD_LOGIC;
|
||||
we_a : in STD_LOGIC;
|
||||
we_b : in STD_LOGIC;
|
||||
addr_a : in unsigned (addr_width-1 downto 0);
|
||||
addr_b : in unsigned (addr_width-1 downto 0);
|
||||
din_a : in unsigned (data_width-1 downto 0);
|
||||
din_b : in unsigned (data_width-1 downto 0);
|
||||
dout_a : out unsigned (data_width-1 downto 0);
|
||||
dout_b : out unsigned (data_width-1 downto 0)
|
||||
);
|
||||
end ram_2c_2r_2w;
|
||||
|
||||
architecture Behavioral of ram_2c_2r_2w is
|
||||
|
||||
constant depth : integer := 2**addr_width;
|
||||
type RAMtype is array (0 to depth-1) of unsigned (data_width-1 downto 0);
|
||||
shared variable RAM : RAMtype;
|
||||
|
||||
begin
|
||||
|
||||
process (clka)
|
||||
begin
|
||||
if clka'event and clka = '1' then
|
||||
if en_a = '1' then
|
||||
if we_a = '1' then
|
||||
RAM(to_integer(addr_a)) := din_a;
|
||||
end if;
|
||||
dout_a <= RAM(to_integer(addr_a));
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
process (clkb)
|
||||
begin
|
||||
if clkb'event and clkb = '1' then
|
||||
if en_b = '1' then
|
||||
if we_b = '1' then
|
||||
RAM(to_integer(addr_b)) := din_b;
|
||||
end if;
|
||||
dout_b <= RAM(to_integer(addr_b));
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
|
||||
end Behavioral;
|
||||
|
||||
@@ -0,0 +1,150 @@
|
||||
-------------------------------------------------------------------------
|
||||
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
||||
-- This file: testbench for embedded cpu with rom
|
||||
--
|
||||
-- Copyright (C) 2007 J. Ahrensfeld
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- For questions and ideas, please contact the author at jens@jayfield.org
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
LIBRARY ieee;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
USE ieee.numeric_std.ALL;
|
||||
use std.textio.all; -- Imports the standard textio package.
|
||||
|
||||
library work;
|
||||
|
||||
ENTITY tb_j1 IS
|
||||
END tb_j1;
|
||||
|
||||
ARCHITECTURE behavior OF tb_j1 IS
|
||||
|
||||
constant CLK_PERIOD : time := 10 ns;
|
||||
|
||||
-- Inputs
|
||||
signal sys_clk_i : std_logic := '0';
|
||||
signal sys_rst_i : std_logic := '1';
|
||||
signal io_din : unsigned(15 downto 0) := (others => '0');
|
||||
signal inst_din : unsigned(15 downto 0) := (others => '0');
|
||||
signal data_din : unsigned(15 downto 0) := (others => '0');
|
||||
|
||||
-- Outputs
|
||||
signal io_rd : std_logic;
|
||||
signal io_wr : std_logic;
|
||||
signal io_addr : unsigned(15 downto 0);
|
||||
signal io_dout : unsigned(15 downto 0);
|
||||
signal data_dout : unsigned(15 downto 0);
|
||||
signal inst_addr : unsigned(12 downto 0);
|
||||
signal data_addr : unsigned(12 downto 0);
|
||||
signal data_we : std_logic;
|
||||
signal data_en : std_logic;
|
||||
|
||||
type rom_t is array (integer range <>) of unsigned(15 downto 0);
|
||||
|
||||
signal rom : rom_t(0 to 15) :=
|
||||
(
|
||||
X"8123", -- 0000
|
||||
X"0002", -- 0001
|
||||
X"0005", -- 0002
|
||||
X"8456", -- 0003
|
||||
X"4008", -- 0004
|
||||
X"0003", -- 0005
|
||||
X"0000", -- 0006
|
||||
X"0000", -- 0007
|
||||
X"8456", -- 0008
|
||||
X"8451", -- 0009
|
||||
X"7000", -- 000A
|
||||
X"0000", -- 000B
|
||||
X"0000", -- 000C
|
||||
X"0000", -- 000D
|
||||
X"0000", -- 000E
|
||||
X"0000" -- 000F
|
||||
);
|
||||
|
||||
BEGIN
|
||||
|
||||
-- Instruction rom
|
||||
process(sys_clk_i)
|
||||
begin
|
||||
if rising_edge(sys_clk_i) then
|
||||
inst_din <= rom(to_integer(inst_addr(3 downto 0)));
|
||||
end if;
|
||||
end process;
|
||||
|
||||
uut: entity work.j1
|
||||
PORT MAP
|
||||
(
|
||||
sys_clk_i => sys_clk_i,
|
||||
sys_rst_i => sys_rst_i,
|
||||
io_din => io_din,
|
||||
io_rd => io_rd,
|
||||
io_wr => io_wr,
|
||||
io_addr => io_addr,
|
||||
inst_din => inst_din,
|
||||
inst_addr => inst_addr,
|
||||
data_addr => data_addr,
|
||||
data_we => data_we,
|
||||
data_en => data_en,
|
||||
data_din => data_din,
|
||||
data_dout => data_dout
|
||||
);
|
||||
|
||||
inst_ram: entity work.ram_2c_2r_2w
|
||||
GENERIC MAP
|
||||
(
|
||||
addr_width => 13,
|
||||
data_width => 16
|
||||
)
|
||||
PORT MAP(
|
||||
clka => sys_clk_i,
|
||||
clkb => sys_clk_i,
|
||||
en_a => '1',
|
||||
en_b => data_en,
|
||||
we_a => '0',
|
||||
we_b => data_we,
|
||||
addr_a => (others => '0'), --inst_addr
|
||||
addr_b => data_addr,
|
||||
din_a => (others => '0'),
|
||||
din_b => data_dout,
|
||||
dout_a => open, -- inst_din
|
||||
dout_b => data_din
|
||||
);
|
||||
|
||||
|
||||
CLK_GEN: process
|
||||
begin
|
||||
wait for CLK_PERIOD/2;
|
||||
sys_clk_i <= not sys_clk_i;
|
||||
end process;
|
||||
|
||||
STIMULUS: process
|
||||
|
||||
begin
|
||||
|
||||
wait for 3*CLK_PERIOD;
|
||||
sys_rst_i <= '0';
|
||||
wait for 2*CLK_PERIOD;
|
||||
|
||||
|
||||
wait for 1000*CLK_PERIOD;
|
||||
|
||||
assert false report "Test finished" severity error;
|
||||
wait;
|
||||
|
||||
end process;
|
||||
|
||||
end behavior;
|
||||
@@ -0,0 +1,17 @@
|
||||
include $(VHDL_HOME)/make/defs.mk
|
||||
TOOL_PATH := $(VHDL_HOME)/tools/jcpu
|
||||
|
||||
.PHONY: install uninstall
|
||||
all: install
|
||||
|
||||
$(TOOL_PATH):
|
||||
mkdir -p $@
|
||||
|
||||
install: $(TOOL_PATH)
|
||||
cp -r tools/* $(TOOL_PATH)
|
||||
chmod +x $(TOOL_PATH)/*.rb
|
||||
|
||||
uninstall:
|
||||
rm -rf $(TOOL_PATH)
|
||||
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
; -------------------------------------------------
|
||||
; Constants
|
||||
; -------------------------------------------------
|
||||
; External RAM/ROM
|
||||
xmem
|
||||
crlf: dc 13, 10, 0
|
||||
msg_txt1: dc "J-CPU V1.", 0
|
||||
msg_txt2: dc "Ready.", 13, 10, 0
|
||||
msg_txt3: dc "Mimi ist eine liebe Katze !!!", 13, 10, 0
|
||||
|
||||
; -------------------------------------------------
|
||||
; Program
|
||||
; -------------------------------------------------
|
||||
code
|
||||
reset: jmp init
|
||||
|
||||
org 0x001
|
||||
; nop
|
||||
reti
|
||||
|
||||
; -------------------------------------------------
|
||||
; Main
|
||||
; -------------------------------------------------
|
||||
init: xin R0, (cpu_status)
|
||||
call bin2hex
|
||||
|
||||
call uart_putchar
|
||||
mov R0, R1
|
||||
call uart_putchar
|
||||
mov R1, crlf
|
||||
call uart_puts
|
||||
|
||||
loop:
|
||||
; Print line 0
|
||||
mov R1, msg_txt1
|
||||
call uart_puts
|
||||
cin R0, (cpu_revision)
|
||||
add R0, 0x30
|
||||
call uart_putchar
|
||||
mov R1, crlf
|
||||
call uart_puts
|
||||
|
||||
; Print line 1
|
||||
mov R1, msg_txt2
|
||||
call uart_puts
|
||||
|
||||
; Print line 3
|
||||
mov R1, msg_txt3
|
||||
call uart_puts
|
||||
|
||||
mov R15, 160
|
||||
fill_lp: tst R15
|
||||
jz ex_fill
|
||||
dec R15
|
||||
mov R1, 48
|
||||
ct_loop: cmp R1, 58
|
||||
jeq ex_ct
|
||||
mov R0, R1
|
||||
inc R1
|
||||
call uart_putchar
|
||||
jmp ct_loop
|
||||
ex_ct: jmp fill_lp
|
||||
ex_fill: mov R1, crlf
|
||||
call uart_puts
|
||||
jmp loop
|
||||
|
||||
; -------------------------------------------------
|
||||
include "./xregs.inc.jsm"
|
||||
include "../../../../tools/jcpu/lib/cregs.inc.jsm"
|
||||
include "../../../../tools/jcpu/lib/utils.inc.jsm"
|
||||
include "../../../../tools/jcpu/lib/uart.inc.jsm"
|
||||
include "../../../../tools/jcpu/lib/delays.inc.jsm"
|
||||
|
||||
|
||||
@@ -0,0 +1,502 @@
|
||||
# ----------------------------------------------------------------------
|
||||
# Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
||||
# This file: The ROM file for upload to target over JTAG
|
||||
#
|
||||
# Copyright (C) 2007 J. Ahrensfeld
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# For questions and ideas, please contact the author at jens@jayfield.org
|
||||
#
|
||||
# ---------------------------------------------------------------------
|
||||
|
||||
# ---------------------------------------------------------------------
|
||||
# For Chipscope 9.1
|
||||
# ---------------------------------------------------------------------
|
||||
# Source JTAG/TCL frame work
|
||||
cd $env(CHIPSCOPE)\\bin\\nt
|
||||
source csejtag.tcl
|
||||
|
||||
namespace import ::chipscope::*
|
||||
|
||||
# Platform USB Cable
|
||||
set PLATFORM_USB_CABLE_ARGS [list "port=USB2" "frequency=6000000"]
|
||||
# frequency="24000000 | 12000000 | 6000000 | 3000000 | 1500000 | 750000"
|
||||
|
||||
# Create session
|
||||
set handle [::chipscope::csejtag_session create 0]
|
||||
|
||||
# Open JTAG and lock
|
||||
set open_result [::chipscope::csejtag_target open $handle $CSEJTAG_TARGET_PLATFORMUSB 0 $PLATFORM_USB_CABLE_ARGS]
|
||||
set lock_result [::chipscope::csejtag_target lock $handle 1000]
|
||||
|
||||
set devlist [::chipscope::csejtag_tap autodetect_chain $handle $CSEJTAG_SCAN_DEFAULT]
|
||||
|
||||
# Get Device ID
|
||||
set devtype "Virtex-4SX"
|
||||
set devid 2
|
||||
set irlength [::chipscope::csejtag_tap get_irlength $handle $devid]
|
||||
set idcode [::chipscope::csejtag_tap get_device_idcode $handle $devid]
|
||||
|
||||
set CSE_OP $CSEJTAG_SHIFT_READWRITE
|
||||
set CSE_ES $CSEJTAG_RUN_TEST_IDLE
|
||||
|
||||
# Write Program
|
||||
# JASM_ROM_INSERT_HERE
|
||||
# Assembled from hallo_welt_uart.jsm
|
||||
# ---------------------------------------------------------------
|
||||
# Shift the USER1 Instruction (b1111000010) into the Instruction Register of FPGA
|
||||
# User 1
|
||||
set result [::chipscope::csejtag_tap shift_device_ir $handle $devid $CSE_OP $CSE_ES 0 $irlength "3C2"]
|
||||
|
||||
# 0x000: JMP 0x002
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00030002"
|
||||
|
||||
# 0x001: RETI
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0013F000"
|
||||
|
||||
# 0x002: XIN R00, (0x02)
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00228020"
|
||||
|
||||
# 0x003: CALL 0x029
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0033B029"
|
||||
|
||||
# 0x004: CALL 0x039
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0043B039"
|
||||
|
||||
# 0x005: MOV R00, R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00502010"
|
||||
|
||||
# 0x006: CALL 0x039
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0063B039"
|
||||
|
||||
# 0x007: MOV R01, 0x00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00703001"
|
||||
|
||||
# 0x008: CALL 0x030
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0083B030"
|
||||
|
||||
# 0x009: MOV R01, 0x03
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00903031"
|
||||
|
||||
# 0x00A: CALL 0x030
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00A3B030"
|
||||
|
||||
# 0x00B: CIN R00, (0x00)
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00B29000"
|
||||
|
||||
# 0x00C: ADD R00, 0x30
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00C11300"
|
||||
|
||||
# 0x00D: CALL 0x039
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00D3B039"
|
||||
|
||||
# 0x00E: MOV R01, 0x00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00E03001"
|
||||
|
||||
# 0x00F: CALL 0x030
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "00F3B030"
|
||||
|
||||
# 0x010: MOV R01, 0x0D
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "010030D1"
|
||||
|
||||
# 0x011: CALL 0x030
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0113B030"
|
||||
|
||||
# 0x012: MOV R01, 0x16
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01203161"
|
||||
|
||||
# 0x013: CALL 0x030
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0133B030"
|
||||
|
||||
# 0x014: MOV R15, 0xA0
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01403A0F"
|
||||
|
||||
# 0x015: TST R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0150F00F"
|
||||
|
||||
# 0x016: JZ 0x020
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01631020"
|
||||
|
||||
# 0x017: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0171501F"
|
||||
|
||||
# 0x018: MOV R01, 0x30
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01803301"
|
||||
|
||||
# 0x019: CMP R01, 0x3A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0190F3A1"
|
||||
|
||||
# 0x01A: JEQ 0x01F
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01A3901F"
|
||||
|
||||
# 0x01B: MOV R00, R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01B02010"
|
||||
|
||||
# 0x01C: INC R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01C11011"
|
||||
|
||||
# 0x01D: CALL 0x039
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01D3B039"
|
||||
|
||||
# 0x01E: JMP 0x019
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01E30019"
|
||||
|
||||
# 0x01F: JMP 0x015
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "01F30015"
|
||||
|
||||
# 0x020: MOV R01, 0x00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02003001"
|
||||
|
||||
# 0x021: CALL 0x030
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0213B030"
|
||||
|
||||
# 0x022: JMP 0x009
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02230009"
|
||||
|
||||
# 0x023: AND R00, 0x0F
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "023190F0"
|
||||
|
||||
# 0x024: CMP R00, 0x0A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0240F0A0"
|
||||
|
||||
# 0x025: JLT 0x027
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02535027"
|
||||
|
||||
# 0x026: ADD R00, 0x07
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02611070"
|
||||
|
||||
# 0x027: ADD R00, 0x30
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02711300"
|
||||
|
||||
# 0x028: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0283E000"
|
||||
|
||||
# 0x029: PUSH R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0293C000"
|
||||
|
||||
# 0x02A: CALL 0x023
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02A3B023"
|
||||
|
||||
# 0x02B: MOV R01, R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02B02001"
|
||||
|
||||
# 0x02C: POP R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02C3D000"
|
||||
|
||||
# 0x02D: SWAP R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02D2A000"
|
||||
|
||||
# 0x02E: CALL 0x023
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02E3B023"
|
||||
|
||||
# 0x02F: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "02F3E000"
|
||||
|
||||
# 0x030: PUSH R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0303C000"
|
||||
|
||||
# 0x031: MOVX R00, (R01)
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03104010"
|
||||
|
||||
# 0x032: INC R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03211011"
|
||||
|
||||
# 0x033: TST R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0330F000"
|
||||
|
||||
# 0x034: JZ 0x037
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03431037"
|
||||
|
||||
# 0x035: CALL 0x039
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0353B039"
|
||||
|
||||
# 0x036: JMP 0x031
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03630031"
|
||||
|
||||
# 0x037: POP R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0373D000"
|
||||
|
||||
# 0x038: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0383E000"
|
||||
|
||||
# 0x039: JMP 0x03A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0393003A"
|
||||
|
||||
# 0x03A: PUSH R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03A3C001"
|
||||
|
||||
# 0x03B: XIN R01, (0x06)
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03B28061"
|
||||
|
||||
# 0x03C: AND R01, 0x02
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03C19021"
|
||||
|
||||
# 0x03D: JNZ 0x03B
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03D3203B"
|
||||
|
||||
# 0x03E: XOUT (0x02), R00
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03E24020"
|
||||
|
||||
# 0x03F: POP R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "03F3D001"
|
||||
|
||||
# 0x040: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0403E000"
|
||||
|
||||
# 0x041: PUSH R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0413C001"
|
||||
|
||||
# 0x042: XIN R01, (0x06)
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04228061"
|
||||
|
||||
# 0x043: AND R01, 0x10
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04319101"
|
||||
|
||||
# 0x044: JNZ 0x042
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04432042"
|
||||
|
||||
# 0x045: XIN R00, (0x02)
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04528020"
|
||||
|
||||
# 0x046: POP R01
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0463D001"
|
||||
|
||||
# 0x047: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0473E000"
|
||||
|
||||
# 0x048: PUSH R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0483C00F"
|
||||
|
||||
# 0x049: MOV R15, 0x0A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "049030AF"
|
||||
|
||||
# 0x04A: CALL 0x04F
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04A3B04F"
|
||||
|
||||
# 0x04B: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04B1501F"
|
||||
|
||||
# 0x04C: JNZ 0x04A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04C3204A"
|
||||
|
||||
# 0x04D: POP R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04D3D00F"
|
||||
|
||||
# 0x04E: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04E3E000"
|
||||
|
||||
# 0x04F: PUSH R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "04F3C00F"
|
||||
|
||||
# 0x050: MOV R15, 0x0A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "050030AF"
|
||||
|
||||
# 0x051: CALL 0x056
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0513B056"
|
||||
|
||||
# 0x052: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0521501F"
|
||||
|
||||
# 0x053: JNZ 0x051
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "05332051"
|
||||
|
||||
# 0x054: POP R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0543D00F"
|
||||
|
||||
# 0x055: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0553E000"
|
||||
|
||||
# 0x056: PUSH R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0563C00F"
|
||||
|
||||
# 0x057: MOV R15, 0x0A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "057030AF"
|
||||
|
||||
# 0x058: CALL 0x05D
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0583B05D"
|
||||
|
||||
# 0x059: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0591501F"
|
||||
|
||||
# 0x05A: JNZ 0x058
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "05A32058"
|
||||
|
||||
# 0x05B: POP R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "05B3D00F"
|
||||
|
||||
# 0x05C: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "05C3E000"
|
||||
|
||||
# 0x05D: PUSH R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "05D3C00F"
|
||||
|
||||
# 0x05E: MOV R15, 0x0A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "05E030AF"
|
||||
|
||||
# 0x05F: CALL 0x064
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "05F3B064"
|
||||
|
||||
# 0x060: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0601501F"
|
||||
|
||||
# 0x061: JNZ 0x05F
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0613205F"
|
||||
|
||||
# 0x062: POP R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0623D00F"
|
||||
|
||||
# 0x063: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0633E000"
|
||||
|
||||
# 0x064: PUSH R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0643C00F"
|
||||
|
||||
# 0x065: MOV R15, 0x0A
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "065030AF"
|
||||
|
||||
# 0x066: CALL 0x06B
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0663B06B"
|
||||
|
||||
# 0x067: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0671501F"
|
||||
|
||||
# 0x068: JNZ 0x066
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "06832066"
|
||||
|
||||
# 0x069: POP R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0693D00F"
|
||||
|
||||
# 0x06A: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "06A3E000"
|
||||
|
||||
# 0x06B: PUSH R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "06B3C00F"
|
||||
|
||||
# 0x06C: MOV R15, 0x63
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "06C0363F"
|
||||
|
||||
# 0x06D: NOP
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "06D00000"
|
||||
|
||||
# 0x06E: NOP
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "06E00000"
|
||||
|
||||
# 0x06F: NOP
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "06F00000"
|
||||
|
||||
# 0x070: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0701501F"
|
||||
|
||||
# 0x071: JNZ 0x06D
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0713206D"
|
||||
|
||||
# 0x072: POP R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0723D00F"
|
||||
|
||||
# 0x073: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0733E000"
|
||||
|
||||
# 0x074: PUSH R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0743C00F"
|
||||
|
||||
# 0x075: MOV R15, 0x09
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0750309F"
|
||||
|
||||
# 0x076: NOP
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "07600000"
|
||||
|
||||
# 0x077: NOP
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "07700000"
|
||||
|
||||
# 0x078: NOP
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "07800000"
|
||||
|
||||
# 0x079: DEC R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "0791501F"
|
||||
|
||||
# 0x07A: JNZ 0x076
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "07A32076"
|
||||
|
||||
# 0x07B: POP R15
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "07B3D00F"
|
||||
|
||||
# 0x07C: RET
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 32 "07C3E000"
|
||||
|
||||
# Assembled from hallo_welt_uart.jsm
|
||||
# ---------------------------------------------------------------
|
||||
# Shift the USER2 Instruction (b1111000011) into the Instruction Register of FPGA
|
||||
# User 2
|
||||
set result [::chipscope::csejtag_tap shift_device_ir $handle $devid $CSE_OP $CSE_ES 0 $irlength "3C3"]
|
||||
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "000D"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "010A"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0200"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "034A"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "042D"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0543"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0650"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0755"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0820"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0956"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0A31"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0B2E"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0C00"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0D52"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0E65"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "0F61"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1064"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1179"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "122E"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "130D"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "140A"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1500"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "164D"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1769"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "186D"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1969"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1A20"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1B69"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1C73"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1D74"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1E20"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "1F65"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2069"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "216E"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2265"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2320"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "246C"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2569"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2665"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2762"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2865"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2920"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2A4B"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2B61"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2C74"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2D7A"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2E65"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "2F20"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "3021"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "3121"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "3221"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "330D"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "340A"
|
||||
::chipscope::csejtag_tap shift_device_dr $handle $devid $CSE_OP $CSE_ES 0 16 "3500"
|
||||
|
||||
::chipscope::csejtag_target unlock $handle
|
||||
::chipscope::csejtag_target close $handle
|
||||
::chipscope::csejtag_session destroy $handle
|
||||
exit
|
||||
@@ -26,7 +26,7 @@
|
||||
TARGET=$2
|
||||
DSTDIR=$1
|
||||
|
||||
JASM_HOME=/cygdrive/w/vhdl/lib/CPUs/JCpu/tools
|
||||
JASM_HOME=$VHDL_HOME/tools/jcpu
|
||||
|
||||
$JASM_HOME/jasm.rb $TARGET.jsm
|
||||
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
0 NOP
|
||||
1 HALT
|
||||
2 MOV|R|R
|
||||
3 MOV|R|K
|
||||
4 MOVX|R|Ri
|
||||
5 MOVX|R|Ki
|
||||
6 MOVX|Ri|R
|
||||
7 MOVX|Ri|K
|
||||
8 MOVX|Ki|R
|
||||
9 MOVC|R|Ri
|
||||
10 MOVC|R|Ki
|
||||
11 MOVC|Ri|R
|
||||
12 MOVC|Ri|K
|
||||
13 MOVC|Ki|R
|
||||
14 CMP|R|R
|
||||
15 CMP|R|K
|
||||
16 ADD|R|R
|
||||
17 ADD|R|K
|
||||
18 ADDC|R|R
|
||||
19 ADDC|R|K
|
||||
20 SUB|R|R
|
||||
21 SUB|R|K
|
||||
22 SUBC|R|R
|
||||
23 SUBC|R|K
|
||||
24 AND|R|R
|
||||
25 AND|R|K
|
||||
26 OR|R|R
|
||||
27 OR|R|K
|
||||
28 XOR|R|R
|
||||
29 XOR|R|K
|
||||
30 SHL|R
|
||||
31 SHR|R
|
||||
32 ROL|R
|
||||
33 ROR|R
|
||||
34 ROLC|R
|
||||
35 RORC|R
|
||||
36 XOUT|Ki|R
|
||||
37 XOUT|Ri|K
|
||||
38 COUT|Ki|R
|
||||
39 COUT|Ri|K
|
||||
40 XIN|R|Ki
|
||||
41 CIN|R|Ki
|
||||
42 SWAP|R
|
||||
43 SETC
|
||||
44 UNDEF
|
||||
45 UNDEF
|
||||
46 SUB|K|R
|
||||
47 SUBC|K|R
|
||||
48 JMP|K
|
||||
49 JZ|K
|
||||
50 JNZ|K
|
||||
51 JC|K
|
||||
52 JNC|K
|
||||
53 JLT|K
|
||||
54 JGT|K
|
||||
55 JLE|K
|
||||
56 JGE|K
|
||||
57 JEQ|K
|
||||
58 JNE|K
|
||||
59 CALL|K
|
||||
60 PUSH|R
|
||||
61 POP|R
|
||||
62 RET
|
||||
63 RETI
|
||||
@@ -0,0 +1,41 @@
|
||||
; External registers
|
||||
btn_port: equ 0x00 ; RO
|
||||
led_port: equ 0x01 ; R/W
|
||||
uart_data: equ 0x02 ; R/W
|
||||
lcd_port: equ 0x03 ; R/W
|
||||
ctrl_reg: equ 0x04 ; R/W
|
||||
CTRL_VGA_ENABLE: equ 0x04
|
||||
CTRL_TIMER_ENABLE: equ 0x02
|
||||
dip_port: equ 0x05 ; RO
|
||||
uart_status: equ 0x06 ; RO
|
||||
sdram_reg: equ 0x07 ; R/W
|
||||
FIFO_CTRL_IS_CMD: equ 0x04
|
||||
FIFO_CTRL_IS_WRITE: equ 0x10
|
||||
FIFO_CTRL_IS_READ: equ 0x20
|
||||
FIFO_STAT_CMD_FULL: equ 0x01
|
||||
FIFO_STAT_CMD_EMPTY: equ 0x02
|
||||
FIFO_STAT_WRITE_DATA_FULL: equ 0x04
|
||||
FIFO_STAT_WRITE_DATA_EMPTY: equ 0x08
|
||||
FIFO_STAT_READ_DATA_FULL: equ 0x10
|
||||
FIFO_STAT_READ_DATA_EMPTY: equ 0x20
|
||||
sdram_addr: equ 0x08 ; R/W
|
||||
sdram_addr0: equ 0x08 ; R/W
|
||||
sdram_addr1: equ 0x09 ; R/W
|
||||
sdram_addr2: equ 0x0A ; R/W
|
||||
reg_cg_char_addr: equ 0x0B ; RW
|
||||
reg_cg_line_addr: equ 0x0C ; RW
|
||||
reg_cg_data: equ 0x0D ; RW
|
||||
reg_cg_ctrl: equ 0x0E ; WO
|
||||
reg_hwstat: equ 0x0E ; RO
|
||||
reg_color_red: equ 0x10 ; RW
|
||||
reg_color_grn: equ 0x11 ; RW
|
||||
reg_color_blu: equ 0x12 ; RW
|
||||
uart_baudrate: equ 0x13 ; R/W
|
||||
vga_read_addr: equ 0x14 ; R/W
|
||||
vga_read_addr0: equ 0x14 ; R/W
|
||||
vga_read_addr1: equ 0x15 ; R/W
|
||||
vga_read_addr2: equ 0x16 ; R/W
|
||||
timer_reload: equ 0x17 ; R/W
|
||||
timer_reload0: equ 0x17 ; R/W
|
||||
timer_reload1: equ 0x18 ; R/W
|
||||
timer_reload2: equ 0x19 ; R/W
|
||||
@@ -0,0 +1,24 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||
[*] Sun Mar 21 20:24:10 2021
|
||||
[*]
|
||||
[dumpfile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/cpu_embedded/cpu_embedded.ghw"
|
||||
[dumpfile_mtime] "Sun Mar 21 20:24:02 2021"
|
||||
[dumpfile_size] 23928
|
||||
[savefile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/cpu_embedded/cpu_embedded.gtkw"
|
||||
[timestart] 0
|
||||
[size] 1000 600
|
||||
[pos] -1 -1
|
||||
*-28.221537 367000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[treeopen] top.
|
||||
[treeopen] top.tb_cpu_embedded.
|
||||
[sst_width] 233
|
||||
[signals_width] 78
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 144
|
||||
@28
|
||||
top.tb_cpu_embedded.uut.clk
|
||||
@29
|
||||
top.tb_cpu_embedded.uut.rst
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
||||
@@ -0,0 +1,16 @@
|
||||
# -----------------------------------------------------------
|
||||
include $(VHDL_HOME)/make/defs.mk
|
||||
# -----------------------------------------------------------
|
||||
include jcpu_core.inc
|
||||
|
||||
SRCS += $(JCPU_CORE_SRCS)
|
||||
SRCS += ../src/itest_irom.vhdl
|
||||
SRCS += ../src/cpu_embedded.vhd
|
||||
SRCS += ../src/tb_cpu_embedded.vhd
|
||||
|
||||
# Compile
|
||||
TARGET := cpu_embedded
|
||||
ENTITY := tb_cpu_embedded
|
||||
|
||||
include $(VHDL_HOME)/make/ghdl.mk
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# -----------------------------------------------------------
|
||||
include $(VHDL_HOME)/make/defs.mk
|
||||
# -----------------------------------------------------------
|
||||
include $(VHDL_HOME)/lib/uart/ghdl/uart_sim.inc
|
||||
include jcpu_core.inc
|
||||
|
||||
SRCS += $(UART_SIM_SRCS)
|
||||
SRCS += $(JCPU_CORE_SRCS)
|
||||
SRCS += ../src/hallo_welt_uart_irom.vhdl
|
||||
SRCS += ../src/hallo_welt_uart_xrom.vhdl
|
||||
SRCS += ../src/cpu_embedded_with_uart.vhd
|
||||
SRCS += ../src/tb_cpu_embedded_with_uart.vhd
|
||||
|
||||
# Compile
|
||||
TARGET := tb_cpu_embedded_with_uart
|
||||
ENTITY := tb_cpu_embedded_with_uart
|
||||
RUN_TIME := 100us
|
||||
|
||||
include $(VHDL_HOME)/make/ghdl.mk
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||
[*] Sun Mar 21 20:23:20 2021
|
||||
[*]
|
||||
[dumpfile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/cpu_itest/cpu_itest.ghw"
|
||||
[dumpfile_mtime] "Sun Mar 21 20:23:14 2021"
|
||||
[dumpfile_size] 23880
|
||||
[savefile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/cpu_itest/cpu_itest.gtkw"
|
||||
[timestart] 0
|
||||
[size] 1000 600
|
||||
[pos] -1 -1
|
||||
*-28.353857 33340 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[treeopen] top.
|
||||
[treeopen] top.tb_cpu.
|
||||
[treeopen] top.tb_cpu.uut.
|
||||
[treeopen] top.tb_cpu.uut.inst_pc.
|
||||
[sst_width] 233
|
||||
[signals_width] 134
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 144
|
||||
@22
|
||||
#{top.tb_cpu.xmem_din[7:0]} top.tb_cpu.xmem_din[7] top.tb_cpu.xmem_din[6] top.tb_cpu.xmem_din[5] top.tb_cpu.xmem_din[4] top.tb_cpu.xmem_din[3] top.tb_cpu.xmem_din[2] top.tb_cpu.xmem_din[1] top.tb_cpu.xmem_din[0]
|
||||
@23
|
||||
#{top.tb_cpu.uut.inst_pc.pc_next[11:0]} top.tb_cpu.uut.inst_pc.pc_next[11] top.tb_cpu.uut.inst_pc.pc_next[10] top.tb_cpu.uut.inst_pc.pc_next[9] top.tb_cpu.uut.inst_pc.pc_next[8] top.tb_cpu.uut.inst_pc.pc_next[7] top.tb_cpu.uut.inst_pc.pc_next[6] top.tb_cpu.uut.inst_pc.pc_next[5] top.tb_cpu.uut.inst_pc.pc_next[4] top.tb_cpu.uut.inst_pc.pc_next[3] top.tb_cpu.uut.inst_pc.pc_next[2] top.tb_cpu.uut.inst_pc.pc_next[1] top.tb_cpu.uut.inst_pc.pc_next[0]
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
||||
@@ -0,0 +1,17 @@
|
||||
# -----------------------------------------------------------
|
||||
include $(VHDL_HOME)/make/defs.mk
|
||||
# -----------------------------------------------------------
|
||||
include jcpu_core.inc
|
||||
|
||||
SRCS += $(JCPU_CORE_SRCS)
|
||||
SRCS += $(LIB_PATH)/PCK_FIO-2002.7/PCK_FIO_1993.vhd
|
||||
SRCS += $(LIB_PATH)/PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd
|
||||
SRCS += ../src/itest_irom.vhdl
|
||||
SRCS += ../src/tb_cpu_itest.vhd
|
||||
|
||||
# Compile
|
||||
TARGET := cpu_itest
|
||||
ENTITY := tb_cpu
|
||||
|
||||
include $(VHDL_HOME)/make/ghdl.mk
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
# -----------------------------------------------------------
|
||||
include $(VHDL_HOME)/make/defs.mk
|
||||
# -----------------------------------------------------------
|
||||
PKG_NAME := JCPU_CORE
|
||||
|
||||
# -----------------------------------------------------------
|
||||
MOD_PATH := $(LIB_PATH)/CPUs/JCpu/src/core
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/cpu_pkg.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/cpu.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/alu.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/chipram.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/chipreg.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/dpath_ctrl.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/int_ctrl.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/pc.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/reg_dual.vhd
|
||||
$(PKG_NAME)_SRCS += $(MOD_PATH)/stack_ctrl.vhd
|
||||
|
||||
# -----------------------------------------------------------
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||
[*] Mon Mar 22 20:01:47 2021
|
||||
[*]
|
||||
[dumpfile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/mul8x8/mul8x8.ghw"
|
||||
[dumpfile_mtime] "Mon Mar 22 20:00:48 2021"
|
||||
[dumpfile_size] 25852
|
||||
[savefile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/mul8x8/mul8x8.gtkw"
|
||||
[timestart] 0
|
||||
[size] 1173 600
|
||||
[pos] -1 -1
|
||||
*-28.009827 724000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[treeopen] top.
|
||||
[treeopen] top.tb_cpu_embedded.
|
||||
[treeopen] top.tb_cpu_embedded.uut.
|
||||
[sst_width] 233
|
||||
[signals_width] 150
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 144
|
||||
@28
|
||||
top.tb_cpu_embedded.rst
|
||||
top.tb_cpu_embedded.clk
|
||||
@22
|
||||
#{top.tb_cpu_embedded.uut.irom_addr[11:0]} top.tb_cpu_embedded.uut.irom_addr[11] top.tb_cpu_embedded.uut.irom_addr[10] top.tb_cpu_embedded.uut.irom_addr[9] top.tb_cpu_embedded.uut.irom_addr[8] top.tb_cpu_embedded.uut.irom_addr[7] top.tb_cpu_embedded.uut.irom_addr[6] top.tb_cpu_embedded.uut.irom_addr[5] top.tb_cpu_embedded.uut.irom_addr[4] top.tb_cpu_embedded.uut.irom_addr[3] top.tb_cpu_embedded.uut.irom_addr[2] top.tb_cpu_embedded.uut.irom_addr[1] top.tb_cpu_embedded.uut.irom_addr[0]
|
||||
@23
|
||||
#{top.tb_cpu_embedded.uut.irom_data[17:0]} top.tb_cpu_embedded.uut.irom_data[17] top.tb_cpu_embedded.uut.irom_data[16] top.tb_cpu_embedded.uut.irom_data[15] top.tb_cpu_embedded.uut.irom_data[14] top.tb_cpu_embedded.uut.irom_data[13] top.tb_cpu_embedded.uut.irom_data[12] top.tb_cpu_embedded.uut.irom_data[11] top.tb_cpu_embedded.uut.irom_data[10] top.tb_cpu_embedded.uut.irom_data[9] top.tb_cpu_embedded.uut.irom_data[8] top.tb_cpu_embedded.uut.irom_data[7] top.tb_cpu_embedded.uut.irom_data[6] top.tb_cpu_embedded.uut.irom_data[5] top.tb_cpu_embedded.uut.irom_data[4] top.tb_cpu_embedded.uut.irom_data[3] top.tb_cpu_embedded.uut.irom_data[2] top.tb_cpu_embedded.uut.irom_data[1] top.tb_cpu_embedded.uut.irom_data[0]
|
||||
@22
|
||||
#{top.tb_cpu_embedded.xmem_addr[7:0]} top.tb_cpu_embedded.xmem_addr[7] top.tb_cpu_embedded.xmem_addr[6] top.tb_cpu_embedded.xmem_addr[5] top.tb_cpu_embedded.xmem_addr[4] top.tb_cpu_embedded.xmem_addr[3] top.tb_cpu_embedded.xmem_addr[2] top.tb_cpu_embedded.xmem_addr[1] top.tb_cpu_embedded.xmem_addr[0]
|
||||
#{top.tb_cpu_embedded.xmem_dout[7:0]} top.tb_cpu_embedded.xmem_dout[7] top.tb_cpu_embedded.xmem_dout[6] top.tb_cpu_embedded.xmem_dout[5] top.tb_cpu_embedded.xmem_dout[4] top.tb_cpu_embedded.xmem_dout[3] top.tb_cpu_embedded.xmem_dout[2] top.tb_cpu_embedded.xmem_dout[1] top.tb_cpu_embedded.xmem_dout[0]
|
||||
#{top.tb_cpu_embedded.xmem_din[7:0]} top.tb_cpu_embedded.xmem_din[7] top.tb_cpu_embedded.xmem_din[6] top.tb_cpu_embedded.xmem_din[5] top.tb_cpu_embedded.xmem_din[4] top.tb_cpu_embedded.xmem_din[3] top.tb_cpu_embedded.xmem_din[2] top.tb_cpu_embedded.xmem_din[1] top.tb_cpu_embedded.xmem_din[0]
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
||||
@@ -0,0 +1,16 @@
|
||||
# -----------------------------------------------------------
|
||||
include $(VHDL_HOME)/make/defs.mk
|
||||
# -----------------------------------------------------------
|
||||
include jcpu_core.inc
|
||||
|
||||
SRCS += $(JCPU_CORE_SRCS)
|
||||
SRCS += ../src/mul8x8_irom.vhdl
|
||||
SRCS += ../src/cpu_embedded.vhd
|
||||
SRCS += ../src/tb_cpu_embedded.vhd
|
||||
|
||||
# Compile
|
||||
TARGET := mul8x8
|
||||
ENTITY := tb_cpu_embedded
|
||||
|
||||
include $(VHDL_HOME)/make/ghdl.mk
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||
[*] Sun Mar 21 20:25:04 2021
|
||||
[*]
|
||||
[dumpfile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/reti_issue/reti_issue.ghw"
|
||||
[dumpfile_mtime] "Sun Mar 21 20:25:01 2021"
|
||||
[dumpfile_size] 22085
|
||||
[savefile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/reti_issue/reti_issue.gtkw"
|
||||
[timestart] 0
|
||||
[size] 1000 600
|
||||
[pos] -1 -1
|
||||
*-28.221537 563000000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[treeopen] top.
|
||||
[treeopen] top.tb_cpu.
|
||||
[sst_width] 233
|
||||
[signals_width] 78
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 144
|
||||
@28
|
||||
top.tb_cpu.uut.clk
|
||||
@29
|
||||
top.tb_cpu.uut.rst
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
||||
@@ -0,0 +1,17 @@
|
||||
# -----------------------------------------------------------
|
||||
include $(VHDL_HOME)/make/defs.mk
|
||||
# -----------------------------------------------------------
|
||||
include jcpu_core.inc
|
||||
|
||||
SRCS += $(JCPU_CORE_SRCS)
|
||||
SRCS += $(LIB_PATH)/PCK_FIO-2002.7/PCK_FIO_1993.vhd
|
||||
SRCS += $(LIB_PATH)/PCK_FIO-2002.7/PCK_FIO_1993_BODY.vhd
|
||||
SRCS += ../src/reti_issue_irom.vhdl
|
||||
SRCS += ../src/tb_cpu_itest.vhd
|
||||
|
||||
# Compile
|
||||
TARGET := reti_issue
|
||||
ENTITY := tb_cpu
|
||||
|
||||
include $(VHDL_HOME)/make/ghdl.mk
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
[*]
|
||||
[*] GTKWave Analyzer v3.3.104 (w)1999-2020 BSI
|
||||
[*] Sun Apr 4 08:30:47 2021
|
||||
[*]
|
||||
[dumpfile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/tb_cpu_embedded_with_uart/tb_cpu_embedded_with_uart.fst"
|
||||
[dumpfile_mtime] "Sun Apr 4 08:29:53 2021"
|
||||
[dumpfile_size] 5098
|
||||
[savefile] "/home/jens/work/vhdl/trunk/lib/CPUs/JCpu/ghdl/build/tb_cpu_embedded_with_uart/tb_cpu_embedded_with_uart.gtkw"
|
||||
[timestart] 0
|
||||
[size] 1856 1136
|
||||
[pos] 1983 26
|
||||
*-27.352621 339300000 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
|
||||
[sst_width] 383
|
||||
[signals_width] 256
|
||||
[sst_expanded] 1
|
||||
[sst_vpaned_height] 331
|
||||
@28
|
||||
uut.clk
|
||||
uut.ce
|
||||
uut.rst
|
||||
@22
|
||||
uut.irom_data[17:0]
|
||||
@28
|
||||
uut.cpu_xmem_re
|
||||
uut.cpu_xmem_we
|
||||
@22
|
||||
uut.cpu_xmem_dout[7:0]
|
||||
uut.cpu_xmem_din[7:0]
|
||||
uut.cpu_xmem_addr[7:0]
|
||||
@29
|
||||
uut.cpu_io_sel
|
||||
[pattern_trace] 1
|
||||
[pattern_trace] 0
|
||||
Binary file not shown.
+105
-107
@@ -1,107 +1,105 @@
|
||||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -format Logic /tb_cpu/rst
|
||||
add wave -noupdate -format Logic /tb_cpu/clk
|
||||
add wave -noupdate -format Logic /tb_cpu/ce
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/cpu_active
|
||||
add wave -noupdate -format Logic /tb_cpu/int_in
|
||||
add wave -noupdate -format Logic /tb_cpu/int_ack
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/irom_data
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/irom_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/xmem_din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/xmem_dout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/xmem_addr
|
||||
add wave -noupdate -format Logic /tb_cpu/xmem_we
|
||||
add wave -noupdate -format Logic /tb_cpu/xmem_re
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/sram
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/io_sel
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/iphase
|
||||
add wave -noupdate -divider CPU
|
||||
add wave -noupdate -format Literal /tb_cpu/reg
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/cpu_status
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/status_reg
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/ctrl
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_out
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_in
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_reg
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/pc_in
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/pc_next
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/idata
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/int_pc_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/iphase
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/const_data
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/reg_a_dout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/reg_b_dout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/reg_din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/alu_op1
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/alu_op2
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/alu_result
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/alu_status
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/pc_inc
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/pc_load
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/stk_we
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/cmem_we
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/ctrl_iphase
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/was_pcld
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/was_pop2pc
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/int_pc_load
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/int_stk_push
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/stk_push
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/stk_pop
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/status_save
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/status_restore
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_ptr
|
||||
add wave -noupdate -divider Stack
|
||||
add wave -noupdate -format Logic /tb_cpu/clk
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_stack_ctrl/push
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_stack_ctrl/pop
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_stack_ctrl/din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_stack_ctrl/dout
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_stack_ctrl/mem_we
|
||||
add wave -noupdate -divider Chipram
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_chipram/we_a
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/din_a
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/addr_a
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/dout_a
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_chipram/we_b
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/din_b
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/addr_b
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/dout_b
|
||||
add wave -noupdate -divider Sequencer
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_dpath_ctrl/inst_in
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/iphase_in
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/status_in
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/ctrl_out
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_dpath_ctrl/idout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_dpath_ctrl/ddout
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/opcode
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/ctrl_lines
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Literal -radix hexadecimal -expand /tb_cpu/uut/inst_reg_ab/mem
|
||||
add wave -noupdate -divider {Chip register}
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/creg_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/creg_din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/creg_dout
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/creg_ctrl_out
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Logic /tb_cpu/clk
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_int_ctrl/int_exit
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_int_ctrl/int_state
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {136355 ps} 0}
|
||||
configure wave -namecolwidth 166
|
||||
configure wave -valuecolwidth 101
|
||||
configure wave -justifyvalue left
|
||||
configure wave -signalnamewidth 1
|
||||
configure wave -snapdistance 10
|
||||
configure wave -datasetprefix 0
|
||||
configure wave -rowmargin 4
|
||||
configure wave -childrowmargin 2
|
||||
configure wave -gridoffset 0
|
||||
configure wave -gridperiod 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
update
|
||||
WaveRestoreZoom {93532 ps} {206468 ps}
|
||||
onerror {resume}
|
||||
quietly WaveActivateNextPane {} 0
|
||||
add wave -noupdate -format Logic /tb_cpu/rst
|
||||
add wave -noupdate -format Logic /tb_cpu/clk
|
||||
add wave -noupdate -format Logic /tb_cpu/ce
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/cpu_active
|
||||
add wave -noupdate -format Logic /tb_cpu/int_in
|
||||
add wave -noupdate -format Logic /tb_cpu/int_ack
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/irom_data
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/irom_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/xmem_din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/xmem_dout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/xmem_addr
|
||||
add wave -noupdate -format Logic /tb_cpu/xmem_we
|
||||
add wave -noupdate -format Logic /tb_cpu/xmem_re
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/sram
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/io_sel
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/iphase
|
||||
add wave -noupdate -divider CPU
|
||||
add wave -noupdate -format Literal /tb_cpu/reg
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/cpu_status
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/status_reg
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/ctrl
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_out
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_in
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_reg
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/pc_in
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/pc_next
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/idata
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/int_pc_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/iphase
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/const_data
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/reg_a_dout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/reg_b_dout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/reg_din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/alu_op1
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/alu_op2
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/alu_result
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/alu_status
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/pc_inc
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/pc_load
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/stk_we
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/cmem_we
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/ctrl_iphase
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/was_pcld
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/was_pop2pc
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/int_pc_load
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/int_stk_push
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/stk_push
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/stk_pop
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/status_save
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/status_restore
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/stk_ptr
|
||||
add wave -noupdate -divider Stack
|
||||
add wave -noupdate -format Logic /tb_cpu/clk
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_stack_ctrl/push
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_stack_ctrl/pop
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_stack_ctrl/din
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_stack_ctrl/dout
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_stack_ctrl/mem_we
|
||||
add wave -noupdate -divider Chipram
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_chipram/we_a
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/din_a
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/addr_a
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/dout_a
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_chipram/we_b
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/din_b
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/addr_b
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_chipram/dout_b
|
||||
add wave -noupdate -divider Sequencer
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_dpath_ctrl/inst_in
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/iphase_in
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/status_in
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/ctrl_out
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_dpath_ctrl/idout
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/inst_dpath_ctrl/ddout
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/opcode
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/ctrl_lines
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Literal -radix hexadecimal -expand /tb_cpu/uut/inst_reg_ab/mem
|
||||
add wave -noupdate -divider {Chip register}
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu/uut/creg_dout
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/creg_ctrl_out
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_dpath_ctrl/dbg_iname
|
||||
add wave -noupdate -format Logic /tb_cpu/clk
|
||||
add wave -noupdate -format Logic /tb_cpu/uut/inst_int_ctrl/int_exit
|
||||
add wave -noupdate -format Literal /tb_cpu/uut/inst_int_ctrl/int_state
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {136355 ps} 0}
|
||||
configure wave -namecolwidth 166
|
||||
configure wave -valuecolwidth 101
|
||||
configure wave -justifyvalue left
|
||||
configure wave -signalnamewidth 1
|
||||
configure wave -snapdistance 10
|
||||
configure wave -datasetprefix 0
|
||||
configure wave -rowmargin 4
|
||||
configure wave -childrowmargin 2
|
||||
configure wave -gridoffset 0
|
||||
configure wave -gridperiod 1
|
||||
configure wave -griddelta 40
|
||||
configure wave -timeline 0
|
||||
update
|
||||
WaveRestoreZoom {49892711 ps} {50005647 ps}
|
||||
|
||||
@@ -6,8 +6,8 @@ add wave -noupdate -format Logic /tb_cpu_embedded/ce
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu_embedded/sram
|
||||
add wave -noupdate -format Logic /tb_cpu_embedded/int_in
|
||||
add wave -noupdate -format Logic /tb_cpu_embedded/int_ack
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu_embedded/uut/rom_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu_embedded/uut/rom_data
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu_embedded/uut/xmem_addr
|
||||
add wave -noupdate -format Literal -radix hexadecimal /tb_cpu_embedded/uut/xmem_din
|
||||
TreeUpdate [SetDefaultTree]
|
||||
WaveRestoreCursors {{Cursor 1} {2168142 ps} 0}
|
||||
configure wave -namecolwidth 143
|
||||
|
||||
@@ -54,14 +54,14 @@ architecture Behavioral of alu is
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
function test_zero(arg : unsigned) return STD_LOGIC is
|
||||
variable result : STD_LOGIC;
|
||||
variable res : STD_LOGIC;
|
||||
begin
|
||||
result := '0';
|
||||
res := '0';
|
||||
for i in arg'range loop
|
||||
result := result or To_X01(arg(i));
|
||||
res := res or To_X01(arg(i));
|
||||
end loop;
|
||||
|
||||
return not result;
|
||||
return not res;
|
||||
end test_zero;
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
@@ -218,7 +218,7 @@ begin
|
||||
xmem_dout <= mem_data;
|
||||
xmem_addr <= mem_addr;
|
||||
cmem_din <= creg_ctrl_out.cmem_high & mem_data;
|
||||
cmem_addr <= '1' & creg_ctrl_out.bank_sel & mem_addr(MIN(cmem_addr'length-creg_ctrl_out.bank_sel'length-1, mem_addr'length)-1 downto 0);
|
||||
cmem_addr <= '1' & creg_ctrl_out.bank_sel & mem_addr(JMIN(cmem_addr'length-creg_ctrl_out.bank_sel'length-1, mem_addr'length)-1 downto 0);
|
||||
|
||||
--------------------------------------------------------------------
|
||||
mem_ctrl_lines:
|
||||
|
||||
@@ -217,16 +217,16 @@ package cpu_pkg is
|
||||
function Instr(opcode : opcode_t) return inst_t;
|
||||
function Instr(opcode : opcode_t; data : inst_data_t) return inst_t;
|
||||
function Instr(opcode : opcode_t; data : inst_data_t; reg : integer) return inst_t;
|
||||
function Instr(opcode : opcode_t; reg_a : integer) return inst_t;
|
||||
function Instr(opcode : opcode_t; reg_a, reg_b : integer) return inst_t;
|
||||
function Instr(opcode : opcode_t; reg_a, reg_b, reg_c : integer) return inst_t;
|
||||
function Instr(opcode : opcode_t; reg_ptr_a : integer) return inst_t;
|
||||
function Instr(opcode : opcode_t; reg_ptr_a, reg_ptr_b : integer) return inst_t;
|
||||
function Instr(opcode : opcode_t; reg_ptr_a, reg_ptr_b, reg_ptr_c : integer) return inst_t;
|
||||
function ctrl_lines_default return ctrl_lines_t;
|
||||
function idecoder(instr_name : instr_name_t; iphase : iphase_t; status : cpu_status_t) return ctrl_lines_t;
|
||||
function idecoder(opcode : opcode_t; iphase : iphase_t; status : cpu_status_t) return ctrl_lines_t;
|
||||
function gen_murom return murom_t;
|
||||
function get_muromaddr (opcode : opcode_t; iphase : iphase_t; status : cpu_status_t) return unsigned;
|
||||
function MIN (X, Y: INTEGER) return INTEGER;
|
||||
function MAX (X, Y: INTEGER) return INTEGER;
|
||||
function JMIN (X, Y: INTEGER) return INTEGER;
|
||||
function JMAX (X, Y: INTEGER) return INTEGER;
|
||||
|
||||
end cpu_pkg;
|
||||
|
||||
@@ -260,34 +260,34 @@ package body cpu_pkg is
|
||||
|
||||
end Instr;
|
||||
|
||||
function Instr(opcode : opcode_t; reg_a : integer) return inst_t is
|
||||
function Instr(opcode : opcode_t; reg_ptr_a : integer) return inst_t is
|
||||
variable inst : inst_t := (others => '0');
|
||||
begin
|
||||
inst(inst_t'length-1 downto inst_t'length-opcode_t'length) := opcode;
|
||||
inst(reg_ptr_t'length-1 downto 0) := reg_ptr_t(to_unsigned(reg_a, reg_ptr_t'length));
|
||||
inst(reg_ptr_t'length-1 downto 0) := reg_ptr_t(to_unsigned(reg_ptr_a, reg_ptr_t'length));
|
||||
|
||||
return inst;
|
||||
|
||||
end Instr;
|
||||
|
||||
function Instr(opcode : opcode_t; reg_a, reg_b : integer) return inst_t is
|
||||
function Instr(opcode : opcode_t; reg_ptr_a, reg_ptr_b : integer) return inst_t is
|
||||
variable inst : inst_t := (others => '0');
|
||||
begin
|
||||
inst(inst_t'length-1 downto inst_t'length-opcode_t'length) := opcode;
|
||||
inst(2*(reg_ptr_t'length)-1 downto reg_ptr_t'length) := reg_ptr_t(to_unsigned(reg_b, reg_ptr_t'length));
|
||||
inst(reg_ptr_t'length-1 downto 0) := reg_ptr_t(to_unsigned(reg_a, reg_ptr_t'length));
|
||||
inst(2*(reg_ptr_t'length)-1 downto reg_ptr_t'length) := reg_ptr_t(to_unsigned(reg_ptr_b, reg_ptr_t'length));
|
||||
inst(reg_ptr_t'length-1 downto 0) := reg_ptr_t(to_unsigned(reg_ptr_a, reg_ptr_t'length));
|
||||
|
||||
return inst;
|
||||
|
||||
end Instr;
|
||||
|
||||
function Instr(opcode : opcode_t; reg_a, reg_b, reg_c : integer) return inst_t is
|
||||
function Instr(opcode : opcode_t; reg_ptr_a, reg_ptr_b, reg_ptr_c : integer) return inst_t is
|
||||
variable inst : inst_t := (others => '0');
|
||||
begin
|
||||
inst(inst_t'length-1 downto inst_t'length-opcode_t'length) := opcode;
|
||||
inst(3*(reg_ptr_t'length)-1 downto 2*reg_ptr_t'length) := reg_ptr_t(to_unsigned(reg_c, reg_ptr_t'length));
|
||||
inst(2*(reg_ptr_t'length)-1 downto reg_ptr_t'length) := reg_ptr_t(to_unsigned(reg_b, reg_ptr_t'length));
|
||||
inst(reg_ptr_t'length-1 downto 0) := reg_ptr_t(to_unsigned(reg_a, reg_ptr_t'length));
|
||||
inst(3*(reg_ptr_t'length)-1 downto 2*reg_ptr_t'length) := reg_ptr_t(to_unsigned(reg_ptr_c, reg_ptr_t'length));
|
||||
inst(2*(reg_ptr_t'length)-1 downto reg_ptr_t'length) := reg_ptr_t(to_unsigned(reg_ptr_b, reg_ptr_t'length));
|
||||
inst(reg_ptr_t'length-1 downto 0) := reg_ptr_t(to_unsigned(reg_ptr_a, reg_ptr_t'length));
|
||||
|
||||
return inst;
|
||||
|
||||
@@ -824,7 +824,7 @@ package body cpu_pkg is
|
||||
end get_muromaddr;
|
||||
|
||||
-------------------------------------------------------------
|
||||
function MIN (X, Y: INTEGER) return INTEGER is
|
||||
function JMIN (X, Y: INTEGER) return INTEGER is
|
||||
variable res : integer := X;
|
||||
begin
|
||||
if Y < X then
|
||||
@@ -833,10 +833,10 @@ package body cpu_pkg is
|
||||
|
||||
return res;
|
||||
|
||||
end MIN;
|
||||
end JMIN;
|
||||
|
||||
-------------------------------------------------------------
|
||||
function MAX (X, Y: INTEGER) return INTEGER is
|
||||
function JMAX (X, Y: INTEGER) return INTEGER is
|
||||
variable res : integer := X;
|
||||
begin
|
||||
if Y > X then
|
||||
@@ -845,7 +845,7 @@ package body cpu_pkg is
|
||||
|
||||
return res;
|
||||
|
||||
end MAX;
|
||||
end JMAX;
|
||||
|
||||
|
||||
end cpu_pkg;
|
||||
|
||||
@@ -0,0 +1,229 @@
|
||||
-------------------------------------------------------------------------
|
||||
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
||||
-- This file: cpu_embedded using cpu_core and rom
|
||||
--
|
||||
-- Copyright (C) 2007 J. Ahrensfeld
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- For questions and ideas, please contact the author at jens@jayfield.org
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
library IEEE;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
use IEEE.numeric_std.ALL;
|
||||
|
||||
use work.cpu_pkg.all;
|
||||
use work.uart_types.all;
|
||||
|
||||
entity cpu_embedded_with_uart is
|
||||
Port
|
||||
(
|
||||
rst : in STD_LOGIC;
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
int_in : in STD_LOGIC;
|
||||
int_ack : out STD_LOGIC;
|
||||
xmem_we : out STD_LOGIC;
|
||||
xmem_re : out STD_LOGIC;
|
||||
xmem_din : in unsigned (DMEM_DATA_WIDTH-1 downto 0);
|
||||
xmem_dout : out unsigned (DMEM_DATA_WIDTH-1 downto 0);
|
||||
xmem_addr : out unsigned (DMEM_ADDR_WIDTH-1 downto 0);
|
||||
io_sel : out STD_LOGIC;
|
||||
uart_tx : out STD_LOGIC;
|
||||
uart_rx : in STD_LOGIC
|
||||
);
|
||||
end cpu_embedded_with_uart;
|
||||
|
||||
architecture rtl of cpu_embedded_with_uart is
|
||||
|
||||
COMPONENT cpu
|
||||
Port
|
||||
(
|
||||
rst : in STD_LOGIC;
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
int_in : in STD_LOGIC;
|
||||
int_ack : out STD_LOGIC;
|
||||
xmem_we : out STD_LOGIC;
|
||||
xmem_re : out STD_LOGIC;
|
||||
instr_din : in unsigned (IMEM_DATA_WIDTH-1 downto 0);
|
||||
instr_addr : out unsigned (IMEM_ADDR_WIDTH-1 downto 0);
|
||||
xmem_din : in unsigned (DMEM_DATA_WIDTH-1 downto 0);
|
||||
xmem_dout : out unsigned (DMEM_DATA_WIDTH-1 downto 0);
|
||||
xmem_addr : out unsigned (DMEM_DATA_WIDTH-1 downto 0);
|
||||
io_sel : out STD_LOGIC
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
signal cpu_irom_addr : inst_addr_t;
|
||||
signal cpu_xmem_addr : dmem_addr_t;
|
||||
signal cpu_xmem_din : dmem_data_t;
|
||||
signal cpu_xmem_dout : dmem_data_t;
|
||||
signal cpu_io_sel : STD_LOGIC;
|
||||
signal cpu_xmem_we : STD_LOGIC;
|
||||
signal cpu_xmem_re : STD_LOGIC;
|
||||
|
||||
|
||||
COMPONENT irom
|
||||
Port
|
||||
(
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
addr : in inst_addr_t;
|
||||
dout : out inst_t
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
signal irom_data : inst_t;
|
||||
|
||||
|
||||
COMPONENT xrom
|
||||
Port
|
||||
(
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
addr : in dmem_addr_t;
|
||||
dout : out dmem_data_t
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
signal rom_xmem_dout : dmem_data_t;
|
||||
signal reg_xmem_dout : dmem_data_t;
|
||||
|
||||
signal uart_tx_we : STD_LOGIC;
|
||||
signal uart_rx_re : STD_LOGIC;
|
||||
signal uart_tx_din : unsigned(7 downto 0);
|
||||
signal uart_rx_dout : unsigned(7 downto 0);
|
||||
signal uart_ctrl : ctrl_t;
|
||||
signal uart_status : status_t;
|
||||
|
||||
COMPONENT uart
|
||||
Generic
|
||||
(
|
||||
fifo_depth_bits : integer := 4
|
||||
);
|
||||
Port
|
||||
(
|
||||
clk : in STD_LOGIC;
|
||||
rst : in STD_LOGIC;
|
||||
we : in STD_LOGIC;
|
||||
re : in STD_LOGIC;
|
||||
din : in unsigned(7 downto 0);
|
||||
dout : out unsigned(7 downto 0);
|
||||
ser_rx : in std_logic;
|
||||
ser_tx : out std_logic;
|
||||
ctrl : in ctrl_t;
|
||||
status : out status_t
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
begin
|
||||
|
||||
cpu_xmem_din <= rom_xmem_dout when cpu_io_sel = '0' else reg_xmem_dout;
|
||||
|
||||
inst_cpu: cpu
|
||||
PORT MAP
|
||||
(
|
||||
rst => rst,
|
||||
clk => clk,
|
||||
ce => ce,
|
||||
int_in => int_in,
|
||||
int_ack => int_ack,
|
||||
xmem_we => cpu_xmem_we,
|
||||
xmem_re => cpu_xmem_re,
|
||||
instr_din => irom_data,
|
||||
instr_addr => cpu_irom_addr,
|
||||
xmem_din => cpu_xmem_din,
|
||||
xmem_dout => cpu_xmem_dout,
|
||||
xmem_addr => cpu_xmem_addr,
|
||||
io_sel => cpu_io_sel
|
||||
);
|
||||
|
||||
inst_irom: irom
|
||||
PORT MAP
|
||||
(
|
||||
clk => clk,
|
||||
ce => ce,
|
||||
addr => cpu_irom_addr,
|
||||
dout => irom_data
|
||||
);
|
||||
|
||||
inst_xrom: entity work.xrom
|
||||
PORT MAP
|
||||
(
|
||||
clk => clk,
|
||||
ce => ce,
|
||||
addr => cpu_xmem_addr,
|
||||
dout => rom_xmem_dout
|
||||
);
|
||||
|
||||
inst_uart : uart
|
||||
PORT MAP
|
||||
(
|
||||
rst => rst,
|
||||
clk => clk,
|
||||
we => uart_tx_we,
|
||||
re => uart_rx_re,
|
||||
din => uart_tx_din,
|
||||
dout => uart_rx_dout,
|
||||
ser_tx => uart_tx,
|
||||
ser_rx => uart_rx,
|
||||
ctrl => uart_ctrl,
|
||||
status => uart_status
|
||||
);
|
||||
|
||||
uart_tx_din <= cpu_xmem_dout;
|
||||
|
||||
cpu_reg_read:
|
||||
process(clk)
|
||||
variable reg : dmem_data_t;
|
||||
begin
|
||||
if rising_edge(clk) then
|
||||
uart_rx_re <= '0';
|
||||
case cpu_xmem_addr is
|
||||
when X"02" =>
|
||||
uart_rx_re <= '1';
|
||||
reg_xmem_dout <= uart_rx_dout;
|
||||
when X"06" =>
|
||||
reg_xmem_dout <= '0' & '0' & '0' & uart_status.rx_present & '0' & uart_status.tx_complete & uart_status.tx_full & uart_status.tx_empty;
|
||||
|
||||
when others => null;
|
||||
|
||||
end case;
|
||||
end if;
|
||||
|
||||
end process;
|
||||
|
||||
------------------------------------------------------------------
|
||||
cpu_reg_write:
|
||||
process(clk)
|
||||
begin
|
||||
if rising_edge(clk) then
|
||||
uart_tx_we <= '0';
|
||||
if cpu_xmem_we = '1' then
|
||||
if cpu_io_sel = '1' then
|
||||
case cpu_xmem_addr is
|
||||
when X"02" =>
|
||||
uart_tx_we <= '1';
|
||||
when others => null;
|
||||
end case;
|
||||
end if;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end rtl;
|
||||
|
||||
@@ -0,0 +1,186 @@
|
||||
-------------------------------------------------------------------------
|
||||
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
||||
-- This file: The ROM file for use in your VHDL design
|
||||
--
|
||||
-- Copyright (C) 2007 J. Ahrensfeld
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- For questions and ideas, please contact the author at jens@jayfield.org
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
LIBRARY ieee;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
USE ieee.numeric_std.ALL;
|
||||
|
||||
library work;
|
||||
use work.cpu_pkg.all;
|
||||
|
||||
-- JASM_ROM_INSERT_HERE
|
||||
ENTITY irom IS
|
||||
Port (
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
addr : in inst_addr_t;
|
||||
dout : out inst_t
|
||||
);
|
||||
END irom;
|
||||
|
||||
ARCHITECTURE hallo_welt_uart OF irom IS
|
||||
|
||||
type imem_rom_t is array (0 to 124) of inst_t;
|
||||
|
||||
-- Assembled from hallo_welt_uart.jsm
|
||||
constant imem_rom : imem_rom_t :=
|
||||
(
|
||||
"110000" & X"002", -- 0x000: JMP 0x002
|
||||
"111111" & X"000", -- 0x001: RETI
|
||||
"101000" & X"020", -- 0x002: XIN R00, (0x02)
|
||||
"111011" & X"029", -- 0x003: CALL 0x029
|
||||
"111011" & X"039", -- 0x004: CALL 0x039
|
||||
"000010" & X"010", -- 0x005: MOV R00, R01
|
||||
"111011" & X"039", -- 0x006: CALL 0x039
|
||||
"000011" & X"001", -- 0x007: MOV R01, 0x00
|
||||
"111011" & X"030", -- 0x008: CALL 0x030
|
||||
"000011" & X"031", -- 0x009: MOV R01, 0x03
|
||||
"111011" & X"030", -- 0x00A: CALL 0x030
|
||||
"101001" & X"000", -- 0x00B: CIN R00, (0x00)
|
||||
"010001" & X"300", -- 0x00C: ADD R00, 0x30
|
||||
"111011" & X"039", -- 0x00D: CALL 0x039
|
||||
"000011" & X"001", -- 0x00E: MOV R01, 0x00
|
||||
"111011" & X"030", -- 0x00F: CALL 0x030
|
||||
"000011" & X"0D1", -- 0x010: MOV R01, 0x0D
|
||||
"111011" & X"030", -- 0x011: CALL 0x030
|
||||
"000011" & X"161", -- 0x012: MOV R01, 0x16
|
||||
"111011" & X"030", -- 0x013: CALL 0x030
|
||||
"000011" & X"A0F", -- 0x014: MOV R15, 0xA0
|
||||
"001111" & X"00F", -- 0x015: TST R15
|
||||
"110001" & X"020", -- 0x016: JZ 0x020
|
||||
"010101" & X"01F", -- 0x017: DEC R15
|
||||
"000011" & X"301", -- 0x018: MOV R01, 0x30
|
||||
"001111" & X"3A1", -- 0x019: CMP R01, 0x3A
|
||||
"111001" & X"01F", -- 0x01A: JEQ 0x01F
|
||||
"000010" & X"010", -- 0x01B: MOV R00, R01
|
||||
"010001" & X"011", -- 0x01C: INC R01
|
||||
"111011" & X"039", -- 0x01D: CALL 0x039
|
||||
"110000" & X"019", -- 0x01E: JMP 0x019
|
||||
"110000" & X"015", -- 0x01F: JMP 0x015
|
||||
"000011" & X"001", -- 0x020: MOV R01, 0x00
|
||||
"111011" & X"030", -- 0x021: CALL 0x030
|
||||
"110000" & X"009", -- 0x022: JMP 0x009
|
||||
"011001" & X"0F0", -- 0x023: AND R00, 0x0F
|
||||
"001111" & X"0A0", -- 0x024: CMP R00, 0x0A
|
||||
"110101" & X"027", -- 0x025: JLT 0x027
|
||||
"010001" & X"070", -- 0x026: ADD R00, 0x07
|
||||
"010001" & X"300", -- 0x027: ADD R00, 0x30
|
||||
"111110" & X"000", -- 0x028: RET
|
||||
"111100" & X"000", -- 0x029: PUSH R00
|
||||
"111011" & X"023", -- 0x02A: CALL 0x023
|
||||
"000010" & X"001", -- 0x02B: MOV R01, R00
|
||||
"111101" & X"000", -- 0x02C: POP R00
|
||||
"101010" & X"000", -- 0x02D: SWAP R00
|
||||
"111011" & X"023", -- 0x02E: CALL 0x023
|
||||
"111110" & X"000", -- 0x02F: RET
|
||||
"111100" & X"000", -- 0x030: PUSH R00
|
||||
"000100" & X"010", -- 0x031: MOVX R00, (R01)
|
||||
"010001" & X"011", -- 0x032: INC R01
|
||||
"001111" & X"000", -- 0x033: TST R00
|
||||
"110001" & X"037", -- 0x034: JZ 0x037
|
||||
"111011" & X"039", -- 0x035: CALL 0x039
|
||||
"110000" & X"031", -- 0x036: JMP 0x031
|
||||
"111101" & X"000", -- 0x037: POP R00
|
||||
"111110" & X"000", -- 0x038: RET
|
||||
"110000" & X"03A", -- 0x039: JMP 0x03A
|
||||
"111100" & X"001", -- 0x03A: PUSH R01
|
||||
"101000" & X"061", -- 0x03B: XIN R01, (0x06)
|
||||
"011001" & X"021", -- 0x03C: AND R01, 0x02
|
||||
"110010" & X"03B", -- 0x03D: JNZ 0x03B
|
||||
"100100" & X"020", -- 0x03E: XOUT (0x02), R00
|
||||
"111101" & X"001", -- 0x03F: POP R01
|
||||
"111110" & X"000", -- 0x040: RET
|
||||
"111100" & X"001", -- 0x041: PUSH R01
|
||||
"101000" & X"061", -- 0x042: XIN R01, (0x06)
|
||||
"011001" & X"101", -- 0x043: AND R01, 0x10
|
||||
"110010" & X"042", -- 0x044: JNZ 0x042
|
||||
"101000" & X"020", -- 0x045: XIN R00, (0x02)
|
||||
"111101" & X"001", -- 0x046: POP R01
|
||||
"111110" & X"000", -- 0x047: RET
|
||||
"111100" & X"00F", -- 0x048: PUSH R15
|
||||
"000011" & X"0AF", -- 0x049: MOV R15, 0x0A
|
||||
"111011" & X"04F", -- 0x04A: CALL 0x04F
|
||||
"010101" & X"01F", -- 0x04B: DEC R15
|
||||
"110010" & X"04A", -- 0x04C: JNZ 0x04A
|
||||
"111101" & X"00F", -- 0x04D: POP R15
|
||||
"111110" & X"000", -- 0x04E: RET
|
||||
"111100" & X"00F", -- 0x04F: PUSH R15
|
||||
"000011" & X"0AF", -- 0x050: MOV R15, 0x0A
|
||||
"111011" & X"056", -- 0x051: CALL 0x056
|
||||
"010101" & X"01F", -- 0x052: DEC R15
|
||||
"110010" & X"051", -- 0x053: JNZ 0x051
|
||||
"111101" & X"00F", -- 0x054: POP R15
|
||||
"111110" & X"000", -- 0x055: RET
|
||||
"111100" & X"00F", -- 0x056: PUSH R15
|
||||
"000011" & X"0AF", -- 0x057: MOV R15, 0x0A
|
||||
"111011" & X"05D", -- 0x058: CALL 0x05D
|
||||
"010101" & X"01F", -- 0x059: DEC R15
|
||||
"110010" & X"058", -- 0x05A: JNZ 0x058
|
||||
"111101" & X"00F", -- 0x05B: POP R15
|
||||
"111110" & X"000", -- 0x05C: RET
|
||||
"111100" & X"00F", -- 0x05D: PUSH R15
|
||||
"000011" & X"0AF", -- 0x05E: MOV R15, 0x0A
|
||||
"111011" & X"064", -- 0x05F: CALL 0x064
|
||||
"010101" & X"01F", -- 0x060: DEC R15
|
||||
"110010" & X"05F", -- 0x061: JNZ 0x05F
|
||||
"111101" & X"00F", -- 0x062: POP R15
|
||||
"111110" & X"000", -- 0x063: RET
|
||||
"111100" & X"00F", -- 0x064: PUSH R15
|
||||
"000011" & X"0AF", -- 0x065: MOV R15, 0x0A
|
||||
"111011" & X"06B", -- 0x066: CALL 0x06B
|
||||
"010101" & X"01F", -- 0x067: DEC R15
|
||||
"110010" & X"066", -- 0x068: JNZ 0x066
|
||||
"111101" & X"00F", -- 0x069: POP R15
|
||||
"111110" & X"000", -- 0x06A: RET
|
||||
"111100" & X"00F", -- 0x06B: PUSH R15
|
||||
"000011" & X"63F", -- 0x06C: MOV R15, 0x63
|
||||
"000000" & X"000", -- 0x06D: NOP
|
||||
"000000" & X"000", -- 0x06E: NOP
|
||||
"000000" & X"000", -- 0x06F: NOP
|
||||
"010101" & X"01F", -- 0x070: DEC R15
|
||||
"110010" & X"06D", -- 0x071: JNZ 0x06D
|
||||
"111101" & X"00F", -- 0x072: POP R15
|
||||
"111110" & X"000", -- 0x073: RET
|
||||
"111100" & X"00F", -- 0x074: PUSH R15
|
||||
"000011" & X"09F", -- 0x075: MOV R15, 0x09
|
||||
"000000" & X"000", -- 0x076: NOP
|
||||
"000000" & X"000", -- 0x077: NOP
|
||||
"000000" & X"000", -- 0x078: NOP
|
||||
"010101" & X"01F", -- 0x079: DEC R15
|
||||
"110010" & X"076", -- 0x07A: JNZ 0x076
|
||||
"111101" & X"00F", -- 0x07B: POP R15
|
||||
"111110" & X"000" -- 0x07C: RET
|
||||
);
|
||||
|
||||
begin
|
||||
|
||||
PROM_READ:
|
||||
process(clk, ce)
|
||||
begin
|
||||
if rising_edge(clk) and ce = '1' then
|
||||
dout <= imem_rom(to_integer(addr));
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end hallo_welt_uart;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,317 @@
|
||||
-------------------------------------------------------------------------
|
||||
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
||||
-- This file: The ROM file for use in your VHDL design
|
||||
--
|
||||
-- Copyright (C) 2007 J. Ahrensfeld
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- For questions and ideas, please contact the author at jens@jayfield.org
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
LIBRARY ieee;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
USE ieee.numeric_std.ALL;
|
||||
|
||||
library work;
|
||||
use work.cpu_pkg.all;
|
||||
|
||||
-- JASM_ROM_INSERT_HERE
|
||||
ENTITY xrom IS
|
||||
Port (
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
addr : in dmem_addr_t;
|
||||
dout : out dmem_data_t
|
||||
);
|
||||
END xrom;
|
||||
|
||||
ARCHITECTURE hallo_welt_uart OF xrom IS
|
||||
|
||||
type xmem_rom_t is array (0 to 255) of dmem_data_t;
|
||||
|
||||
-- Assembled from hallo_welt_uart.jsm
|
||||
constant xmem_rom : xmem_rom_t :=
|
||||
(
|
||||
X"0D", -- 0x00
|
||||
X"0A", -- 0x01
|
||||
X"00", -- 0x02
|
||||
X"4A", -- 0x03
|
||||
X"2D", -- 0x04
|
||||
X"43", -- 0x05
|
||||
X"50", -- 0x06
|
||||
X"55", -- 0x07
|
||||
X"20", -- 0x08
|
||||
X"56", -- 0x09
|
||||
X"31", -- 0x0A
|
||||
X"2E", -- 0x0B
|
||||
X"00", -- 0x0C
|
||||
X"52", -- 0x0D
|
||||
X"65", -- 0x0E
|
||||
X"61", -- 0x0F
|
||||
X"64", -- 0x10
|
||||
X"79", -- 0x11
|
||||
X"2E", -- 0x12
|
||||
X"0D", -- 0x13
|
||||
X"0A", -- 0x14
|
||||
X"00", -- 0x15
|
||||
X"4D", -- 0x16
|
||||
X"69", -- 0x17
|
||||
X"6D", -- 0x18
|
||||
X"69", -- 0x19
|
||||
X"20", -- 0x1A
|
||||
X"69", -- 0x1B
|
||||
X"73", -- 0x1C
|
||||
X"74", -- 0x1D
|
||||
X"20", -- 0x1E
|
||||
X"65", -- 0x1F
|
||||
X"69", -- 0x20
|
||||
X"6E", -- 0x21
|
||||
X"65", -- 0x22
|
||||
X"20", -- 0x23
|
||||
X"6C", -- 0x24
|
||||
X"69", -- 0x25
|
||||
X"65", -- 0x26
|
||||
X"62", -- 0x27
|
||||
X"65", -- 0x28
|
||||
X"20", -- 0x29
|
||||
X"4B", -- 0x2A
|
||||
X"61", -- 0x2B
|
||||
X"74", -- 0x2C
|
||||
X"7A", -- 0x2D
|
||||
X"65", -- 0x2E
|
||||
X"20", -- 0x2F
|
||||
X"21", -- 0x30
|
||||
X"21", -- 0x31
|
||||
X"21", -- 0x32
|
||||
X"0D", -- 0x33
|
||||
X"0A", -- 0x34
|
||||
X"00", -- 0x35
|
||||
X"00", -- 0x36
|
||||
X"00", -- 0x37
|
||||
X"00", -- 0x38
|
||||
X"00", -- 0x39
|
||||
X"00", -- 0x3A
|
||||
X"00", -- 0x3B
|
||||
X"00", -- 0x3C
|
||||
X"00", -- 0x3D
|
||||
X"00", -- 0x3E
|
||||
X"00", -- 0x3F
|
||||
X"00", -- 0x40
|
||||
X"00", -- 0x41
|
||||
X"00", -- 0x42
|
||||
X"00", -- 0x43
|
||||
X"00", -- 0x44
|
||||
X"00", -- 0x45
|
||||
X"00", -- 0x46
|
||||
X"00", -- 0x47
|
||||
X"00", -- 0x48
|
||||
X"00", -- 0x49
|
||||
X"00", -- 0x4A
|
||||
X"00", -- 0x4B
|
||||
X"00", -- 0x4C
|
||||
X"00", -- 0x4D
|
||||
X"00", -- 0x4E
|
||||
X"00", -- 0x4F
|
||||
X"00", -- 0x50
|
||||
X"00", -- 0x51
|
||||
X"00", -- 0x52
|
||||
X"00", -- 0x53
|
||||
X"00", -- 0x54
|
||||
X"00", -- 0x55
|
||||
X"00", -- 0x56
|
||||
X"00", -- 0x57
|
||||
X"00", -- 0x58
|
||||
X"00", -- 0x59
|
||||
X"00", -- 0x5A
|
||||
X"00", -- 0x5B
|
||||
X"00", -- 0x5C
|
||||
X"00", -- 0x5D
|
||||
X"00", -- 0x5E
|
||||
X"00", -- 0x5F
|
||||
X"00", -- 0x60
|
||||
X"00", -- 0x61
|
||||
X"00", -- 0x62
|
||||
X"00", -- 0x63
|
||||
X"00", -- 0x64
|
||||
X"00", -- 0x65
|
||||
X"00", -- 0x66
|
||||
X"00", -- 0x67
|
||||
X"00", -- 0x68
|
||||
X"00", -- 0x69
|
||||
X"00", -- 0x6A
|
||||
X"00", -- 0x6B
|
||||
X"00", -- 0x6C
|
||||
X"00", -- 0x6D
|
||||
X"00", -- 0x6E
|
||||
X"00", -- 0x6F
|
||||
X"00", -- 0x70
|
||||
X"00", -- 0x71
|
||||
X"00", -- 0x72
|
||||
X"00", -- 0x73
|
||||
X"00", -- 0x74
|
||||
X"00", -- 0x75
|
||||
X"00", -- 0x76
|
||||
X"00", -- 0x77
|
||||
X"00", -- 0x78
|
||||
X"00", -- 0x79
|
||||
X"00", -- 0x7A
|
||||
X"00", -- 0x7B
|
||||
X"00", -- 0x7C
|
||||
X"00", -- 0x7D
|
||||
X"00", -- 0x7E
|
||||
X"00", -- 0x7F
|
||||
X"00", -- 0x80
|
||||
X"00", -- 0x81
|
||||
X"00", -- 0x82
|
||||
X"00", -- 0x83
|
||||
X"00", -- 0x84
|
||||
X"00", -- 0x85
|
||||
X"00", -- 0x86
|
||||
X"00", -- 0x87
|
||||
X"00", -- 0x88
|
||||
X"00", -- 0x89
|
||||
X"00", -- 0x8A
|
||||
X"00", -- 0x8B
|
||||
X"00", -- 0x8C
|
||||
X"00", -- 0x8D
|
||||
X"00", -- 0x8E
|
||||
X"00", -- 0x8F
|
||||
X"00", -- 0x90
|
||||
X"00", -- 0x91
|
||||
X"00", -- 0x92
|
||||
X"00", -- 0x93
|
||||
X"00", -- 0x94
|
||||
X"00", -- 0x95
|
||||
X"00", -- 0x96
|
||||
X"00", -- 0x97
|
||||
X"00", -- 0x98
|
||||
X"00", -- 0x99
|
||||
X"00", -- 0x9A
|
||||
X"00", -- 0x9B
|
||||
X"00", -- 0x9C
|
||||
X"00", -- 0x9D
|
||||
X"00", -- 0x9E
|
||||
X"00", -- 0x9F
|
||||
X"00", -- 0xA0
|
||||
X"00", -- 0xA1
|
||||
X"00", -- 0xA2
|
||||
X"00", -- 0xA3
|
||||
X"00", -- 0xA4
|
||||
X"00", -- 0xA5
|
||||
X"00", -- 0xA6
|
||||
X"00", -- 0xA7
|
||||
X"00", -- 0xA8
|
||||
X"00", -- 0xA9
|
||||
X"00", -- 0xAA
|
||||
X"00", -- 0xAB
|
||||
X"00", -- 0xAC
|
||||
X"00", -- 0xAD
|
||||
X"00", -- 0xAE
|
||||
X"00", -- 0xAF
|
||||
X"00", -- 0xB0
|
||||
X"00", -- 0xB1
|
||||
X"00", -- 0xB2
|
||||
X"00", -- 0xB3
|
||||
X"00", -- 0xB4
|
||||
X"00", -- 0xB5
|
||||
X"00", -- 0xB6
|
||||
X"00", -- 0xB7
|
||||
X"00", -- 0xB8
|
||||
X"00", -- 0xB9
|
||||
X"00", -- 0xBA
|
||||
X"00", -- 0xBB
|
||||
X"00", -- 0xBC
|
||||
X"00", -- 0xBD
|
||||
X"00", -- 0xBE
|
||||
X"00", -- 0xBF
|
||||
X"00", -- 0xC0
|
||||
X"00", -- 0xC1
|
||||
X"00", -- 0xC2
|
||||
X"00", -- 0xC3
|
||||
X"00", -- 0xC4
|
||||
X"00", -- 0xC5
|
||||
X"00", -- 0xC6
|
||||
X"00", -- 0xC7
|
||||
X"00", -- 0xC8
|
||||
X"00", -- 0xC9
|
||||
X"00", -- 0xCA
|
||||
X"00", -- 0xCB
|
||||
X"00", -- 0xCC
|
||||
X"00", -- 0xCD
|
||||
X"00", -- 0xCE
|
||||
X"00", -- 0xCF
|
||||
X"00", -- 0xD0
|
||||
X"00", -- 0xD1
|
||||
X"00", -- 0xD2
|
||||
X"00", -- 0xD3
|
||||
X"00", -- 0xD4
|
||||
X"00", -- 0xD5
|
||||
X"00", -- 0xD6
|
||||
X"00", -- 0xD7
|
||||
X"00", -- 0xD8
|
||||
X"00", -- 0xD9
|
||||
X"00", -- 0xDA
|
||||
X"00", -- 0xDB
|
||||
X"00", -- 0xDC
|
||||
X"00", -- 0xDD
|
||||
X"00", -- 0xDE
|
||||
X"00", -- 0xDF
|
||||
X"00", -- 0xE0
|
||||
X"00", -- 0xE1
|
||||
X"00", -- 0xE2
|
||||
X"00", -- 0xE3
|
||||
X"00", -- 0xE4
|
||||
X"00", -- 0xE5
|
||||
X"00", -- 0xE6
|
||||
X"00", -- 0xE7
|
||||
X"00", -- 0xE8
|
||||
X"00", -- 0xE9
|
||||
X"00", -- 0xEA
|
||||
X"00", -- 0xEB
|
||||
X"00", -- 0xEC
|
||||
X"00", -- 0xED
|
||||
X"00", -- 0xEE
|
||||
X"00", -- 0xEF
|
||||
X"00", -- 0xF0
|
||||
X"00", -- 0xF1
|
||||
X"00", -- 0xF2
|
||||
X"00", -- 0xF3
|
||||
X"00", -- 0xF4
|
||||
X"00", -- 0xF5
|
||||
X"00", -- 0xF6
|
||||
X"00", -- 0xF7
|
||||
X"00", -- 0xF8
|
||||
X"00", -- 0xF9
|
||||
X"00", -- 0xFA
|
||||
X"00", -- 0xFB
|
||||
X"00", -- 0xFC
|
||||
X"00", -- 0xFD
|
||||
X"00", -- 0xFE
|
||||
X"00" -- 0xFF
|
||||
);
|
||||
|
||||
begin
|
||||
|
||||
PROM_READ:
|
||||
process(clk, ce)
|
||||
begin
|
||||
if rising_edge(clk) and ce = '1' then
|
||||
dout <= xmem_rom(to_integer(addr));
|
||||
end if;
|
||||
end process;
|
||||
|
||||
end hallo_welt_uart;
|
||||
|
||||
@@ -0,0 +1,413 @@
|
||||
-------------------------------------------------------------------------
|
||||
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
||||
-- This file: loadable ROM
|
||||
--
|
||||
-- Copyright (C) 2007 J. Ahrensfeld
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- For questions and ideas, please contact the author at jens@jayfield.org
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
LIBRARY ieee;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
USE ieee.numeric_std.ALL;
|
||||
|
||||
library UNISIM;
|
||||
use UNISIM.VComponents.all;
|
||||
|
||||
library work;
|
||||
use work.cpu_pkg.all;
|
||||
|
||||
ENTITY xrom IS
|
||||
Port (
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
addr : in dmem_addr_t;
|
||||
dout : out dmem_data_t
|
||||
);
|
||||
|
||||
END xrom;
|
||||
|
||||
ARCHITECTURE loadable OF xrom IS
|
||||
|
||||
-- JASM_ROM_INSERT_HERE
|
||||
|
||||
-- Assembled from hallo_welt_uart.jsm
|
||||
type xmem_rom_t is array (0 to 255) of dmem_data_t;
|
||||
signal xmem_rom : xmem_rom_t :=
|
||||
(
|
||||
X"0D", -- 0x00
|
||||
X"0A", -- 0x01
|
||||
X"00", -- 0x02
|
||||
X"4A", -- 0x03
|
||||
X"2D", -- 0x04
|
||||
X"43", -- 0x05
|
||||
X"50", -- 0x06
|
||||
X"55", -- 0x07
|
||||
X"20", -- 0x08
|
||||
X"56", -- 0x09
|
||||
X"31", -- 0x0A
|
||||
X"2E", -- 0x0B
|
||||
X"00", -- 0x0C
|
||||
X"52", -- 0x0D
|
||||
X"65", -- 0x0E
|
||||
X"61", -- 0x0F
|
||||
X"64", -- 0x10
|
||||
X"79", -- 0x11
|
||||
X"2E", -- 0x12
|
||||
X"0D", -- 0x13
|
||||
X"0A", -- 0x14
|
||||
X"00", -- 0x15
|
||||
X"4D", -- 0x16
|
||||
X"69", -- 0x17
|
||||
X"6D", -- 0x18
|
||||
X"69", -- 0x19
|
||||
X"20", -- 0x1A
|
||||
X"69", -- 0x1B
|
||||
X"73", -- 0x1C
|
||||
X"74", -- 0x1D
|
||||
X"20", -- 0x1E
|
||||
X"65", -- 0x1F
|
||||
X"69", -- 0x20
|
||||
X"6E", -- 0x21
|
||||
X"65", -- 0x22
|
||||
X"20", -- 0x23
|
||||
X"6C", -- 0x24
|
||||
X"69", -- 0x25
|
||||
X"65", -- 0x26
|
||||
X"62", -- 0x27
|
||||
X"65", -- 0x28
|
||||
X"20", -- 0x29
|
||||
X"4B", -- 0x2A
|
||||
X"61", -- 0x2B
|
||||
X"74", -- 0x2C
|
||||
X"7A", -- 0x2D
|
||||
X"65", -- 0x2E
|
||||
X"20", -- 0x2F
|
||||
X"21", -- 0x30
|
||||
X"21", -- 0x31
|
||||
X"21", -- 0x32
|
||||
X"0D", -- 0x33
|
||||
X"0A", -- 0x34
|
||||
X"00", -- 0x35
|
||||
X"00", -- 0x36
|
||||
X"00", -- 0x37
|
||||
X"00", -- 0x38
|
||||
X"00", -- 0x39
|
||||
X"00", -- 0x3A
|
||||
X"00", -- 0x3B
|
||||
X"00", -- 0x3C
|
||||
X"00", -- 0x3D
|
||||
X"00", -- 0x3E
|
||||
X"00", -- 0x3F
|
||||
X"00", -- 0x40
|
||||
X"00", -- 0x41
|
||||
X"00", -- 0x42
|
||||
X"00", -- 0x43
|
||||
X"00", -- 0x44
|
||||
X"00", -- 0x45
|
||||
X"00", -- 0x46
|
||||
X"00", -- 0x47
|
||||
X"00", -- 0x48
|
||||
X"00", -- 0x49
|
||||
X"00", -- 0x4A
|
||||
X"00", -- 0x4B
|
||||
X"00", -- 0x4C
|
||||
X"00", -- 0x4D
|
||||
X"00", -- 0x4E
|
||||
X"00", -- 0x4F
|
||||
X"00", -- 0x50
|
||||
X"00", -- 0x51
|
||||
X"00", -- 0x52
|
||||
X"00", -- 0x53
|
||||
X"00", -- 0x54
|
||||
X"00", -- 0x55
|
||||
X"00", -- 0x56
|
||||
X"00", -- 0x57
|
||||
X"00", -- 0x58
|
||||
X"00", -- 0x59
|
||||
X"00", -- 0x5A
|
||||
X"00", -- 0x5B
|
||||
X"00", -- 0x5C
|
||||
X"00", -- 0x5D
|
||||
X"00", -- 0x5E
|
||||
X"00", -- 0x5F
|
||||
X"00", -- 0x60
|
||||
X"00", -- 0x61
|
||||
X"00", -- 0x62
|
||||
X"00", -- 0x63
|
||||
X"00", -- 0x64
|
||||
X"00", -- 0x65
|
||||
X"00", -- 0x66
|
||||
X"00", -- 0x67
|
||||
X"00", -- 0x68
|
||||
X"00", -- 0x69
|
||||
X"00", -- 0x6A
|
||||
X"00", -- 0x6B
|
||||
X"00", -- 0x6C
|
||||
X"00", -- 0x6D
|
||||
X"00", -- 0x6E
|
||||
X"00", -- 0x6F
|
||||
X"00", -- 0x70
|
||||
X"00", -- 0x71
|
||||
X"00", -- 0x72
|
||||
X"00", -- 0x73
|
||||
X"00", -- 0x74
|
||||
X"00", -- 0x75
|
||||
X"00", -- 0x76
|
||||
X"00", -- 0x77
|
||||
X"00", -- 0x78
|
||||
X"00", -- 0x79
|
||||
X"00", -- 0x7A
|
||||
X"00", -- 0x7B
|
||||
X"00", -- 0x7C
|
||||
X"00", -- 0x7D
|
||||
X"00", -- 0x7E
|
||||
X"00", -- 0x7F
|
||||
X"00", -- 0x80
|
||||
X"00", -- 0x81
|
||||
X"00", -- 0x82
|
||||
X"00", -- 0x83
|
||||
X"00", -- 0x84
|
||||
X"00", -- 0x85
|
||||
X"00", -- 0x86
|
||||
X"00", -- 0x87
|
||||
X"00", -- 0x88
|
||||
X"00", -- 0x89
|
||||
X"00", -- 0x8A
|
||||
X"00", -- 0x8B
|
||||
X"00", -- 0x8C
|
||||
X"00", -- 0x8D
|
||||
X"00", -- 0x8E
|
||||
X"00", -- 0x8F
|
||||
X"00", -- 0x90
|
||||
X"00", -- 0x91
|
||||
X"00", -- 0x92
|
||||
X"00", -- 0x93
|
||||
X"00", -- 0x94
|
||||
X"00", -- 0x95
|
||||
X"00", -- 0x96
|
||||
X"00", -- 0x97
|
||||
X"00", -- 0x98
|
||||
X"00", -- 0x99
|
||||
X"00", -- 0x9A
|
||||
X"00", -- 0x9B
|
||||
X"00", -- 0x9C
|
||||
X"00", -- 0x9D
|
||||
X"00", -- 0x9E
|
||||
X"00", -- 0x9F
|
||||
X"00", -- 0xA0
|
||||
X"00", -- 0xA1
|
||||
X"00", -- 0xA2
|
||||
X"00", -- 0xA3
|
||||
X"00", -- 0xA4
|
||||
X"00", -- 0xA5
|
||||
X"00", -- 0xA6
|
||||
X"00", -- 0xA7
|
||||
X"00", -- 0xA8
|
||||
X"00", -- 0xA9
|
||||
X"00", -- 0xAA
|
||||
X"00", -- 0xAB
|
||||
X"00", -- 0xAC
|
||||
X"00", -- 0xAD
|
||||
X"00", -- 0xAE
|
||||
X"00", -- 0xAF
|
||||
X"00", -- 0xB0
|
||||
X"00", -- 0xB1
|
||||
X"00", -- 0xB2
|
||||
X"00", -- 0xB3
|
||||
X"00", -- 0xB4
|
||||
X"00", -- 0xB5
|
||||
X"00", -- 0xB6
|
||||
X"00", -- 0xB7
|
||||
X"00", -- 0xB8
|
||||
X"00", -- 0xB9
|
||||
X"00", -- 0xBA
|
||||
X"00", -- 0xBB
|
||||
X"00", -- 0xBC
|
||||
X"00", -- 0xBD
|
||||
X"00", -- 0xBE
|
||||
X"00", -- 0xBF
|
||||
X"00", -- 0xC0
|
||||
X"00", -- 0xC1
|
||||
X"00", -- 0xC2
|
||||
X"00", -- 0xC3
|
||||
X"00", -- 0xC4
|
||||
X"00", -- 0xC5
|
||||
X"00", -- 0xC6
|
||||
X"00", -- 0xC7
|
||||
X"00", -- 0xC8
|
||||
X"00", -- 0xC9
|
||||
X"00", -- 0xCA
|
||||
X"00", -- 0xCB
|
||||
X"00", -- 0xCC
|
||||
X"00", -- 0xCD
|
||||
X"00", -- 0xCE
|
||||
X"00", -- 0xCF
|
||||
X"00", -- 0xD0
|
||||
X"00", -- 0xD1
|
||||
X"00", -- 0xD2
|
||||
X"00", -- 0xD3
|
||||
X"00", -- 0xD4
|
||||
X"00", -- 0xD5
|
||||
X"00", -- 0xD6
|
||||
X"00", -- 0xD7
|
||||
X"00", -- 0xD8
|
||||
X"00", -- 0xD9
|
||||
X"00", -- 0xDA
|
||||
X"00", -- 0xDB
|
||||
X"00", -- 0xDC
|
||||
X"00", -- 0xDD
|
||||
X"00", -- 0xDE
|
||||
X"00", -- 0xDF
|
||||
X"00", -- 0xE0
|
||||
X"00", -- 0xE1
|
||||
X"00", -- 0xE2
|
||||
X"00", -- 0xE3
|
||||
X"00", -- 0xE4
|
||||
X"00", -- 0xE5
|
||||
X"00", -- 0xE6
|
||||
X"00", -- 0xE7
|
||||
X"00", -- 0xE8
|
||||
X"00", -- 0xE9
|
||||
X"00", -- 0xEA
|
||||
X"00", -- 0xEB
|
||||
X"00", -- 0xEC
|
||||
X"00", -- 0xED
|
||||
X"00", -- 0xEE
|
||||
X"00", -- 0xEF
|
||||
X"00", -- 0xF0
|
||||
X"00", -- 0xF1
|
||||
X"00", -- 0xF2
|
||||
X"00", -- 0xF3
|
||||
X"00", -- 0xF4
|
||||
X"00", -- 0xF5
|
||||
X"00", -- 0xF6
|
||||
X"00", -- 0xF7
|
||||
X"00", -- 0xF8
|
||||
X"00", -- 0xF9
|
||||
X"00", -- 0xFA
|
||||
X"00", -- 0xFB
|
||||
X"00", -- 0xFC
|
||||
X"00", -- 0xFD
|
||||
X"00", -- 0xFE
|
||||
X"00" -- 0xFF
|
||||
);
|
||||
|
||||
signal jtag_ld_clk : STD_LOGIC;
|
||||
signal jtag_ld_we : STD_LOGIC;
|
||||
signal jtag_ld_addr : dmem_addr_t;
|
||||
signal jtag_ld_dout : dmem_data_t;
|
||||
signal jtag_ld_din : dmem_data_t;
|
||||
signal bs_rst, bs_sel, bs_shift, bs_tdi, bs_tdo : std_logic;
|
||||
signal bs_capture, bs_clk0, bs_clk1, bs_update0, bs_update1 : std_logic;
|
||||
signal user_regi, user_rego : unsigned (15 downto 0);
|
||||
constant id : unsigned (15 downto 0) := X"BEEF";
|
||||
|
||||
begin
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- Virtex-4: JTAG Loader
|
||||
--------------------------------------------------------------------------
|
||||
i00_BUFG : BUFG
|
||||
port map
|
||||
(
|
||||
O => bs_clk1,
|
||||
I => bs_clk0
|
||||
);
|
||||
|
||||
i01_BUFG : BUFG
|
||||
port map
|
||||
(
|
||||
O => bs_update1,
|
||||
I => bs_update0
|
||||
);
|
||||
|
||||
BSCAN_VIRTEX4_inst2 : BSCAN_VIRTEX4
|
||||
generic map
|
||||
(
|
||||
JTAG_CHAIN => 2 -- Value to set BSCAN site of device. Possible values: (1,2,3 or 4)
|
||||
)
|
||||
port map
|
||||
(
|
||||
CAPTURE => bs_capture, -- CAPTURE output from TAP controller
|
||||
DRCK => bs_clk0, -- Data register output for USER functions
|
||||
RESET => bs_rst, -- Reset output from TAP controller
|
||||
SEL => bs_sel, -- USER active output
|
||||
SHIFT => bs_shift, -- SHIFT output from TAP controller
|
||||
TDI => bs_tdi, -- TDI output from TAP controller
|
||||
UPDATE => bs_update0, -- UPDATE output from TAP controller
|
||||
TDO => bs_tdo -- Data input for USER function
|
||||
);
|
||||
|
||||
jtag_ld_addr <= user_regi(user_regi'left downto user_regi'left-dmem_data_t'length+1);
|
||||
jtag_ld_din <= user_regi(dmem_data_t'left downto 0);
|
||||
jtag_ld_clk <= bs_update1;
|
||||
jtag_ld_we <= bs_sel;
|
||||
|
||||
sipo:
|
||||
process (bs_rst, bs_clk1, bs_tdi, bs_shift)
|
||||
begin
|
||||
if bs_rst = '1' then
|
||||
user_regi <= (others => '0');
|
||||
elsif rising_edge(bs_clk1) then
|
||||
if bs_shift = '1' then
|
||||
user_regi <= bs_tdi & user_regi(user_regi'left downto 1);
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
piso:
|
||||
process (bs_rst, bs_clk1, bs_shift, user_rego)
|
||||
begin
|
||||
bs_tdo <= user_rego(0);
|
||||
if bs_rst = '1' then
|
||||
user_rego <= (others => '0');
|
||||
elsif rising_edge(bs_clk1) then
|
||||
if bs_shift = '1' then
|
||||
user_rego <= user_rego(0) & user_rego(user_rego'left downto 1);
|
||||
else
|
||||
user_rego <= (user_rego'left downto dmem_data_t'length => '0') & jtag_ld_dout;
|
||||
-- user_rego <= id;
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
-- ROM Read/Write
|
||||
--------------------------------------------------------------------------
|
||||
PROM_READ:
|
||||
process(clk, ce)
|
||||
begin
|
||||
if rising_edge(clk) and ce = '1' then
|
||||
dout <= xmem_rom(to_integer(addr));
|
||||
end if;
|
||||
end process;
|
||||
|
||||
PROM_WRITE:
|
||||
process(jtag_ld_clk, jtag_ld_we)
|
||||
begin
|
||||
if rising_edge(jtag_ld_clk) then
|
||||
if jtag_ld_we = '1' then
|
||||
xmem_rom(to_integer(jtag_ld_addr)) <= jtag_ld_din;
|
||||
else
|
||||
jtag_ld_dout <= xmem_rom(to_integer(jtag_ld_addr));
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
end loadable;
|
||||
@@ -102,7 +102,6 @@ STIMULUS: process
|
||||
|
||||
wait for 1000*CLK_PERIOD;
|
||||
|
||||
assert false report "Test finished" severity error;
|
||||
wait;
|
||||
|
||||
end process;
|
||||
|
||||
@@ -0,0 +1,132 @@
|
||||
-------------------------------------------------------------------------
|
||||
-- Project: JCPU, a portable 8-bit RISC CPU written in VHDL
|
||||
-- This file: testbench for embedded cpu with rom
|
||||
--
|
||||
-- Copyright (C) 2007 J. Ahrensfeld
|
||||
--
|
||||
-- This program is free software: you can redistribute it and/or modify
|
||||
-- it under the terms of the GNU General Public License as published by
|
||||
-- the Free Software Foundation, either version 3 of the License, or
|
||||
-- (at your option) any later version.
|
||||
--
|
||||
-- This program is distributed in the hope that it will be useful,
|
||||
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
-- GNU General Public License for more details.
|
||||
--
|
||||
-- You should have received a copy of the GNU General Public License
|
||||
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
--
|
||||
-- For questions and ideas, please contact the author at jens@jayfield.org
|
||||
--
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
LIBRARY ieee;
|
||||
use IEEE.STD_LOGIC_1164.ALL;
|
||||
USE ieee.numeric_std.ALL;
|
||||
use std.textio.all; -- Imports the standard textio package.
|
||||
|
||||
library work;
|
||||
use work.cpu_pkg.all;
|
||||
|
||||
ENTITY tb_cpu_embedded_with_uart IS
|
||||
END tb_cpu_embedded_with_uart;
|
||||
|
||||
ARCHITECTURE behavior OF tb_cpu_embedded_with_uart IS
|
||||
|
||||
COMPONENT cpu_embedded_with_uart
|
||||
Port (
|
||||
rst : in STD_LOGIC;
|
||||
clk : in STD_LOGIC;
|
||||
ce : in STD_LOGIC;
|
||||
int_in : in STD_LOGIC;
|
||||
int_ack : out STD_LOGIC;
|
||||
xmem_we : out STD_LOGIC;
|
||||
xmem_re : out STD_LOGIC;
|
||||
xmem_din : in unsigned (DMEM_DATA_WIDTH-1 downto 0);
|
||||
xmem_dout : out unsigned (DMEM_DATA_WIDTH-1 downto 0);
|
||||
xmem_addr : out unsigned (DMEM_ADDR_WIDTH-1 downto 0);
|
||||
io_sel : out STD_LOGIC;
|
||||
uart_tx : out STD_LOGIC;
|
||||
uart_rx : in STD_LOGIC
|
||||
);
|
||||
END COMPONENT;
|
||||
|
||||
constant CLK_PERIOD : time := 10 ns;
|
||||
type sram_t is array (integer range <>) of dmem_data_t;
|
||||
signal rst : std_logic := '1';
|
||||
signal clk : std_logic := '1';
|
||||
signal ce : std_logic := '0';
|
||||
signal int_in : std_logic := '0';
|
||||
signal int_ack : std_logic;
|
||||
signal xmem_din : dmem_data_t := (others => '-');
|
||||
signal xmem_dout : dmem_data_t;
|
||||
signal xmem_addr : dmem_addr_t;
|
||||
signal xmem_we : std_logic;
|
||||
signal xmem_re : std_logic;
|
||||
signal io_sel : std_logic;
|
||||
signal sram : sram_t(0 to 2**dmem_addr_t'length-1);
|
||||
signal uart_tx : std_logic;
|
||||
signal uart_rx : std_logic := '1';
|
||||
|
||||
|
||||
BEGIN
|
||||
|
||||
uut: cpu_embedded_with_uart
|
||||
PORT MAP
|
||||
(
|
||||
rst => rst,
|
||||
clk => clk,
|
||||
ce => ce,
|
||||
int_in => int_in,
|
||||
int_ack => int_ack,
|
||||
xmem_we => xmem_we,
|
||||
xmem_re => xmem_re,
|
||||
xmem_din => xmem_din,
|
||||
xmem_dout => xmem_dout,
|
||||
xmem_addr => xmem_addr,
|
||||
io_sel => io_sel,
|
||||
uart_tx => uart_tx,
|
||||
uart_rx => uart_rx
|
||||
);
|
||||
|
||||
CLK_GEN: process
|
||||
begin
|
||||
wait for CLK_PERIOD/2;
|
||||
clk <= not clk;
|
||||
end process;
|
||||
|
||||
STIMULUS: process
|
||||
|
||||
begin
|
||||
|
||||
wait for 3*CLK_PERIOD;
|
||||
rst <= '0';
|
||||
wait for 2*CLK_PERIOD;
|
||||
|
||||
wait until rising_edge(clk);
|
||||
ce <= '1';
|
||||
|
||||
wait for 1000*CLK_PERIOD;
|
||||
|
||||
wait;
|
||||
|
||||
end process;
|
||||
|
||||
SRAM_RW: process(rst, clk, xmem_addr, xmem_dout, xmem_we)
|
||||
begin
|
||||
if (rst = '1') then
|
||||
xmem_din <= X"00";
|
||||
elsif rising_edge(clk) then
|
||||
if io_sel = '0' then
|
||||
if xmem_we = '1' then
|
||||
sram(to_integer(xmem_addr)) <= xmem_dout;
|
||||
end if;
|
||||
xmem_din <= to_01(sram(to_integer(xmem_addr)));
|
||||
else
|
||||
xmem_din <= X"FF";
|
||||
end if;
|
||||
end if;
|
||||
end process;
|
||||
|
||||
END;
|
||||
@@ -160,7 +160,6 @@ STIMULUS: process
|
||||
wait for 300*CLK_PERIOD;
|
||||
end loop;
|
||||
|
||||
assert false report "Test finished" severity error;
|
||||
wait;
|
||||
|
||||
end process;
|
||||
|
||||
@@ -135,10 +135,11 @@ CLK_GEN: process
|
||||
end process;
|
||||
|
||||
STIMULUS: process
|
||||
file RESULT: text open write_mode is "../tools/opc.list";
|
||||
file RESULT: text;
|
||||
variable L: line;
|
||||
|
||||
begin
|
||||
file_open(RESULT, "../tools/opc.list", WRITE_MODE);
|
||||
|
||||
for i in 0 to instr_name_array'length-1 loop
|
||||
fprint(RESULT, L,"%d %s\n", fo(i), instr_name_array(i));
|
||||
@@ -151,7 +152,8 @@ STIMULUS: process
|
||||
wait until rising_edge(clk);
|
||||
ce <= '1';
|
||||
|
||||
assert false report "Test finished" severity error;
|
||||
file_close(RESULT);
|
||||
|
||||
wait;
|
||||
|
||||
end process;
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\cpu_pkg.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\stack_ctrl.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\reg_dual.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\pc.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\int_ctrl.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\dpath_ctrl.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\chipreg.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\chipram.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\alu.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\cpu.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\cpu_pkg.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\stack_ctrl.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\reg_dual.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\pc.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\int_ctrl.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\dpath_ctrl.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\chipreg.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\chipram.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\alu.vhd"
|
||||
vhdl work "W:\vhdl\lib\CPUs\JCpu\src\core\cpu.vhd"
|
||||
|
||||
+16
-19
@@ -33,7 +33,7 @@ XROM_MAX_SIZE = 256
|
||||
XROM_DATA_TYPE = "dmem_data_t"
|
||||
XROM_ADDR_TYPE = "dmem_addr_t"
|
||||
XROM_ENTITY_NAME = "xrom"
|
||||
OPC_LIST_NAME = "/cygdrive/w/vhdl/lib/CPUs/JCpu/tools/opc.list"
|
||||
OPC_LIST_NAME = __dir__ + "/opc.list"
|
||||
|
||||
# --------------------------------------------------------
|
||||
class Parser
|
||||
@@ -179,6 +179,7 @@ file.each do |raw_line|
|
||||
end
|
||||
|
||||
token = iline_member[mc]
|
||||
mcnt = iline_member.count{|x| !x.nil?}
|
||||
if token
|
||||
token = token.upcase
|
||||
end
|
||||
@@ -209,7 +210,7 @@ file.each do |raw_line|
|
||||
exit 1
|
||||
end
|
||||
if 0 == (iline_member[mc+1] =~ /\d+/)
|
||||
curr_addr = format("0x%2.2X",eval(iline_member[mc+1..iline_member.nitems].to_s))
|
||||
curr_addr = format("0x%2.2X",eval(iline_member[mc+1..mcnt][0].to_s))
|
||||
else
|
||||
curr_addr = iline_member[mc+1]
|
||||
end
|
||||
@@ -218,7 +219,7 @@ file.each do |raw_line|
|
||||
STDERR.puts format("Error in line %d: %s needs argument!", lc, token)
|
||||
exit 1
|
||||
end
|
||||
offset = eval(iline_member[mc+1..iline_member.nitems].to_s)
|
||||
offset = eval(iline_member[mc+1..mcnt][0].to_s)
|
||||
case obj.curr_segment
|
||||
when "CODE"
|
||||
obj.pc = offset
|
||||
@@ -259,17 +260,13 @@ file.each do |raw_line|
|
||||
val_array.each do |item|
|
||||
if 0 == (item =~ /.*\".*\"/)
|
||||
str = item.delete("\"")
|
||||
puts item
|
||||
for nn in (0..str.length-1)
|
||||
if str[nn] > 31
|
||||
obj.put_xmem(str[nn], lc);
|
||||
puts "S: " + str[nn].to_s
|
||||
len += 1
|
||||
end
|
||||
value = str[nn].ord
|
||||
obj.put_xmem(value, lc);
|
||||
len += 1
|
||||
end;
|
||||
else
|
||||
argument = item
|
||||
puts "B: " + argument
|
||||
obj.put_xmem(eval(argument), lc);
|
||||
len += 1
|
||||
end
|
||||
@@ -307,14 +304,14 @@ file.each do |raw_line|
|
||||
exit 1
|
||||
end
|
||||
|
||||
op_line = iline_member[mc+1..iline_member.nitems].to_s
|
||||
op_line = iline_member[mc+1..mcnt]
|
||||
curr_addr = format("0x%3.3X",obj.pc)
|
||||
opc = token
|
||||
if iline_member[mc+1] != nil
|
||||
op1 = op_line.gsub(/,+.*$/, "")
|
||||
op1 = op_line[0].to_s.gsub(/,+.*$/, "")
|
||||
end
|
||||
if iline_member[mc+2] != nil
|
||||
op2 = op_line.scan(/,.+$/).to_s.delete(", ")
|
||||
op2 = op_line[1].to_s.gsub(/,+.*$/, "")
|
||||
end
|
||||
obj.put_instr(name, lc, opc, op1, op2)
|
||||
obj.pc = obj.pc + 1
|
||||
@@ -383,7 +380,7 @@ end
|
||||
# --------------------------------------------------------
|
||||
# Open file
|
||||
# --------------------------------------------------------
|
||||
filename = arg.to_s
|
||||
filename = arg[0].to_s
|
||||
if !File.exists?(filename)
|
||||
STDERR.puts "#{filename} does not exist"
|
||||
exit 1
|
||||
@@ -743,10 +740,10 @@ if num_errors == 0
|
||||
file.puts format("\tconstant xmem_rom : xmem_rom_t :=\n")
|
||||
file.puts format("\t(\n");
|
||||
for i in (0..XROM_MAX_SIZE-2)
|
||||
file.puts format("\t\tX\"%2.2X\", -- 0x%2.2X\n", first_pass.xmem[i], i)
|
||||
file.puts format("\t\tX\"%2.2X\", -- 0x%2.2X\n", first_pass.xmem[i].to_i(), i)
|
||||
end;
|
||||
i = XROM_MAX_SIZE-1
|
||||
file.puts format("\t\tX\"%2.2X\" -- 0x%2.2X\n", first_pass.xmem[i], i)
|
||||
file.puts format("\t\tX\"%2.2X\" -- 0x%2.2X\n", first_pass.xmem[i].to_i(), i)
|
||||
file.puts format("\t);\n")
|
||||
file.puts format("\n")
|
||||
file.puts format("begin")
|
||||
@@ -772,15 +769,15 @@ if num_errors == 0
|
||||
file.puts format("\tsignal xmem_rom : xmem_rom_t :=\n")
|
||||
file.puts format("\t(\n");
|
||||
for i in (0..XROM_MAX_SIZE-2)
|
||||
file.puts format("\t\tX\"%2.2X\", -- 0x%2.2X\n", first_pass.xmem[i], i)
|
||||
file.puts format("\t\tX\"%2.2X\", -- 0x%2.2X\n", first_pass.xmem[i].to_i(), i)
|
||||
end;
|
||||
i = XROM_MAX_SIZE-1
|
||||
file.puts format("\t\tX\"%2.2X\" -- 0x%2.2X\n", first_pass.xmem[i], i)
|
||||
file.puts format("\t\tX\"%2.2X\" -- 0x%2.2X\n", first_pass.xmem[i].to_i(), i)
|
||||
file.puts format("\t);\n")
|
||||
puts format("X-ROM (loadable) file written to \"%s\"\n",filename)
|
||||
file.close
|
||||
|
||||
# X-ROM TCL-Loader
|
||||
# X-ROM JTAG-Loader
|
||||
filename = format("%s.xrom.tcl.snip", PROJECT_NAME)
|
||||
file = File.open(filename, "w")
|
||||
file.puts format("# Assembled from %s.%s", PROJECT_NAME, FILE_SUFFIX)
|
||||
|
||||
@@ -4,6 +4,31 @@
|
||||
; needs xmem-address definition for
|
||||
; - uart_status (Status register)
|
||||
; - uart_data (Data register)
|
||||
UART_TX_EMPTY: equ 0x01
|
||||
UART_TX_FULL: equ 0x02
|
||||
UART_TX_CMPL: equ 0x04
|
||||
UART_RX_PRESENT: equ 0x10
|
||||
|
||||
; -------------------------------------------------
|
||||
; uart_puts
|
||||
; -------------------------------------------------
|
||||
; R1 : ptr to string
|
||||
uart_puts: push R0
|
||||
u_p_lp: movx R0, (R1)
|
||||
inc R1
|
||||
tst R0
|
||||
jz ex_ugp
|
||||
call uart_putchar
|
||||
jmp u_p_lp
|
||||
ex_ugp: pop R0
|
||||
ret
|
||||
|
||||
|
||||
; -------------------------------------------------
|
||||
; uart_putchar
|
||||
; -------------------------------------------------
|
||||
; R0 = input
|
||||
uart_putchar: jmp sout
|
||||
|
||||
; -------------------------------------------------
|
||||
; sout
|
||||
@@ -11,7 +36,7 @@
|
||||
; R0 = input
|
||||
sout: push R1
|
||||
sout1: xin R1, (uart_status)
|
||||
and R1, 0x02
|
||||
and R1, UART_TX_FULL
|
||||
jnz sout1
|
||||
xout (uart_data), R0
|
||||
pop R1
|
||||
@@ -23,10 +48,11 @@ sout1: xin R1, (uart_status)
|
||||
; R0 = output
|
||||
sin: push R1
|
||||
sin1: xin R1, (uart_status)
|
||||
and R1, 0x10
|
||||
and R1, UART_RX_PRESENT
|
||||
jnz sin1
|
||||
xin R0, (uart_data)
|
||||
pop R1
|
||||
ret
|
||||
|
||||
; -------------------------------------------------
|
||||
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/dbg.c
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/irq.c
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/irq.h
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/kernel.S
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/libsys.c
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/libsys.h
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/mips_gfx.c
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/mips_gfx.h
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/mips_ps2.c
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/mips_ps2.h
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/mipsdis.c
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/mipsdis.h
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/regdef.h
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/startup.S
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/xcpt.c
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/xcpt.h
|
||||
|
||||
VHDL/lib/CPUs/MIPS/bsp/examples/xcpt_asm.h
|
||||
|
||||
@@ -1,87 +0,0 @@
|
||||
/************************************************************************/
|
||||
/* Ein Programm zur Berechnung der Bessel-Koeffizienten Jn
|
||||
/* Dateiname : Bessel.cpp
|
||||
/* Autoren : T. Burr, J. Ahrensfeld
|
||||
/* Datum : 28.10.1999
|
||||
/* letzte Änderung : 28.01.2000
|
||||
/* Version : 1.0
|
||||
/************************************************************************/
|
||||
|
||||
#include "stdio.h"
|
||||
#include "math.h"
|
||||
#include "stdlib.h"
|
||||
|
||||
|
||||
#define MAX_SUM 25
|
||||
#define VERSION "1.0"
|
||||
|
||||
/************************************************************************/
|
||||
/* Funktionsdeklarationen */
|
||||
/************************************************************************/
|
||||
// Fakultätsberechnung
|
||||
double fak (int N)
|
||||
{
|
||||
int index;
|
||||
double erg=1;
|
||||
|
||||
for (index = 1; index <= N; index++)
|
||||
erg = erg * index;
|
||||
|
||||
return erg;
|
||||
}
|
||||
|
||||
// Bessel()
|
||||
// Berechnung von Jn von mfm
|
||||
double bessel(int n, double mfm)
|
||||
{
|
||||
int m;
|
||||
double Jn=0;
|
||||
|
||||
for (m=0; m < MAX_SUM; m++)
|
||||
{
|
||||
Jn = Jn + (pow(-1.0,m)/(fak(m)*fak(m+n))*pow(mfm/2.0,(2*m+n)));
|
||||
}
|
||||
return Jn;
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* Das Hauptprogramm
|
||||
/************************************************************************/
|
||||
void main()
|
||||
{
|
||||
|
||||
int N, Nmax;
|
||||
double erg;
|
||||
float mfm;
|
||||
|
||||
printf("\n\t Besselfunktion Version %s",VERSION);
|
||||
printf("\n\t ~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
|
||||
printf("\n\tCopyright by J. Ahrensfeld & T. Burr\n\n");
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// Benutzereingaben
|
||||
printf("\nBerechnungen fuer J = 0...");
|
||||
if(scanf("%d",&Nmax)==0)
|
||||
exit (-1);
|
||||
|
||||
printf("Bitte Modulationsindex eingeben : ");
|
||||
if(scanf("%f",&mfm)==0)
|
||||
exit(-1);
|
||||
|
||||
printf("\n");
|
||||
|
||||
// ---------------------------------------------------------------------------------
|
||||
// Berechnung
|
||||
for (N=0; N <= Nmax; N++)
|
||||
{
|
||||
erg = bessel(N,(double)mfm);
|
||||
printf("J(%d) = %10.8f\n",N,erg);
|
||||
}
|
||||
|
||||
printf("FERTIG.\n");
|
||||
|
||||
}
|
||||
|
||||
/************************************************************************/
|
||||
|
||||
@@ -1,333 +0,0 @@
|
||||
ENDIAN='big'
|
||||
|
||||
ifeq ($(ENDIAN), 'big')
|
||||
ENDIAN_FLAGS=-EB
|
||||
CFLAGS=$(ENDIAN_FLAGS) -specs=specs/eb/specs -msoft-float -O2 -march=r3000 -I. -Ilibsys -Wl,-M
|
||||
else
|
||||
ENDIAN_FLAGS=-EL
|
||||
CFLAGS=$(ENDIAN_FLAGS) -specs=specs/specs -msoft-float -O2 -march=r3000 -I. -Ilibsys -Wl,-M
|
||||
endif
|
||||
|
||||
LIBS=-lm -lsys
|
||||
|
||||
AS=mipsel-elf-as
|
||||
AR=mipsel-elf-ar
|
||||
CC=mipsel-elf-gcc
|
||||
LD=mipsel-elf-ld
|
||||
OBJDUMP=mipsel-elf-objdump
|
||||
OBJCOPY=mipsel-elf-objcopy
|
||||
FLASHGEN=flashgen
|
||||
|
||||
PROG = hello.elf testbench.elf test_irq.elf dhry.elf queens.elf stanford.elf paranoia.elf rmd160_test.elf Bessel.elf whet.elf phrasen.elf dttl.elf richards_benchmark.elf test_exception.elf life.elf r3.elf gunzip.elf basic_math.elf jman_patches.elf jman_patchmeshes.elf jman_polys.elf test_hpi.elf test_vga.elf
|
||||
|
||||
all: $(PROG)
|
||||
|
||||
libsys.a:
|
||||
$(MAKE) -C libsys
|
||||
|
||||
hello.elf: hello.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -Os hello.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
testbench.elf: testbench.c libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ -DHZ=1000 -DNOSIGNAL -DBATCHMODE -DNOMAIN -Os -g testbench.c paranoia.c delay_mips.c bogomips.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
test_irq.elf: test_irq.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ test_irq.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
dhry.elf: dhry_1.c dhry_2.c dhry.h libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -DHZ=1000 dhry_1.c dhry_2.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
queens.elf: queens.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -DUNIX_Old -DHZ=1000 queens.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
stanford.elf: stanford.c libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ -DHZ=1000 stanford.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
paranoia.elf: paranoia.c libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ -DNOSIGNAL -DBATCHMODE paranoia.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
rmd160_test.elf: rmd160_test.c rmd160.c rmd160.h libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ rmd160_test.c rmd160.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
hashtest.elf: hashtest.c rmd160.c rmd160.h libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ hashtest.c rmd160.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
Bessel.elf: Bessel.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ Bessel.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
whet.elf: whet.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ whet.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
phrasen.elf: phrasen.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ phrasen.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
dttl.elf: dttl.c random.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ dttl.c random.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
richards_benchmark.elf: richards_benchmark.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ richards_benchmark.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
test_exception.elf: test_exception.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -O1 test_exception.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
life.elf: life.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -g life.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
r3.elf: r3.c libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ -DJMIPS_VGA -O2 r3.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
gunzip.elf: gunzip.c inflate.c crc32.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -o $@ gunzip.c inflate.c crc32.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
basic_math.elf: basicmath_small.c rad2deg.c cubic.c isqrt.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -o $@ basicmath_small.c rad2deg.c cubic.c isqrt.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
JMAN_SRC= \
|
||||
jman/bintree.c \
|
||||
jman/camset.c \
|
||||
jman/engine.c \
|
||||
jman/graph_state.c \
|
||||
jman/grid.c \
|
||||
jman/imageio.c \
|
||||
jman/linklist.c \
|
||||
jman/matrix.c \
|
||||
jman/object.c \
|
||||
jman/render.c \
|
||||
jman/ri.c \
|
||||
jman/ribgen.c \
|
||||
jman/stack.c \
|
||||
jman/vars.c
|
||||
|
||||
jman_patches.elf: $(JMAN_SRC) jman/main_patches.c libsys.a
|
||||
$(CC) $(CFLAGS) -I../ -o $@ -o $@ jman/main_patches.c $(JMAN_SRC) $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
jman_patchmeshes.elf: $(JMAN_SRC) jman/main_patchmeshes.c jman/patches2.c libsys.a
|
||||
$(CC) $(CFLAGS) -I../ -o $@ -o $@ jman/main_patchmeshes.c jman/patches2.c $(JMAN_SRC) $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
jman_polys.elf: $(JMAN_SRC) jman/main_polypin.c jman/polys.c libsys.a
|
||||
$(CC) $(CFLAGS) -I../ -o $@ -o $@ jman/main_polypin.c jman/polys.c $(JMAN_SRC) $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
serdump.elf: serdump.c libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ -O2 serdump.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
pppi.elf: pppissue/test1.c pppissue/utils.c pppissue/pppd.h libsys.a
|
||||
$(CC) $(CFLAGS) -O2 -o $@ -O2 pppissue/test1.c pppissue/utils.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
lwl.elf: lwl.c libsys.a
|
||||
$(CC) $(CFLAGS) -O2 -o $@ lwl.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
ucb.elf: ucb.c libsys.a
|
||||
$(CC) $(CFLAGS) -O2 -o $@ ucb.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
test_hpi.elf: hpi.c test_hpi.c cfiflash.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ -g hpi.c test_hpi.c cfiflash.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
test_vga.elf: test_vga.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ test_vga.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
barcode.elf: barcode.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ barcode.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
lua.elf: lua_init.c libsys.a
|
||||
$(CC) $(CFLAGS) -I./lua-5.1.4/etc -I./lua-5.1.4/src -o $@ lua_init.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
mandelbrot.elf: mandelbrot.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ mandelbrot.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
bogomips.elf: bogomips.c delay_mips.c libsys.a
|
||||
$(CC) $(CFLAGS) -DHZ=1000 -o $@ bogomips.c delay_mips.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
test_asm.elf: test_asm.S libsys.a
|
||||
$(CC) $(CFLAGS) -DHZ=1000 -o $@ test_asm.S $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
test_ac97.elf: test_ac97.c libsys.a
|
||||
$(CC) $(CFLAGS) -o $@ test_ac97.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
test_dcache.elf: test_dcache.c libsys.a
|
||||
$(CC) $(CFLAGS) -O0 -o $@ test_dcache.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
aes256_1.elf: aes256_1.c aes256.c aes256.h libsys.a
|
||||
$(CC) $(CFLAGS) -O3 -o $@ aes256_1.c aes256.c $(LIBS) >$@.map
|
||||
$(OBJDUMP) -d $@ > $@.dis
|
||||
$(OBJCOPY) $@ -O binary $@.bin
|
||||
$(OBJCOPY) -O srec $@ $@.srec
|
||||
$(FLASHGEN) $@.bin $(ENDIAN_FLAGS)
|
||||
cat $@.srec | packhex > $@.pack
|
||||
|
||||
clean:
|
||||
rm -rf *.a *.o *.bin *.map *.dis *.srec *.pack *.elf $(PROG) > /dev/null
|
||||
@@ -1,359 +0,0 @@
|
||||
/*
|
||||
* Byte-oriented AES-256 implementation.
|
||||
* All lookup tables replaced with 'on the fly' calculations.
|
||||
*
|
||||
* Copyright (c) 2007-2009 Ilya O. Levin, http://www.literatecode.com
|
||||
* Other contributors: Hal Finney
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#include "aes256.h"
|
||||
|
||||
#define F(x) (((x)<<1) ^ ((((x)>>7) & 1) * 0x1b))
|
||||
#define FD(x) (((x) >> 1) ^ (((x) & 1) ? 0x8d : 0))
|
||||
|
||||
#define BACK_TO_TABLES
|
||||
#ifdef BACK_TO_TABLES
|
||||
|
||||
const uint8_t sbox[256] = {
|
||||
0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5,
|
||||
0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76,
|
||||
0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0,
|
||||
0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0,
|
||||
0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc,
|
||||
0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15,
|
||||
0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a,
|
||||
0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75,
|
||||
0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0,
|
||||
0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84,
|
||||
0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b,
|
||||
0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf,
|
||||
0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85,
|
||||
0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8,
|
||||
0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5,
|
||||
0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2,
|
||||
0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17,
|
||||
0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73,
|
||||
0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88,
|
||||
0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb,
|
||||
0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c,
|
||||
0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79,
|
||||
0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9,
|
||||
0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 0x08,
|
||||
0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6,
|
||||
0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a,
|
||||
0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e,
|
||||
0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e,
|
||||
0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94,
|
||||
0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf,
|
||||
0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68,
|
||||
0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16
|
||||
};
|
||||
const uint8_t sboxinv[256] = {
|
||||
0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38,
|
||||
0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb,
|
||||
0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87,
|
||||
0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb,
|
||||
0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d,
|
||||
0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e,
|
||||
0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2,
|
||||
0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25,
|
||||
0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16,
|
||||
0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92,
|
||||
0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda,
|
||||
0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84,
|
||||
0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a,
|
||||
0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06,
|
||||
0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02,
|
||||
0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b,
|
||||
0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea,
|
||||
0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73,
|
||||
0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85,
|
||||
0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e,
|
||||
0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89,
|
||||
0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b,
|
||||
0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20,
|
||||
0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4,
|
||||
0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31,
|
||||
0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f,
|
||||
0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d,
|
||||
0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef,
|
||||
0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0,
|
||||
0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61,
|
||||
0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26,
|
||||
0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d
|
||||
};
|
||||
|
||||
#define rj_sbox(x) sbox[(x)]
|
||||
#define rj_sbox_inv(x) sboxinv[(x)]
|
||||
|
||||
#else /* tableless subroutines */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
uint8_t gf_alog(uint8_t x) // calculate anti-logarithm gen 3
|
||||
{
|
||||
uint8_t atb = 1, z;
|
||||
|
||||
while (x--) {z = atb; atb <<= 1; if (z & 0x80) atb^= 0x1b; atb ^= z;}
|
||||
|
||||
return atb;
|
||||
} /* gf_alog */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
uint8_t gf_log(uint8_t x) // calculate logarithm gen 3
|
||||
{
|
||||
uint8_t atb = 1, i = 0, z;
|
||||
|
||||
do {
|
||||
if (atb == x) break;
|
||||
z = atb; atb <<= 1; if (z & 0x80) atb^= 0x1b; atb ^= z;
|
||||
} while (++i > 0);
|
||||
|
||||
return i;
|
||||
} /* gf_log */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
uint8_t gf_mulinv(uint8_t x) // calculate multiplicative inverse
|
||||
{
|
||||
return (x) ? gf_alog(255 - gf_log(x)) : 0;
|
||||
} /* gf_mulinv */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
uint8_t rj_sbox(uint8_t x)
|
||||
{
|
||||
uint8_t y, sb;
|
||||
|
||||
sb = y = gf_mulinv(x);
|
||||
y = (y<<1)|(y>>7); sb ^= y; y = (y<<1)|(y>>7); sb ^= y;
|
||||
y = (y<<1)|(y>>7); sb ^= y; y = (y<<1)|(y>>7); sb ^= y;
|
||||
|
||||
return (sb ^ 0x63);
|
||||
} /* rj_sbox */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
uint8_t rj_sbox_inv(uint8_t x)
|
||||
{
|
||||
uint8_t y, sb;
|
||||
|
||||
y = x ^ 0x63;
|
||||
sb = y = (y<<1)|(y>>7);
|
||||
y = (y<<2)|(y>>6); sb ^= y; y = (y<<3)|(y>>5); sb ^= y;
|
||||
|
||||
return gf_mulinv(sb);
|
||||
} /* rj_sbox_inv */
|
||||
|
||||
#endif
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
uint8_t rj_xtime(uint8_t x)
|
||||
{
|
||||
return (x & 0x80) ? ((x << 1) ^ 0x1b) : (x << 1);
|
||||
} /* rj_xtime */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_subBytes(uint8_t *buf)
|
||||
{
|
||||
register uint8_t i = 16;
|
||||
|
||||
while (i--) buf[i] = rj_sbox(buf[i]);
|
||||
} /* aes_subBytes */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_subBytes_inv(uint8_t *buf)
|
||||
{
|
||||
register uint8_t i = 16;
|
||||
|
||||
while (i--) buf[i] = rj_sbox_inv(buf[i]);
|
||||
} /* aes_subBytes_inv */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_addRoundKey(uint8_t *buf, uint8_t *key)
|
||||
{
|
||||
register uint8_t i = 16;
|
||||
|
||||
while (i--) buf[i] ^= key[i];
|
||||
} /* aes_addRoundKey */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_addRoundKey_cpy(uint8_t *buf, uint8_t *key, uint8_t *cpk)
|
||||
{
|
||||
register uint8_t i = 16;
|
||||
|
||||
while (i--) buf[i] ^= (cpk[i] = key[i]), cpk[16+i] = key[16 + i];
|
||||
} /* aes_addRoundKey_cpy */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_shiftRows(uint8_t *buf)
|
||||
{
|
||||
register uint8_t i, j; /* to make it potentially parallelable :) */
|
||||
|
||||
i = buf[1]; buf[1] = buf[5]; buf[5] = buf[9]; buf[9] = buf[13]; buf[13] = i;
|
||||
i = buf[10]; buf[10] = buf[2]; buf[2] = i;
|
||||
j = buf[3]; buf[3] = buf[15]; buf[15] = buf[11]; buf[11] = buf[7]; buf[7] = j;
|
||||
j = buf[14]; buf[14] = buf[6]; buf[6] = j;
|
||||
|
||||
} /* aes_shiftRows */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_shiftRows_inv(uint8_t *buf)
|
||||
{
|
||||
register uint8_t i, j; /* same as above :) */
|
||||
|
||||
i = buf[1]; buf[1] = buf[13]; buf[13] = buf[9]; buf[9] = buf[5]; buf[5] = i;
|
||||
i = buf[2]; buf[2] = buf[10]; buf[10] = i;
|
||||
j = buf[3]; buf[3] = buf[7]; buf[7] = buf[11]; buf[11] = buf[15]; buf[15] = j;
|
||||
j = buf[6]; buf[6] = buf[14]; buf[14] = j;
|
||||
|
||||
} /* aes_shiftRows_inv */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_mixColumns(uint8_t *buf)
|
||||
{
|
||||
register uint8_t i, a, b, c, d, e;
|
||||
|
||||
for (i = 0; i < 16; i += 4)
|
||||
{
|
||||
a = buf[i]; b = buf[i + 1]; c = buf[i + 2]; d = buf[i + 3];
|
||||
e = a ^ b ^ c ^ d;
|
||||
buf[i] ^= e ^ rj_xtime(a^b); buf[i+1] ^= e ^ rj_xtime(b^c);
|
||||
buf[i+2] ^= e ^ rj_xtime(c^d); buf[i+3] ^= e ^ rj_xtime(d^a);
|
||||
}
|
||||
} /* aes_mixColumns */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_mixColumns_inv(uint8_t *buf)
|
||||
{
|
||||
register uint8_t i, a, b, c, d, e, x, y, z;
|
||||
|
||||
for (i = 0; i < 16; i += 4)
|
||||
{
|
||||
a = buf[i]; b = buf[i + 1]; c = buf[i + 2]; d = buf[i + 3];
|
||||
e = a ^ b ^ c ^ d;
|
||||
z = rj_xtime(e);
|
||||
x = e ^ rj_xtime(rj_xtime(z^a^c)); y = e ^ rj_xtime(rj_xtime(z^b^d));
|
||||
buf[i] ^= x ^ rj_xtime(a^b); buf[i+1] ^= y ^ rj_xtime(b^c);
|
||||
buf[i+2] ^= x ^ rj_xtime(c^d); buf[i+3] ^= y ^ rj_xtime(d^a);
|
||||
}
|
||||
} /* aes_mixColumns_inv */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_expandEncKey(uint8_t *k, uint8_t *rc)
|
||||
{
|
||||
register uint8_t i;
|
||||
|
||||
k[0] ^= rj_sbox(k[29]) ^ (*rc);
|
||||
k[1] ^= rj_sbox(k[30]);
|
||||
k[2] ^= rj_sbox(k[31]);
|
||||
k[3] ^= rj_sbox(k[28]);
|
||||
*rc = F( *rc);
|
||||
|
||||
for(i = 4; i < 16; i += 4) k[i] ^= k[i-4], k[i+1] ^= k[i-3],
|
||||
k[i+2] ^= k[i-2], k[i+3] ^= k[i-1];
|
||||
k[16] ^= rj_sbox(k[12]);
|
||||
k[17] ^= rj_sbox(k[13]);
|
||||
k[18] ^= rj_sbox(k[14]);
|
||||
k[19] ^= rj_sbox(k[15]);
|
||||
|
||||
for(i = 20; i < 32; i += 4) k[i] ^= k[i-4], k[i+1] ^= k[i-3],
|
||||
k[i+2] ^= k[i-2], k[i+3] ^= k[i-1];
|
||||
|
||||
} /* aes_expandEncKey */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes_expandDecKey(uint8_t *k, uint8_t *rc)
|
||||
{
|
||||
uint8_t i;
|
||||
|
||||
for(i = 28; i > 16; i -= 4) k[i+0] ^= k[i-4], k[i+1] ^= k[i-3],
|
||||
k[i+2] ^= k[i-2], k[i+3] ^= k[i-1];
|
||||
|
||||
k[16] ^= rj_sbox(k[12]);
|
||||
k[17] ^= rj_sbox(k[13]);
|
||||
k[18] ^= rj_sbox(k[14]);
|
||||
k[19] ^= rj_sbox(k[15]);
|
||||
|
||||
for(i = 12; i > 0; i -= 4) k[i+0] ^= k[i-4], k[i+1] ^= k[i-3],
|
||||
k[i+2] ^= k[i-2], k[i+3] ^= k[i-1];
|
||||
|
||||
*rc = FD(*rc);
|
||||
k[0] ^= rj_sbox(k[29]) ^ (*rc);
|
||||
k[1] ^= rj_sbox(k[30]);
|
||||
k[2] ^= rj_sbox(k[31]);
|
||||
k[3] ^= rj_sbox(k[28]);
|
||||
} /* aes_expandDecKey */
|
||||
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes256_init(aes256_context *ctx, uint8_t *k)
|
||||
{
|
||||
uint8_t rcon = 1;
|
||||
register uint8_t i;
|
||||
|
||||
for (i = 0; i < sizeof(ctx->key); i++) ctx->enckey[i] = ctx->deckey[i] = k[i];
|
||||
for (i = 8;--i;) aes_expandEncKey(ctx->deckey, &rcon);
|
||||
} /* aes256_init */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes256_done(aes256_context *ctx)
|
||||
{
|
||||
register uint8_t i;
|
||||
|
||||
for (i = 0; i < sizeof(ctx->key); i++)
|
||||
ctx->key[i] = ctx->enckey[i] = ctx->deckey[i] = 0;
|
||||
} /* aes256_done */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes256_encrypt_ecb(aes256_context *ctx, uint8_t *buf)
|
||||
{
|
||||
uint8_t i, rcon;
|
||||
|
||||
aes_addRoundKey_cpy(buf, ctx->enckey, ctx->key);
|
||||
for(i = 1, rcon = 1; i < 14; ++i)
|
||||
{
|
||||
aes_subBytes(buf);
|
||||
aes_shiftRows(buf);
|
||||
aes_mixColumns(buf);
|
||||
if( i & 1 ) aes_addRoundKey( buf, &ctx->key[16]);
|
||||
else aes_expandEncKey(ctx->key, &rcon), aes_addRoundKey(buf, ctx->key);
|
||||
}
|
||||
aes_subBytes(buf);
|
||||
aes_shiftRows(buf);
|
||||
aes_expandEncKey(ctx->key, &rcon);
|
||||
aes_addRoundKey(buf, ctx->key);
|
||||
} /* aes256_encrypt */
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
void aes256_decrypt_ecb(aes256_context *ctx, uint8_t *buf)
|
||||
{
|
||||
uint8_t i, rcon;
|
||||
|
||||
aes_addRoundKey_cpy(buf, ctx->deckey, ctx->key);
|
||||
aes_shiftRows_inv(buf);
|
||||
aes_subBytes_inv(buf);
|
||||
|
||||
for (i = 14, rcon = 0x80; --i;)
|
||||
{
|
||||
if( ( i & 1 ) )
|
||||
{
|
||||
aes_expandDecKey(ctx->key, &rcon);
|
||||
aes_addRoundKey(buf, &ctx->key[16]);
|
||||
}
|
||||
else aes_addRoundKey(buf, ctx->key);
|
||||
aes_mixColumns_inv(buf);
|
||||
aes_shiftRows_inv(buf);
|
||||
aes_subBytes_inv(buf);
|
||||
}
|
||||
aes_addRoundKey( buf, ctx->key);
|
||||
} /* aes256_decrypt */
|
||||
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* Byte-oriented AES-256 implementation.
|
||||
* All lookup tables replaced with 'on the fly' calculations.
|
||||
*
|
||||
* Copyright (c) 2007-2009 Ilya O. Levin, http://www.literatecode.com
|
||||
* Other contributors: Hal Finney
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#ifndef uint8_t
|
||||
#define uint8_t unsigned char
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
uint8_t key[32];
|
||||
uint8_t enckey[32];
|
||||
uint8_t deckey[32];
|
||||
} aes256_context;
|
||||
|
||||
|
||||
void aes256_init(aes256_context *, uint8_t * /* key */);
|
||||
void aes256_done(aes256_context *);
|
||||
void aes256_encrypt_ecb(aes256_context *, uint8_t * /* plaintext */);
|
||||
void aes256_decrypt_ecb(aes256_context *, uint8_t * /* cipertext */);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
@@ -1,76 +0,0 @@
|
||||
/*
|
||||
* Byte-oriented AES-256 implementation.
|
||||
* All lookup tables replaced with 'on the fly' calculations.
|
||||
*
|
||||
* Copyright (c) 2007 Ilya O. Levin, http://www.literatecode.com
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
* copyright notice and this permission notice appear in all copies.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
#include "aes256.h"
|
||||
|
||||
#ifndef NUM_BLOCKS
|
||||
#define NUM_BLOCKS 10000
|
||||
#endif
|
||||
|
||||
#define DUMP(s, i, buf, sz) {printf(s); \
|
||||
for (i = 0; i < (sz);i++) \
|
||||
printf("%02x ", buf[i]); \
|
||||
printf("\n");}
|
||||
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
aes256_context ctx;
|
||||
uint8_t key[32];
|
||||
uint8_t buf[16], i;
|
||||
long start, end, j;
|
||||
|
||||
/* put a test vector */
|
||||
for (i = 0; i < sizeof(buf);i++) buf[i] = i * 16 + i;
|
||||
for (i = 0; i < sizeof(key);i++) key[i] = i;
|
||||
|
||||
DUMP("txt: ", i, buf, sizeof(buf));
|
||||
DUMP("key: ", i, key, sizeof(key));
|
||||
printf("---\n");
|
||||
|
||||
aes256_init(&ctx, key);
|
||||
start = clock();
|
||||
for (j=0; j < NUM_BLOCKS; j++)
|
||||
{
|
||||
aes256_encrypt_ecb(&ctx, buf);
|
||||
}
|
||||
end = clock();
|
||||
DUMP("enc: ", i, buf, sizeof(buf));
|
||||
|
||||
printf("Speed %f blocks/s\n", (float)j/((float)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
aes256_init(&ctx, key);
|
||||
start = clock();
|
||||
for (j=0; j < NUM_BLOCKS; j++)
|
||||
{
|
||||
aes256_decrypt_ecb(&ctx, buf);
|
||||
}
|
||||
end = clock();
|
||||
DUMP("dec: ", i, buf, sizeof(buf));
|
||||
|
||||
printf("Speed %f blocks/s\n", (float)j/((float)(end-start)/CLOCKS_PER_SEC));
|
||||
|
||||
aes256_done(&ctx);
|
||||
|
||||
return 0;
|
||||
} /* main */
|
||||
@@ -1,358 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define CPU_FREQ_HZ 100000000
|
||||
#include "libsys.h"
|
||||
#include "irq.h"
|
||||
|
||||
UINT32 buffer[16384];
|
||||
|
||||
#define T_SAMPLE 5000
|
||||
#define TIMEOUT 1000
|
||||
|
||||
typedef struct _bar_t
|
||||
{
|
||||
UINT32 T;
|
||||
UINT32 black;
|
||||
} bar_t;
|
||||
|
||||
enum
|
||||
{
|
||||
state_idle = 0,
|
||||
state_sample,
|
||||
state_finish
|
||||
};
|
||||
|
||||
typedef struct _sbar_cand_t
|
||||
{
|
||||
UINT32 T;
|
||||
UINT32 is_primitive;
|
||||
} bar_cand_t;
|
||||
|
||||
bar_t bars[1024];
|
||||
|
||||
void bsort(float *pData, UINT32 len)
|
||||
{
|
||||
float t;
|
||||
int i, j;
|
||||
|
||||
for(i=len-1; i>=0; i--)
|
||||
{
|
||||
for(j=1; j<len; j++)
|
||||
{
|
||||
if (pData[j-1] > pData[j])
|
||||
{
|
||||
t = pData[j-1];
|
||||
pData[j-1] = pData[j];
|
||||
pData[j] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct _smedian_t
|
||||
{
|
||||
UINT32 N;
|
||||
UINT32 is_dirty;
|
||||
float *pBuf, *pSorted;
|
||||
UINT32 w;
|
||||
float median;
|
||||
} median_t;
|
||||
|
||||
void Median_init(median_t *pObj, UINT32 N, float init_val)
|
||||
{
|
||||
int i;
|
||||
pObj->pBuf = (float*)malloc(N*sizeof(float));
|
||||
pObj->pSorted = (float*)malloc(N*sizeof(float));
|
||||
for (i=0; i < N; i++)
|
||||
pObj->pBuf[0] = init_val;
|
||||
pObj->median = init_val;
|
||||
pObj->is_dirty = 0;
|
||||
pObj->w = 0;
|
||||
pObj->N = N;
|
||||
}
|
||||
|
||||
void Median_free(median_t *pObj)
|
||||
{
|
||||
if (pObj->pBuf)
|
||||
free(pObj->pBuf);
|
||||
|
||||
if (pObj->pSorted)
|
||||
free(pObj->pSorted);
|
||||
|
||||
pObj->pBuf = NULL;
|
||||
pObj->pSorted = NULL;
|
||||
|
||||
}
|
||||
|
||||
void Median_value_add(median_t *pObj, float value)
|
||||
{
|
||||
pObj->is_dirty = 1;
|
||||
pObj->pBuf[pObj->w++] = value;
|
||||
|
||||
if (pObj->w == pObj->N)
|
||||
pObj->w = 0;
|
||||
|
||||
}
|
||||
|
||||
float Median_get(median_t *pObj)
|
||||
{
|
||||
if (!pObj->is_dirty)
|
||||
return pObj->median;
|
||||
|
||||
memcpy(pObj->pSorted, pObj->pBuf, pObj->N*sizeof(float));
|
||||
|
||||
bsort(pObj->pSorted, pObj->N);
|
||||
|
||||
if (pObj->N&1)
|
||||
{
|
||||
pObj->median = pObj->pSorted[(pObj->N-1)/2];
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->median = 0.5f*(pObj->pSorted[pObj->N/2] + pObj->pSorted[pObj->N/2+1]);
|
||||
}
|
||||
|
||||
pObj->is_dirty = 0;
|
||||
|
||||
return pObj->median;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
UINT32 detect_module(UINT32 T, UINT32 T0)
|
||||
{
|
||||
UINT32 m, best_M;
|
||||
float err, kc, best_err;
|
||||
|
||||
best_err = 4.f;
|
||||
best_M = 0;
|
||||
|
||||
for (m=1; m < 5; m++)
|
||||
{
|
||||
kc = (float)T/(m*T0);
|
||||
err = fabs(kc - 1);
|
||||
|
||||
if (err < best_err)
|
||||
{
|
||||
best_M = m;
|
||||
best_err = err;
|
||||
}
|
||||
}
|
||||
|
||||
return best_M;
|
||||
}
|
||||
|
||||
void handler7(void)
|
||||
{
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL;
|
||||
UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT;
|
||||
UINT32 volatile *pPS20_stat = (UINT32*)SYS_PS2_0_STAT;
|
||||
UINT32 volatile *pPS21_stat = (UINT32*)SYS_PS2_1_STAT;
|
||||
static UINT32 state, bar_count;
|
||||
static UINT32 timeout_count, timeout_reload;
|
||||
static UINT32 white, pin_last, skip, start;
|
||||
static UINT32 module_cnt_w, module_cnt_b, Tmod0_w, Tmod0_b, M, T0;
|
||||
float ratio, error, kc;
|
||||
UINT32 i;
|
||||
static median_t med_b, med_w;
|
||||
static bar_cand_t bc_b, bc_w;
|
||||
static median_t speed_b, speed_w;
|
||||
|
||||
if (*pTim_stat & 1)
|
||||
{
|
||||
*pTim_stat = 1;
|
||||
white = ((*pPS20_stat & SYS_PS2_BIT_PIN_DATA) == 0);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case state_idle:
|
||||
timeout_reload = TIMEOUT;
|
||||
if (white != pin_last)
|
||||
{
|
||||
if (white)
|
||||
break;
|
||||
|
||||
state = state_sample;
|
||||
module_cnt_b = 0;
|
||||
module_cnt_w = 0;
|
||||
Tmod0_w = 0xFFFFFFFF;
|
||||
Tmod0_b = 0xFFFFFFFF;
|
||||
bar_count = 0;
|
||||
Median_init(&med_b, 3, 0);
|
||||
Median_init(&med_w, 3, 0);
|
||||
Median_init(&speed_b, 3, 1);
|
||||
Median_init(&speed_w, 3, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case state_sample:
|
||||
if (!timeout_count)
|
||||
{
|
||||
state = state_finish;
|
||||
break;
|
||||
}
|
||||
|
||||
if (white)
|
||||
{
|
||||
module_cnt_w++;
|
||||
}
|
||||
else
|
||||
{
|
||||
module_cnt_b++;
|
||||
}
|
||||
if (white != pin_last)
|
||||
{
|
||||
if (pin_last)
|
||||
{
|
||||
if (bar_count < 10)
|
||||
{
|
||||
if (1.5*module_cnt_w < Tmod0_w)
|
||||
{
|
||||
Tmod0_w = module_cnt_w;
|
||||
}
|
||||
}
|
||||
Median_value_add(&med_w, Tmod0_w);
|
||||
|
||||
timeout_reload = 10*Tmod0_w;
|
||||
bars[bar_count].T = module_cnt_w;
|
||||
bars[bar_count].black = 0;
|
||||
module_cnt_w = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bar_count < 10)
|
||||
{
|
||||
if (1.5*module_cnt_b < Tmod0_b)
|
||||
{
|
||||
Tmod0_b = module_cnt_b;
|
||||
}
|
||||
}
|
||||
Median_value_add(&med_b, Tmod0_b);
|
||||
|
||||
timeout_reload = 10*Tmod0_b;
|
||||
bars[bar_count].T = module_cnt_b;
|
||||
bars[bar_count].black = 1;
|
||||
module_cnt_b = 0;
|
||||
}
|
||||
bar_count++;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case state_finish:
|
||||
printf("------------------------------------------------\n");
|
||||
printf(" Black White \n");
|
||||
skip = 0;
|
||||
start = 1;
|
||||
Tmod0_w = Median_get(&med_w);
|
||||
Tmod0_b = Median_get(&med_b);
|
||||
for (i=0; i < bar_count; i++)
|
||||
{
|
||||
if (bars[i].black)
|
||||
{
|
||||
T0 = Median_get(&med_b);
|
||||
ratio = (float)bars[i].T/T0;
|
||||
if (start)
|
||||
{
|
||||
if (ratio > 4)
|
||||
{
|
||||
skip = 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
start = 0;
|
||||
skip = 0;
|
||||
M = detect_module(bars[i].T, T0);
|
||||
kc = (float)bars[i].T/(M*T0);
|
||||
error = kc - 1;
|
||||
|
||||
// printf("M=%d, R=%2.2f, E=%+2.2f [%04d]", M, ratio, error, T0);
|
||||
// if (M == 1)
|
||||
Median_value_add(&med_b, (UINT32)(T0*kc));
|
||||
Median_value_add(&speed_b, (float)bars[i].T/(M*Tmod0_b));
|
||||
|
||||
printf("%06d %2.6f ", bars[i].T, Median_get(&speed_b));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (skip)
|
||||
continue;
|
||||
|
||||
T0 = Median_get(&med_w);
|
||||
ratio = (float)bars[i].T/T0;
|
||||
if (ratio > 9)
|
||||
{
|
||||
start = 1;
|
||||
// printf("\n");
|
||||
// printf("------------------------------------------------\n");
|
||||
// printf(" Black White \n");
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
M = detect_module(bars[i].T, T0);
|
||||
kc = (float)bars[i].T/(M*T0);
|
||||
error = kc - 1;
|
||||
|
||||
// printf(" M=%d, R=%2.2f, E=%+2.2f [%04d]", M, ratio, error, T0);
|
||||
// if (M == 1)
|
||||
Median_value_add(&med_w, (UINT32)(T0*kc));
|
||||
Median_value_add(&speed_w, (float)bars[i].T/(M*Tmod0_w));
|
||||
|
||||
printf("%06d %2.6f ", bars[i].T, Median_get(&speed_w));
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
Median_free(&med_b);
|
||||
Median_free(&med_w);
|
||||
Median_free(&speed_b);
|
||||
Median_free(&speed_w);
|
||||
if (bar_count)
|
||||
printf("\n");
|
||||
|
||||
state = state_idle;
|
||||
break;
|
||||
|
||||
}
|
||||
if (white != pin_last)
|
||||
timeout_count = timeout_reload;
|
||||
|
||||
pin_last = white;
|
||||
if (timeout_count)
|
||||
timeout_count--;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
int i;
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL;
|
||||
UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT;
|
||||
UINT32 volatile *pTim0_cnt = (UINT32*)SYS_ITIM0_CNT;
|
||||
UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP;
|
||||
|
||||
*pTim0_cnt = 0;
|
||||
*pTim0_cmp = (UINT32)T_SAMPLE;
|
||||
*pTim_stat = 1;
|
||||
*pTim_ctrl = 3;
|
||||
|
||||
interrupt_register(7, (void*)handler7);
|
||||
|
||||
printf("Jenners BarCoder\n");
|
||||
|
||||
interrupt_enable(7);
|
||||
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1,322 +0,0 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <math.h>
|
||||
#include <time.h>
|
||||
#include <sys/times.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#define CPU_FREQ_HZ 100000000
|
||||
#include "libsys.h"
|
||||
#include "irq.h"
|
||||
|
||||
UINT32 buffer[16384];
|
||||
|
||||
#define T_SAMPLE 5000
|
||||
#define TIMEOUT 1000
|
||||
|
||||
typedef struct _bar_t
|
||||
{
|
||||
UINT32 T;
|
||||
UINT32 black;
|
||||
} bar_t;
|
||||
|
||||
enum
|
||||
{
|
||||
state_idle = 0,
|
||||
state_sample,
|
||||
state_finish
|
||||
};
|
||||
|
||||
bar_t bars[1024];
|
||||
|
||||
void bsort(float *pData, UINT32 len)
|
||||
{
|
||||
float t;
|
||||
int i, j;
|
||||
|
||||
for(i=len-1; i>=0; i--)
|
||||
{
|
||||
for(j=1; j<len; j++)
|
||||
{
|
||||
if (pData[j-1] > pData[j])
|
||||
{
|
||||
t = pData[j-1];
|
||||
pData[j-1] = pData[j];
|
||||
pData[j] = t;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
typedef struct _smedian_t
|
||||
{
|
||||
UINT32 N;
|
||||
UINT32 is_dirty;
|
||||
float *pBuf, *pSorted;
|
||||
UINT32 w;
|
||||
float median;
|
||||
} median_t;
|
||||
|
||||
void Median_init(median_t *pObj, UINT32 N, float init_val)
|
||||
{
|
||||
int i;
|
||||
pObj->pBuf = (float*)malloc(N*sizeof(float));
|
||||
pObj->pSorted = (float*)malloc(N*sizeof(float));
|
||||
for (i=0; i < N; i++)
|
||||
pObj->pBuf[0] = init_val;
|
||||
pObj->median = init_val;
|
||||
pObj->is_dirty = 0;
|
||||
pObj->w = 0;
|
||||
pObj->N = N;
|
||||
}
|
||||
|
||||
void Median_free(median_t *pObj)
|
||||
{
|
||||
if (pObj->pBuf)
|
||||
free(pObj->pBuf);
|
||||
|
||||
if (pObj->pSorted)
|
||||
free(pObj->pSorted);
|
||||
|
||||
pObj->pBuf = NULL;
|
||||
pObj->pSorted = NULL;
|
||||
|
||||
}
|
||||
|
||||
void Median_value_add(median_t *pObj, float value)
|
||||
{
|
||||
pObj->is_dirty = 1;
|
||||
pObj->pBuf[pObj->w++] = value;
|
||||
|
||||
if (pObj->w == pObj->N)
|
||||
pObj->w = 0;
|
||||
|
||||
}
|
||||
|
||||
float Median_get(median_t *pObj)
|
||||
{
|
||||
if (!pObj->is_dirty)
|
||||
return pObj->median;
|
||||
|
||||
memcpy(pObj->pSorted, pObj->pBuf, pObj->N*sizeof(float));
|
||||
|
||||
bsort(pObj->pSorted, pObj->N);
|
||||
|
||||
if (pObj->N&1)
|
||||
{
|
||||
pObj->median = pObj->pSorted[(pObj->N-1)/2];
|
||||
}
|
||||
else
|
||||
{
|
||||
pObj->median = 0.5f*(pObj->pSorted[pObj->N/2] + pObj->pSorted[pObj->N/2+1]);
|
||||
}
|
||||
|
||||
pObj->is_dirty = 0;
|
||||
|
||||
return pObj->median;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------
|
||||
UINT32 detect_module(UINT32 T, UINT32 *pBC)
|
||||
{
|
||||
UINT32 m, best_M;
|
||||
float err, kc, best_err;
|
||||
|
||||
best_err = 4.f;
|
||||
best_M = 0;
|
||||
|
||||
for (m=0; m < 4; m++)
|
||||
{
|
||||
kc = (float)T/pBC[m];
|
||||
err = fabs(kc - 1);
|
||||
|
||||
if (err < best_err)
|
||||
{
|
||||
best_M = m+1;
|
||||
best_err = err;
|
||||
}
|
||||
}
|
||||
|
||||
return best_M;
|
||||
}
|
||||
|
||||
void handler7(void)
|
||||
{
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL;
|
||||
UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT;
|
||||
UINT32 volatile *pPS20_stat = (UINT32*)SYS_PS2_0_STAT;
|
||||
UINT32 volatile *pPS21_stat = (UINT32*)SYS_PS2_1_STAT;
|
||||
static UINT32 state, bar_count;
|
||||
static UINT32 timeout_count, timeout_reload;
|
||||
static UINT32 white, pin_last, skip, start;
|
||||
static UINT32 module_cnt_w, module_cnt_b, Tmod0_w, Tmod0_b, M, T0;
|
||||
float ratio, error, kc;
|
||||
UINT32 i, j;
|
||||
static median_t med_b, med_w;
|
||||
static UINT32 bc_b[4], bc_w[4];
|
||||
|
||||
if (*pTim_stat & 1)
|
||||
{
|
||||
*pTim_stat = 1;
|
||||
white = ((*pPS20_stat & SYS_PS2_BIT_PIN_DATA) == 0);
|
||||
|
||||
switch (state)
|
||||
{
|
||||
case state_idle:
|
||||
timeout_reload = TIMEOUT;
|
||||
if (white != pin_last)
|
||||
{
|
||||
if (white)
|
||||
break;
|
||||
|
||||
state = state_sample;
|
||||
module_cnt_b = 0;
|
||||
module_cnt_w = 0;
|
||||
Tmod0_w = 0xFFFFFFFF;
|
||||
Tmod0_b = 0xFFFFFFFF;
|
||||
bar_count = 0;
|
||||
Median_init(&med_b, 3, 1);
|
||||
Median_init(&med_w, 3, 1);
|
||||
}
|
||||
break;
|
||||
|
||||
case state_sample:
|
||||
if (!timeout_count)
|
||||
{
|
||||
state = state_finish;
|
||||
break;
|
||||
}
|
||||
|
||||
if (white)
|
||||
{
|
||||
module_cnt_w++;
|
||||
}
|
||||
else
|
||||
{
|
||||
module_cnt_b++;
|
||||
}
|
||||
if (white != pin_last)
|
||||
{
|
||||
if (pin_last)
|
||||
{
|
||||
if (bar_count < 10)
|
||||
{
|
||||
if (1.5*module_cnt_w < Tmod0_w)
|
||||
{
|
||||
Tmod0_w = module_cnt_w;
|
||||
}
|
||||
}
|
||||
timeout_reload = 10*Tmod0_w;
|
||||
bars[bar_count].T = module_cnt_w;
|
||||
bars[bar_count].black = 0;
|
||||
module_cnt_w = 0;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (bar_count < 10)
|
||||
{
|
||||
if (1.5*module_cnt_b < Tmod0_b)
|
||||
{
|
||||
Tmod0_b = module_cnt_b;
|
||||
}
|
||||
}
|
||||
timeout_reload = 10*Tmod0_b;
|
||||
bars[bar_count].T = module_cnt_b;
|
||||
bars[bar_count].black = 1;
|
||||
module_cnt_b = 0;
|
||||
}
|
||||
bar_count++;
|
||||
|
||||
}
|
||||
break;
|
||||
|
||||
case state_finish:
|
||||
printf("------------------------------------------------\n");
|
||||
printf(" Black White \n");
|
||||
skip = 0;
|
||||
start = 1;
|
||||
for (i=0; i < 4; i++)
|
||||
{
|
||||
bc_b[i] = (i+1)*Tmod0_b;
|
||||
bc_w[i] = (i+1)*Tmod0_w;
|
||||
}
|
||||
for (i=0; i < bar_count; i++)
|
||||
{
|
||||
if (bars[i].black)
|
||||
{
|
||||
M = detect_module(bars[i].T, bc_b);
|
||||
if (M)
|
||||
{
|
||||
kc = (float)bars[i].T/bc_b[M-1];
|
||||
error = kc - 1;
|
||||
Median_value_add(&med_b, kc);
|
||||
printf("M=%d, R=%2.2f, E=%+2.2f [%04d]", M, kc, error, bc_b[M-1]);
|
||||
kc = Median_get(&med_b);
|
||||
bc_b[M-1] = (UINT32)(kc*bc_b[M-1]);
|
||||
}
|
||||
// printf("%d", M);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
M = detect_module(bars[i].T, bc_w);
|
||||
if (M)
|
||||
{
|
||||
kc = (float)bars[i].T/bc_w[M-1];
|
||||
error = kc - 1;
|
||||
Median_value_add(&med_w, kc);
|
||||
printf(" M=%d, R=%2.2f, E=%+2.2f [%04d]", M, kc, error, bc_w[M-1]);
|
||||
kc = Median_get(&med_w);
|
||||
bc_w[M-1] = (UINT32)(kc*bc_w[M-1]);
|
||||
|
||||
}
|
||||
// printf("%d", M);
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
Median_free(&med_b);
|
||||
Median_free(&med_w);
|
||||
if (bar_count)
|
||||
printf("\n");
|
||||
|
||||
state = state_idle;
|
||||
break;
|
||||
|
||||
}
|
||||
if (white != pin_last)
|
||||
timeout_count = timeout_reload;
|
||||
|
||||
pin_last = white;
|
||||
if (timeout_count)
|
||||
timeout_count--;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
int i;
|
||||
UINT32 volatile *pTim_ctrl = (UINT32*)SYS_ITIM_CTRL;
|
||||
UINT32 volatile *pTim_stat = (UINT32*)SYS_ITIM_STAT;
|
||||
UINT32 volatile *pTim0_cnt = (UINT32*)SYS_ITIM0_CNT;
|
||||
UINT32 volatile *pTim0_cmp = (UINT32*)SYS_ITIM0_CMP;
|
||||
|
||||
*pTim0_cnt = 0;
|
||||
*pTim0_cmp = (UINT32)T_SAMPLE;
|
||||
*pTim_stat = 1;
|
||||
*pTim_ctrl = 3;
|
||||
|
||||
interrupt_register(7, (void*)handler7);
|
||||
|
||||
printf("Jenners BarCoder\n");
|
||||
|
||||
interrupt_enable(7);
|
||||
|
||||
while(1)
|
||||
{
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user