Add (heavily work in progress) documentation.

To render correctly, the docs require:
 * pygments/pygments#1441
This commit is contained in:
whitequark 2020-04-27 07:21:31 +00:00
parent 8dacbbb2b2
commit 399b8f9863
21 changed files with 1565 additions and 23 deletions

View file

@ -159,7 +159,7 @@ class ValueTestCase(FHDLTestCase):
def test_bool(self):
with self.assertRaises(TypeError,
msg="Attempted to convert nMigen value to boolean"):
msg="Attempted to convert nMigen value to Python boolean"):
if Const(0):
pass
@ -466,11 +466,11 @@ class OperatorTestCase(FHDLTestCase):
self.assertEqual(v1.shape(), unsigned(11))
def test_shl_wrong(self):
with self.assertRaises(NotImplementedError,
msg="Shift by a signed value is not supported"):
with self.assertRaises(TypeError,
msg="Shift amount must be unsigned"):
1 << Const(0, signed(6))
with self.assertRaises(NotImplementedError,
msg="Shift by a signed value is not supported"):
with self.assertRaises(TypeError,
msg="Shift amount must be unsigned"):
Const(1, unsigned(4)) << -1
def test_shr(self):
@ -479,11 +479,11 @@ class OperatorTestCase(FHDLTestCase):
self.assertEqual(v1.shape(), unsigned(4))
def test_shr_wrong(self):
with self.assertRaises(NotImplementedError,
msg="Shift by a signed value is not supported"):
with self.assertRaises(TypeError,
msg="Shift amount must be unsigned"):
1 << Const(0, signed(6))
with self.assertRaises(NotImplementedError,
msg="Shift by a signed value is not supported"):
with self.assertRaises(TypeError,
msg="Shift amount must be unsigned"):
Const(1, unsigned(4)) << -1
def test_lt(self):

View file

@ -289,9 +289,9 @@ class DSLTestCase(FHDLTestCase):
m = Module()
with self.assertWarns(SyntaxWarning,
msg="Signed values in If/Elif conditions usually result from inverting Python "
"booleans with ~, which leads to unexpected results: ~True is -2, which is "
"truthful. Replace `~flag` with `not flag`. (If this is a false positive, "
"silence this warning with `m.If(x)` → `m.If(x.bool())`.)"):
"booleans with ~, which leads to unexpected results. Replace `~flag` with "
"`not flag`. (If this is a false positive, silence this warning with "
"`m.If(x)` → `m.If(x.bool())`.)"):
with m.If(~True):
pass
@ -301,9 +301,9 @@ class DSLTestCase(FHDLTestCase):
pass
with self.assertWarns(SyntaxWarning,
msg="Signed values in If/Elif conditions usually result from inverting Python "
"booleans with ~, which leads to unexpected results: ~True is -2, which is "
"truthful. Replace `~flag` with `not flag`. (If this is a false positive, "
"silence this warning with `m.If(x)` → `m.If(x.bool())`.)"):
"booleans with ~, which leads to unexpected results. Replace `~flag` with "
"`not flag`. (If this is a false positive, silence this warning with "
"`m.If(x)` → `m.If(x.bool())`.)"):
with m.Elif(~True):
pass