2022-04-12 22:25:21 +00:00
@name "Jednostavni FRISC"
@info "Ova biblioteka omogućuje kreiranje sustava s procesorom FRISC s pojednostavljenim načinom spajanja bez potrebe da se spajaju pojedine linije sabirnice."
@directory "libraries\frisc\vjezba1"
2022-05-15 23:02:34 +00:00
@header "// Version 0.0.1"
@componentHeader " clock 100MHz;"
2022-04-12 22:25:21 +00:00
@address glavniAS(0,0xFFFFFFFF)
@address pomocniAS(0xFFFF0000,0xFFFFFFFF)
@messages {
2022-06-05 17:02:44 +00:00
ok: "OK";
yes: "Da";
no: "Ne";
cancel: "Odustani";
2022-04-12 22:25:21 +00:00
noneBusLine: "nespojen";
noneValue: "nema vrijednosti";
}
@component FRISC processor {
2022-05-30 23:05:08 +00:00
@instanceName procesor
2022-05-08 12:50:56 +00:00
@tooltip "Procesor FRISC, mora postojati jedan"
2022-04-12 22:25:21 +00:00
@count (1, 1)
@source "FRISC.cdl"
@display {
/*
rectangle {
x:0; y:0;
mainColor: black;
width: 100;
height: 100;
lineThickness: 2;
}
rectangle {
x:2; y:2;
mainColor: blue;
width: 96;
height: 96;
lineThickness: 1;
}
text {
x: 2; y:2;
mainColor: black;
text: black;
}
text {
x: 20; y:20;
text: instanceName;
}*/
rect {
x: 0; y:0; w:100; h:100;
}
2022-06-12 14:02:24 +00:00
text {
x: 0; y: 0; w: 100; h: 100;
text: "FRISC";
}
text {
x: 0; y: 16; w: 100; h: 100;
text: "{instanceName}";
}
2022-04-12 22:25:21 +00:00
}
2022-05-19 22:44:40 +00:00
@pin glavniPin in {
2022-04-12 22:25:21 +00:00
@tooltip "pin za spajanje na glavnu sabirnicu"
2022-05-08 12:50:56 +00:00
@connection required("COMDEL se ne može stvoriti. FRISC nije spojen na sabirnicu")
2022-04-12 22:25:21 +00:00
@display {
pin {
x: 42; y: 100; w: 16; h:16;
2022-05-19 22:44:40 +00:00
type: "in";
orientation: "bottom";
2022-04-12 22:25:21 +00:00
}
}
}
2022-05-25 05:39:45 +00:00
@pin memDirect inOut {
@tooltip "pin za izravno spajanje na RAM"
@connection optional("COMDEL se ne može stvoriti. FRISC nije spojen na sabirnicu")
@display {
pin {
x: 100; y: 42; w: 16; h:16;
type: "in";
orientation: "right";
}
}
2022-06-05 23:10:11 +00:00
@wires{null, null, null, null}
2022-05-25 05:39:45 +00:00
}
2022-04-12 22:25:21 +00:00
}
@component Memorija memory {
2022-05-30 23:05:08 +00:00
@instanceName memorija
2022-04-12 22:25:21 +00:00
@tooltip "Memorijska komponenta, mora postojati barem jedna"
@count (1,1000)
@source "memory.cdl"
2022-05-15 14:13:29 +00:00
@attribute sinkroniziran bool default false {
@popup automatic {
@title "Postavite sinkroniziranost"
@text "Zadajte sinkronizaciju"
}
}
@attribute brzina int default 1 {
@popup automatic {
@title "Postavite brzinu memorije"
@text "Zadajte brzinu memorije"
@enumerated {
"Spora" = 1,
"Srednja" = 5,
"Brza" = 25,
}
}
}
2022-04-12 22:25:21 +00:00
@attribute kapacitet int default 65536 {
@popup automatic {
@title "Kapacitet memorije"
@text "Zadajte kapacitet memorije u bajtovima"
@rule {
if(!divisible(kapacitet,2)) {
error("Kapacitet memorije nije djeljiv s potencijom broja 2")
}
}
@rule {
if(less_then(kapacitet,1024)) {
warning("Kapacitet memorije je premali (minimum je 1024)")
} else if (greater_then(kapacitet, 1048576)) {
error("Kapacitet memorije je {kapacitet} a mora biti manji od 1048576 (1MB)")
} else if (greater_then(kapacitet, 65536)) {
warning("Želite li zaista memoriju veću od 65536 bajtova?")
}
}
}
}
@attribute size int default 8
@attribute pocetnaAdresa int default 0 {
@popup automatic {
@title "Početna adresa memorije"
@text "Zadajte početnu adresu memorije"
@rule {
if(!contains_address(glavniAS, pocetnaAdresa)) {
error("Početna adresa memorije je izvan 32 bitnog adresnog prostora")
}
}
}
}
@rule {
if(!contains(glavniAS, pocetnaAdresa, kapacitet)) {
error("Završna adresa memorije je izvan 32 bitnog adresnog prostora")
}
}
@rule {
if(!unique(glavniAS, pocetnaAdresa, kapacitet)) {
error("Adrese memorije nisu jedinstvene u adresnom prostoru (preklapaju se s nekom drugom komponentom)")
}
}
@rule {
if(!divisible(pocetnaAdresa, kapacitet)) {
error("Početna adresa memorije mora biti višekratnik kapaciteta memorije")
}
}
@display {
/*
rectangle {
x:0; y:0;
width: 100;
height: 50;
mainColor: black;
lineThickness: 2;
}
text {
x:20; y:20;
mainColor: black;
text: "Memorija";
}
*/
rect {
x: 0; y: 0; w: 100; h: 50;
}
}
@pin glavniPin inOut {
@tooltip "pin za spajanje na glavnu sabirnicu"
2022-05-08 12:50:56 +00:00
@connection required("COMDEL se ne može stvoriti. Memorija nije spojena na sabirnicu")
2022-04-12 22:25:21 +00:00
@display {
/*
pin {
x: 100; y: 25;
fillColor: blue;
lineColor: red;
fillColorConnected: white;
lineColorConnected: black;
side: right;
size: 20;
}
*/
pin {
2022-05-19 22:44:40 +00:00
x: 42; y: -16; w: 16; h:16;
type: "out";
orientation: "top";
2022-04-12 22:25:21 +00:00
}
}
}
2022-05-25 05:39:45 +00:00
@pin memDirect inOut {
@tooltip "pin za spajanje na procesor"
@connection optional("COMDEL se ne može stvoriti. Memorija nije spojena na sabirnicu")
@display {
/*
pin {
x: 100; y: 25;
fillColor: blue;
lineColor: red;
fillColorConnected: white;
lineColorConnected: black;
side: right;
size: 20;
}
*/
pin {
x: -16; y: 20; w: 16; h:16;
type: "out";
orientation: "left";
}
}
2022-06-05 23:10:11 +00:00
@wires{null, null, null, null}
2022-05-25 05:39:45 +00:00
}
2022-04-12 22:25:21 +00:00
}
@component DMA {
2022-05-30 23:05:08 +00:00
@instanceName dma
2022-04-12 22:25:21 +00:00
@tooltip "DMA-kontroler"
2022-05-19 22:44:40 +00:00
@count (0,1000)
2022-04-12 22:25:21 +00:00
@source "dma.cdl"
2022-05-15 14:13:29 +00:00
2022-04-12 22:25:21 +00:00
@attribute pocetnaAdresa int default 0 {
@popup automatic {
@title "Početna adresa DMA-kontrolera"
@text "Zadajte početnu adresu DMA-kontrolera"
@rule {
2022-06-05 17:02:44 +00:00
if(!contains_address(glavniAS, pocetnaAdresa)) {
2022-04-12 22:25:21 +00:00
error("Početna adresa memorije je izvan 32 bitnog adresnog prostora")
}
}
@rule {
if(!contains(glavniAS, pocetnaAdresa, 32)) {
error("Završna adresa memorije je izvan 32 bitnog adresnog prostora")
}
}
@rule {
2022-06-05 17:02:44 +00:00
if(!unique(glavniAS, pocetnaAdresa, 32)) {
2022-04-12 22:25:21 +00:00
error("Adrese memorije nisu jedinstvene u adresnom prostoru (preklapaju se s nekom drugom komponentom)")
}
}
}
}
@display {
/*
rectangle {
x:0; y:0;
width: 100;
height: 100;
mainColor: black;
lineThickness: 1;
}
text {
x:20; y:20;
mainColor: black;
text: "DMA";
}*/
rect {
x: 0; y: 0; w: 100; h: 100;
}
}
@pin glavniPin in {
@tooltip "pin za spajanje na glavnu sabirnicu"
2022-05-08 12:50:56 +00:00
@connection required("COMDEL se ne može stvoriti. DMA nije spojena na sabirnicu")
2022-04-12 22:25:21 +00:00
@display {
/*
pin {
x: 100; y: 50;
fillColor: red;
lineColor: black;
fillColorConnected: white;
lineColorConnected: black;
side: left;
size: 20;
}
*/
pin {
2022-06-05 23:10:11 +00:00
x: 100; y: 30; w: 16; h: 16;
2022-06-12 14:02:24 +00:00
orientation: "right";
2022-04-12 22:25:21 +00:00
}
}
}
@pin dodatnaPoveznica in {
@tooltip "pin za spajanje na pomocnu sabirnicu"
2022-05-08 12:50:56 +00:00
@connection optional("COMDEL se ne može stvoriti. DMA nije spojen na nesto!")
2022-04-12 22:25:21 +00:00
@display {
pin {
2022-06-05 23:10:11 +00:00
x: 100; y: 7; w: 16; h: 16;
2022-06-12 14:02:24 +00:00
orientation: "right";
2022-04-12 22:25:21 +00:00
}
}
@wires { 0, 0, null, null}
}
}
@bus glavnaSabirnica regular {
2022-05-30 23:05:08 +00:00
@instanceName glavnaSabirnica
2022-04-12 22:25:21 +00:00
@tooltip "sabirnica za spajanje FRISC a s memorijama i UI/jedinicama"
@count (1,1)
@display {
/*
rectangle {
x:0; y: 0;
height: 20;
width: 50;
orientation: horizontal;
lineColor: black;
}*/
2022-05-26 17:21:53 +00:00
bus {
2022-04-12 22:25:21 +00:00
x:0; y:0;
h: 20; w: 100;
2022-05-26 17:21:53 +00:00
orientation: "horizontal";
resizable: true;
2022-06-12 14:02:24 +00:00
lineColor: #bbbbbb;
fillColor: #bbbbbb;
2022-04-12 22:25:21 +00:00
}
}
@wires {
ADR<32>,
DATA<32>,
READ,
WRITE,
WAIT wired_and,
INT0 wired_and,
INT1 wired_and,
INT2 wired_and,
INT3 wired_and,
SIZE<3>,
2022-05-08 22:51:47 +00:00
IACK hidden,
BREQ hidden,
BACK hidden
2022-04-12 22:25:21 +00:00
}
}
@bus PIOSabirnica automatic {
2022-05-30 23:05:08 +00:00
@instanceName PIOSabirnica
2022-05-19 22:44:40 +00:00
@count (0, 20)
2022-04-12 22:25:21 +00:00
@wires {
PIO_DATA<8>,
READY,
STROBE
}
}
2022-06-05 17:02:44 +00:00
@bus directRam singleAutomatic {
2022-05-30 23:05:08 +00:00
@instanceName directRam
2022-05-25 05:39:45 +00:00
@wires {
INT
}
}
2022-04-12 22:25:21 +00:00
@connection (FRISC.glavniPin, glavnaSabirnica) {
@wires{ADR, DATA, READ, WRITE, SIZE, WAIT, INT0, INT1, INT2, INT3, IACK, 1, null}
}
@connection (Memorija.glavniPin, glavnaSabirnica) {
@wires{ADR, DATA, READ, WRITE, SIZE, WAIT}
}
@connection (DMA.glavniPin, glavnaSabirnica) {
@attribute interupt wire default INT0 {
@popup automatic {
@title "Povezivanje interupt signala"
@text "Odaberite sabirničku liniju na koju želite spojiti priključak INT od skopa DMA"
@enumerated {
"INT0" = INT0,
"INT1" = INT1,
"INT2" = INT2,
"Hardwire 1" = 1,
"None" = null
}
}
}
@wires{ADR, DATA, READ, WRITE, SIZE, WAIT, interupt, BREQ, BACK}
2022-05-08 12:50:56 +00:00
}
2022-06-05 23:10:11 +00:00
@connection (DMA.dodatnaPoveznica, PIOSabirnica, FRISC.glavniPin) {
2022-05-08 12:50:56 +00:00
@wires{PIO_DATA, READY, STROBE}
@wires{PIO_DATA, READY, STROBE}
2022-05-25 05:39:45 +00:00
}
@connection (FRISC.memDirect, directRam, Memorija.memDirect) {
2022-06-05 17:02:44 +00:00
@attribute procConn string default "INT" {
@popup automatic {
@title "Frisc INT"
@text "Processor interupt 1"
}
}
@attribute memConn string default "INT" {
@popup automatic {
@title "Mem INT"
@text "Memory interupt 1"
}
}
@wires{"INT", null, 1, "INT2"}
@wires{"INT", null, 1, "INT2"}
2022-04-12 22:25:21 +00:00
}