Skip to content

Commit dd45648

Browse files
committed
2.3.6: minor updates
1 parent 557e996 commit dd45648

File tree

16 files changed

+357
-66
lines changed

16 files changed

+357
-66
lines changed

docs/WS_CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Main improvements:
66
* Added the 'filter-microcode' action in command-line
77
* Initial support for adding a name to the register section
8-
* Minor updates
8+
* Minor updates on devices
99
* Main external dependencies updated:
1010
* timbre.js were replaced by tone.js
1111

repo/assembly/rv32/s6e8.asm

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
2+
#
3+
# WepSIM (https://wepsim.github.io/wepsim/)
4+
#
5+
6+
.kdata
7+
vector: .word rt_i0
8+
.word rt_i1
9+
.word rt_sys
10+
11+
.ktext
12+
sys_prt_str: li zero 0
13+
li t5 1
14+
beq t3 zero end1
15+
b5: lb t4 0(t3)
16+
beq t4 zero end1
17+
out t4 0x1000
18+
add t3 t3 t5
19+
beq zero zero b5
20+
end1: sret
21+
22+
sys_prt_ch: out a0 0x1000
23+
sret
24+
25+
rt_i0: # 0.- interruption
26+
sret
27+
28+
rt_i1: # 1.- interruption
29+
lw s1 4(s0) # note: A4
30+
out s1 0x4004
31+
lw s1 0(s0) # time: 8n
32+
out s1 0x4008
33+
li s1 1 # play + silence
34+
out s1 0x4000
35+
addi s0 s0 8
36+
sret
37+
38+
rt_sys: # 2.- ecall
39+
li t4 4
40+
beq a7 t4 sys_prt_str
41+
li t4 11
42+
beq a7 t4 sys_prt_ch
43+
sret
44+
45+
46+
.data
47+
toplay: .word 8,0x0004, 8,0x0002, 0,0
48+
49+
.text
50+
51+
prog_IO: # programmed I/O
52+
la t0 toplay
53+
li t3 1 # play + silence
54+
loop2:
55+
# play untill 0,0
56+
lw t1 0(t0) # time
57+
lw t2 4(t0) # note
58+
addi t0 t0 8
59+
beq t1 x0 end2
60+
61+
# play sound
62+
out t1 0x4008 # time
63+
out t2 0x4004 # note (A4)
64+
out t3 0x4000 # play + silence
65+
beq x0 x0 loop2
66+
67+
end2: # the end
68+
jr ra
69+
70+
int_IO:
71+
# Int. I/O
72+
la s0 toplay
73+
li t0 1
74+
out t0 0x1104
75+
li t0 300
76+
out t0 0x1108
77+
78+
li t0 0
79+
li t2 5
80+
b1: beq t0 t2 e1
81+
li a0 'x'
82+
li a7 11
83+
ecall
84+
addi t0 t0 1
85+
beq zero zero b1
86+
e1: li t0 0
87+
out t0 0x1104
88+
out t0 0x1108
89+
90+
# the end
91+
jr ra
92+
93+
main:
94+
jal ra int_IO
95+
96+

repo/examples_set/rv32/default.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
"testing": true
254254
},
255255
{
256-
"id": "R5E2",
256+
"id": "R5E6",
257257
"title": "IEEE 754 (32 bits)",
258258
"type": "<span data-langkey='Special'>Special</span>",
259259
"modes": "newbie,intro,ep",
@@ -263,6 +263,17 @@
263263
"description": "<span data-langkey='example_01_01'>Simple example with fetch, arithmetic instructions, and basic .text segment.</span>",
264264
"testing": true
265265
},
266+
{
267+
"id": "R5E7",
268+
"title": "I/O (sound)",
269+
"type": "<span data-langkey='Special'>Special</span>",
270+
"modes": "newbie,intro,ep",
271+
"hardware": "ep",
272+
"microcode": "ep_bare",
273+
"assembly": "s6e8",
274+
"description": "<span data-langkey='example_01_01'>Simple example with for I/O.</span>",
275+
"testing": true
276+
},
266277
{
267278
"id": "S1E1",
268279
"title": "Instructions",

repo/examples_set/rv32/es_ep.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
"testing": true
254254
},
255255
{
256-
"id": "R5E2",
256+
"id": "R5E6",
257257
"title": "IEEE 754 (32 bits)",
258258
"type": "<span data-langkey='Special'>Special</span>",
259259
"modes": "newbie,intro,ep",
@@ -262,5 +262,16 @@
262262
"assembly": "s6e7",
263263
"description": "<span data-langkey='example_01_01'>Simple example with fetch, arithmetic instructions, and basic .text segment.</span>",
264264
"testing": true
265+
},
266+
{
267+
"id": "R5E7",
268+
"title": "I/O (sound)",
269+
"type": "<span data-langkey='Special'>Special</span>",
270+
"modes": "newbie,intro,ep",
271+
"hardware": "ep",
272+
"microcode": "ep_bare",
273+
"assembly": "s6e8",
274+
"description": "<span data-langkey='example_01_01'>Simple example with for I/O.</span>",
275+
"testing": true
265276
}
266277
]

sim_hw/hw_items/io_screen_base.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function io_screen_base_register ( sim_p )
147147
* Syntax of behaviors
148148
*/
149149

150-
sim_p.behaviors.SCR_IOR = { nparameters: 6,
150+
sim_p.behaviors.SCR_IOR = { nparameters: 6,
151151
types: ["E", "E", "E", "E", "E"],
152152
operation: function (s_expr)
153153
{
@@ -177,19 +177,19 @@ function io_screen_base_register ( sim_p )
177177
}
178178
};
179179

180-
sim_p.behaviors.SCR_IOW = { nparameters: 6,
180+
sim_p.behaviors.SCR_IOW = { nparameters: 6,
181181
types: ["E", "E", "E", "E", "E"],
182182
operation: function (s_expr)
183183
{
184184
var bus_ab = get_value(sim_p.states[s_expr[1]]) ;
185-
var bus_db = get_value(sim_p.states[s_expr[2]]) ;
186-
var clk = get_value(sim_p.states[s_expr[5]]) ;
187-
var ch = String.fromCharCode(bus_db);
188-
189185
if (bus_ab != DDR_ID) {
190186
return;
191187
}
192188

189+
var bus_db = get_value(sim_p.states[s_expr[2]]) ;
190+
var clk = get_value(sim_p.states[s_expr[5]]) ;
191+
var ch = String.fromCharCode(bus_db);
192+
193193
if (ch == String.fromCharCode(0x0007)) // '\a'
194194
{
195195
// (a) audible
@@ -202,11 +202,11 @@ function io_screen_base_register ( sim_p )
202202
if (typeof sim_p.events.screen[clk] != "undefined")
203203
screen = screen.substr(0, screen.length-1) ;
204204
set_screen_content(screen + ch) ;
205+
sim_p.events.screen[clk] = bus_db ;
205206
}
206207

207208
set_value(sim_p.states[s_expr[3]], bus_db) ;
208209
set_value(sim_p.states[s_expr[4]], 1) ;
209-
sim_p.events.screen[clk] = bus_db ;
210210
},
211211
verbal: function (s_expr)
212212
{
@@ -217,8 +217,9 @@ function io_screen_base_register ( sim_p )
217217
var clk = get_value(sim_p.states[s_expr[5]]) ;
218218
var ch = String.fromCharCode(bus_db);
219219

220-
if (bus_ab == DDR_ID)
220+
if (bus_ab == DDR_ID) {
221221
verbal = "Try to write into the screen the code " + ch + " at clock cycle " + clk + ". " ;
222+
}
222223

223224
return verbal ;
224225
}

0 commit comments

Comments
 (0)