Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: m-labs/misoc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fd27e952f2a0
Choose a base ref
...
head repository: m-labs/misoc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3fcc4f116c32
Choose a head ref
  • 3 commits
  • 13 files changed
  • 1 contributor

Commits on Nov 10, 2015

  1. Copy the full SHA
    af66764 View commit details
  2. Copy the full SHA
    be2d0da View commit details
  3. Copy the full SHA
    3fcc4f1 View commit details
24 changes: 11 additions & 13 deletions misoc/cores/identifier.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
from migen import *

from misoc.interconnect.csr import *


class Identifier(Module, AutoCSR):
def __init__(self, sysid, frequency, revision=None):
self._sysid = CSRStatus(16)
self._frequency = CSRStatus(32)

###

self.comb += [
self._sysid.status.eq(sysid),
self._frequency.status.eq(frequency)
]
class Identifier(Module):
def __init__(self, ident):
contents = list(ident.encode())
l = len(contents)
if l > 255:
raise ValueError("Identifier string must be 255 characters or less")
contents.insert(0, l)
self.mem = Memory(8, len(contents), init=contents)

def get_memories(self):
return [(True, self.mem)]
24 changes: 11 additions & 13 deletions misoc/integration/soc_core.py
Original file line number Diff line number Diff line change
@@ -15,13 +15,13 @@ def mem_decoder(address, start=26, end=29):

class SoCCore(Module):
csr_map = {
"crg": 0, # user
"uart_phy": 1, # provided by default (optional)
"uart": 2, # provided by default (optional)
"identifier": 3, # provided by default (optional)
"timer0": 4, # provided by default (optional)
"buttons": 5, # user
"leds": 6, # user
"crg": 0, # user
"uart_phy": 1, # provided by default (optional)
"uart": 2, # provided by default (optional)
"identifier_mem": 3, # provided by default (optional)
"timer0": 4, # provided by default (optional)
"buttons": 5, # user
"leds": 6, # user
}
interrupt_map = {
"uart": 0,
@@ -41,7 +41,7 @@ def __init__(self, platform, clk_freq,
shadow_base=0x80000000,
csr_data_width=8, csr_address_width=14,
with_uart=True, uart_baudrate=115200,
with_identifier=True,
ident="",
with_timer=True):
self.platform = platform
self.clk_freq = clk_freq
@@ -58,8 +58,6 @@ def __init__(self, platform, clk_freq,
self.with_uart = with_uart
self.uart_baudrate = uart_baudrate

self.with_identifier = with_identifier

self.shadow_base = shadow_base

self.csr_data_width = csr_data_width
@@ -102,9 +100,9 @@ def __init__(self, platform, clk_freq,
self.submodules.uart_phy = uart.RS232PHY(platform.request("serial"), clk_freq, uart_baudrate)
self.submodules.uart = uart.UART(self.uart_phy)

if with_identifier:
platform_id = 0x554E if not hasattr(platform, "identifier") else platform.identifier
self.submodules.identifier = identifier.Identifier(platform_id, int(clk_freq))
if ident:
self.submodules.identifier = identifier.Identifier(ident)
self.add_constant("SYSTEM_CLOCK_FREQUENCY", int(clk_freq))

if with_timer:
self.submodules.timer0 = timer.Timer()
7 changes: 6 additions & 1 deletion misoc/interconnect/csr_bus.py
Original file line number Diff line number Diff line change
@@ -152,11 +152,16 @@ def scan(self, ifargs, ifkwargs):
if hasattr(obj, "get_memories"):
memories = obj.get_memories()
for memory in memories:
if isinstance(memory, tuple):
read_only, memory = memory
else:
read_only = False
mapaddr = self.address_map(name, memory)
if mapaddr is None:
continue
sram_bus = Interface(*ifargs, **ifkwargs)
mmap = SRAM(memory, mapaddr, bus=sram_bus)
mmap = SRAM(memory, mapaddr, read_only=read_only,
bus=sram_bus)
self.submodules += mmap
csrs += mmap.get_csrs()
self.srams.append((name, memory, mapaddr, mmap))
2 changes: 1 addition & 1 deletion misoc/software/bios/Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include ../include/generated/variables.mak
include $(MISOC_DIRECTORY)/software/common.mak

OBJECTS=isr.o sdram.o main.o boot-helper-$(CPU).o boot.o dataflow.o
OBJECTS=isr.o sdram.o main.o boot-helper-$(CPU).o boot.o

all: bios.bin

2 changes: 1 addition & 1 deletion misoc/software/bios/boot.c
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ static int check_ack(void)

timer0_en_write(0);
timer0_reload_write(0);
timer0_load_write(identifier_frequency_read()/4);
timer0_load_write(SYSTEM_CLOCK_FREQUENCY/4);
timer0_en_write(1);
timer0_update_value_write(1);
recognized = 0;
42 changes: 0 additions & 42 deletions misoc/software/bios/dataflow.c

This file was deleted.

7 changes: 0 additions & 7 deletions misoc/software/bios/dataflow.h

This file was deleted.

32 changes: 10 additions & 22 deletions misoc/software/bios/main.c
Original file line number Diff line number Diff line change
@@ -13,7 +13,6 @@
#include <net/microudp.h>

#include "sdram.h"
#include "dataflow.h"
#include "boot.h"

/* General address space functions */
@@ -176,6 +175,14 @@ static void crc(char *startaddr, char *len)
printf("CRC32: %08x\n", crc32((unsigned char *)addr, length));
}

static void ident(void)
{
char buffer[IDENT_SIZE];

get_ident(buffer);
printf("Ident: %s\n", buffer);
}

#ifdef __lm32__
enum {
CSR_IE = 1, CSR_IM, CSR_IP, CSR_ICC, CSR_DCC, CSR_CC, CSR_CFG, CSR_EBA,
@@ -288,23 +295,6 @@ static void wcsr(char *csr, char *value)

#endif /* __lm32__ */

static void dfs(char *baseaddr)
{
char *c;
unsigned int addr;

if(*baseaddr == 0) {
printf("dfs <address>\n");
return;
}
addr = strtoul(baseaddr, &c, 0);
if(*c != 0) {
printf("incorrect address\n");
return;
}
print_isd_info(addr);
}

/* Init + command line */

static void help(void)
@@ -361,6 +351,7 @@ static void do_command(char *c)
else if(strcmp(token, "mw") == 0) mw(get_token(&c), get_token(&c), get_token(&c));
else if(strcmp(token, "mc") == 0) mc(get_token(&c), get_token(&c), get_token(&c));
else if(strcmp(token, "crc") == 0) crc(get_token(&c), get_token(&c));
else if(strcmp(token, "ident") == 0) ident();

#ifdef L2_SIZE
else if(strcmp(token, "flushl2") == 0) flush_l2_cache();
@@ -401,8 +392,6 @@ static void do_command(char *c)
else if(strcmp(token, "sdrinit") == 0) sdrinit();
#endif

else if(strcmp(token, "dfs") == 0) dfs(get_token(&c));

else if(strcmp(token, "") != 0)
printf("Command not found\n");
}
@@ -479,7 +468,7 @@ static int test_user_abort(void)
#endif
timer0_en_write(0);
timer0_reload_write(0);
timer0_load_write(identifier_frequency_read()*2);
timer0_load_write(SYSTEM_CLOCK_FREQUENCY*2);
timer0_en_write(1);
timer0_update_value_write(1);
while(timer0_value_read()) {
@@ -537,7 +526,6 @@ int main(int i, char **c)
"(c) Copyright 2007-2015 M-Labs Limited\n"
"Built "__DATE__" "__TIME__"\n");
crcbios();
id_print();
#ifdef CSR_ETHMAC_BASE
eth_init();
#endif
4 changes: 2 additions & 2 deletions misoc/software/include/base/id.h
Original file line number Diff line number Diff line change
@@ -5,8 +5,8 @@
extern "C" {
#endif

void get_sysid_formatted(char *sysid);
void id_print(void);
#define IDENT_SIZE 256
void get_ident(char *ident);

#ifdef __cplusplus
}
22 changes: 11 additions & 11 deletions misoc/software/libbase/id.c
Original file line number Diff line number Diff line change
@@ -4,17 +4,17 @@
#include <string.h>
#include <id.h>

void get_sysid_formatted(char *sysid)
{
sysid[0] = identifier_sysid_read() >> 8;
sysid[1] = identifier_sysid_read();
sysid[2] = 0;
}

void id_print(void)
void get_ident(char *ident)
{
char sysid[3];

get_sysid_formatted(sysid);
printf("Running on MiSoC (sysid:%s) at %dMHz\n", sysid, identifier_frequency_read()/1000000);
#ifdef CSR_IDENTIFIER_MEM_BASE
int len, i;

len = MMPTR(CSR_IDENTIFIER_MEM_BASE);
for(i=0;i<len;i++)
ident[i] = MMPTR(CSR_IDENTIFIER_MEM_BASE + 4 + i*4);
ident[i] = 0;
#else
ident[0] = 0;
#endif
}
2 changes: 1 addition & 1 deletion misoc/software/libbase/time.c
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ void time_init(void)
int t;

timer0_en_write(0);
t = 2*identifier_frequency_read();
t = 2*SYSTEM_CLOCK_FREQUENCY;
timer0_reload_write(t);
timer0_load_write(t);
timer0_en_write(1);
2 changes: 1 addition & 1 deletion misoc/software/libnet/microudp.c
Original file line number Diff line number Diff line change
@@ -427,7 +427,7 @@ static void busy_wait(unsigned int ds)
{
timer0_en_write(0);
timer0_reload_write(0);
timer0_load_write(identifier_frequency_read()/10*ds);
timer0_load_write(SYSTEM_CLOCK_FREQUENCY/10*ds);
timer0_en_write(1);
timer0_update_value_write(1);
while(timer0_value_read()) timer0_update_value_write(1);
8 changes: 3 additions & 5 deletions misoc/software/memtest/main.c
Original file line number Diff line number Diff line change
@@ -22,18 +22,16 @@ static void membw_service(void)
{
static int last_event;
unsigned long long int nr, nw;
unsigned long long int f;
unsigned int rdb, wrb;
unsigned int dw;

if(elapsed(&last_event, identifier_frequency_read())) {
if(elapsed(&last_event, SYSTEM_CLOCK_FREQUENCY)) {
sdram_controller_bandwidth_update_write(1);
nr = sdram_controller_bandwidth_nreads_read();
nw = sdram_controller_bandwidth_nwrites_read();
f = identifier_frequency_read();
dw = sdram_controller_bandwidth_data_width_read();
rdb = (nr*f >> (24 - log2(dw)))/1000000ULL;
wrb = (nw*f >> (24 - log2(dw)))/1000000ULL;
rdb = (nr*SYSTEM_CLOCK_FREQUENCY >> (24 - log2(dw)))/1000000ULL;
wrb = (nw*SYSTEM_CLOCK_FREQUENCY >> (24 - log2(dw)))/1000000ULL;
printf("read:%5dMbps write:%5dMbps all:%5dMbps\n", rdb, wrb, rdb + wrb);
}
}