Foundation – Sequential + Basic C++
Linux, GVim, Shell, Digital Design, Basic C++
What you will learn and practise
Complete the stages in order and retain the requested evidence.
Latch/flip-flop/register/counter
Clock/reset; Moore/Mealy FSM
C++ variables, loops, functions, arrays, strings
References, pointers, classes, constructors, inheritance
1. DFF timing
2. Register/shift register
3. Counter
4. Moore vs Mealy sequence detector
5. C++ calculator
6. Array min/max
7. String handling
8. Function/reference/pointer exercises
9. Transaction class
10. Constructor
11. Base/derived transaction classes
Week-1 practical: Linux + GVim + C++
20-minute digital design quiz
Foundation assessment + C++ transaction model
Connect sequential-logic reasoning with Basic C++ programming and build the Week 1 transaction model.
- Use the Digital Design course for sequential-logic reference material.
- Create C++ work under project_workspace/cpp.
- Compile and run the transaction example from the command line.
- Analyse DFF timing and reset behaviour.
- Work through register, shift-register and counter behaviour.
- Compare Moore and Mealy sequence-detector structure.
- Write a small C++ calculator and array min/max exercise.
- Practise strings, functions, references and pointers.
- Implement a transaction class with fields, constructor and print/display behaviour.
- Create a base/derived transaction example to demonstrate inheritance.
Complete the Week 1 Linux + GVim + C++ practical and the 20-minute digital-design quiz before starting the Foundation Assessment.
- sequential-logic notes/quiz
- C++ source
- transaction class output
- base/derived class example
- C++ code compiles and runs
- Transaction object output is understandable
- Learner can explain basic sequential behaviour and the C++ class structure
Minimal C++ transaction model for SystemVerilog preparation
Read the example, predict the output, compile it, then compare the actual result.
#include <iostream>
#include <string>
class Transaction {
public:
unsigned address;
unsigned data;
bool write;
Transaction(unsigned addr, unsigned value, bool is_write)
: address(addr), data(value), write(is_write) {}
virtual void print() const {
std::cout << (write ? "WRITE" : "READ")
<< " address=0x" << std::hex << address
<< " data=0x" << data << std::dec << '\n';
}
virtual ~Transaction() = default;
};
class ErrorTransaction : public Transaction {
public:
using Transaction::Transaction;
void print() const override {
std::cout << "ERROR: ";
Transaction::print();
}
};
int main() {
Transaction normal(0x10, 0xA5, true);
ErrorTransaction error(0x20, 0x00, false);
normal.print();
error.print();
return 0;
}g++ -std=c++17 -Wall -Wextra transaction.cpp -o transaction./transaction
WRITE address=0x10 data=0xa5
ERROR: READ address=0x20 data=0x0Foundation Assessment
2.0 h · 100 marks · Scripts + C++ transaction class
Review Week 1 assignment →