Case Study: RCA 1802 Processor
Demonstrating complex behavioral modeling in Simic.
Overview
The RCA 1802 (COSMAC) is a classic 8-bit microprocessor. Modeling its internal logic at the gate level would be prohibitively complex. Instead, we provide a Behavioral Model that implements its instruction set.
SNL Definition
To use the model, you declare it as a behavioral type in your .net file:
type=cdp1802 p1 p2 p3 i=mclk,clear,wait,pause,irq,ef1,ef2,ef3,ef4,d[0:7] $
o=ma[0:7],q,sc0,sc1,tpa,tpb,mrd,n0,n1,n2,ceo,d[0:7] $
composition=behavioral
d[0:7]. These must be declared
with the %declare statement to define their print radix and width.
Behavioral Implementation
The 1802 model is implemented in a high-level language file (e.g., cdp1802.p).
It maintains internal states such as:
- PC: Program Counter.
- R[0:F]: 16-bit register file.
- D: 8-bit ALU accumulator.
Whenever the mclk (clock input) transitions, Simic calls the evaluation
routine to fetch the next instruction from the simulated memory and update the registers.
Why Use Behavioral Modeling?
Speed
Calculates instruction effects in nanoseconds, compared to milliseconds for gate-level logic.
Accuracy
Encapsulates the exact instruction cycle behavior as defined in the datasheet.