Skip to content

Commit 29f12c1

Browse files
authored
Remove unrelated code; fix minor typo (freechipsproject#158)
1 parent 4c5cdf1 commit 29f12c1

File tree

1 file changed

+2
-72
lines changed

1 file changed

+2
-72
lines changed

3.5_object_oriented_programming.ipynb

Lines changed: 2 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -353,76 +353,6 @@
353353
"We'll create a hardware Gray encoder/decoder. The encode or decode operation choice is hardware programmable."
354354
]
355355
},
356-
{
357-
"cell_type": "code",
358-
"execution_count": null,
359-
"metadata": {},
360-
"outputs": [],
361-
"source": [
362-
"class NoGlitchCounterIO(bitwidth: Int) extends Bundle {\n",
363-
" val en = Input(Bool())\n",
364-
" val out = Output(UInt(bitwidth.W))\n",
365-
"}\n",
366-
"\n",
367-
"abstract class NoGlitchCounter(val maxCount: Int) extends Module {\n",
368-
" val bitwidth: Int\n",
369-
" val io = IO(new NoGlitchCounterIO(bitwidth))\n",
370-
"}\n",
371-
"\n",
372-
"abstract class AsyncFIFO(depth: Int) extends Module {\n",
373-
" val io = IO(new Bundle{\n",
374-
" // write inputs\n",
375-
" val write_clock = Input(Clock())\n",
376-
" val write_enable = Input(Bool())\n",
377-
" val write_data = Input(UInt(32.W))\n",
378-
"\n",
379-
" // read inputs/outputs\n",
380-
" val read_clock = Input(Clock())\n",
381-
" val read_enable = Input(Bool())\n",
382-
" val read_data = Output(UInt(32.W))\n",
383-
"\n",
384-
" // FIFO status\n",
385-
" val full = Output(Bool())\n",
386-
" val empty = Output(Bool())\n",
387-
" })\n",
388-
" \n",
389-
" def makeCounter(maxCount: Int): NoGlitchCounter\n",
390-
"\n",
391-
" // add extra bit to counter to check for fully/empty status\n",
392-
" assert(isPow2(depth), \"AsyncFIFO needs a power-of-two depth!\")\n",
393-
" val write_counter = withClock(io.write_clock) {\n",
394-
" val count = makeCounter(depth * 2)\n",
395-
" count.io.en := io.write_enable && !io.full\n",
396-
" count.io.out\n",
397-
" }\n",
398-
" val read_counter = withClock(io.read_clock) {\n",
399-
" val count = makeCounter(depth * 2)\n",
400-
" count.io.en := io.read_enable && !io.empty\n",
401-
" count.io.out\n",
402-
" }\n",
403-
"\n",
404-
" // synchronize\n",
405-
" val sync = withClock(io.read_clock) { ShiftRegister(write_counter, 2) }\n",
406-
"\n",
407-
" // status logic goes here\n",
408-
"}"
409-
]
410-
},
411-
{
412-
"cell_type": "code",
413-
"execution_count": null,
414-
"metadata": {},
415-
"outputs": [],
416-
"source": [
417-
"class GrayCounter(val bitwidth: Int) extends NoGlitchCounter(bitwidth) {\n",
418-
" // todo\n",
419-
"}\n",
420-
"\n",
421-
"class RingCounter(maxCount: Int) extends NoGlitchCounter(maxCount) {\n",
422-
" // todo\n",
423-
"}"
424-
]
425-
},
426356
{
427357
"cell_type": "code",
428358
"execution_count": null,
@@ -494,7 +424,7 @@
494424
"cell_type": "markdown",
495425
"metadata": {},
496426
"source": [
497-
"Gray codes are often used in asynchronous interfaces. Usually Gray counters are used rather than fully-featured encoders/decoders, but we'll the above module to simplify things. Below is an example AsyncFIFO, built using the above Gray coder. The control logic and tester is left as an exercise for later on. For now, look at how the Gray coder is instantiated multiple times and connected."
427+
"Gray codes are often used in asynchronous interfaces. Usually Gray counters are used rather than fully-featured encoders/decoders, but we'll use the above module to simplify things. Below is an example AsyncFIFO, built using the above Gray coder. The control logic and tester is left as an exercise for later on. For now, look at how the Gray coder is instantiated multiple times and connected."
498428
]
499429
},
500430
{
@@ -571,4 +501,4 @@
571501
},
572502
"nbformat": 4,
573503
"nbformat_minor": 1
574-
}
504+
}

0 commit comments

Comments
 (0)